{-# 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.Glue.Types.EventBatchingCondition where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data EventBatchingCondition = EventBatchingCondition'
{
EventBatchingCondition -> Maybe Natural
batchWindow :: Prelude.Maybe Prelude.Natural,
EventBatchingCondition -> Natural
batchSize :: Prelude.Natural
}
deriving (EventBatchingCondition -> EventBatchingCondition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventBatchingCondition -> EventBatchingCondition -> Bool
$c/= :: EventBatchingCondition -> EventBatchingCondition -> Bool
== :: EventBatchingCondition -> EventBatchingCondition -> Bool
$c== :: EventBatchingCondition -> EventBatchingCondition -> Bool
Prelude.Eq, ReadPrec [EventBatchingCondition]
ReadPrec EventBatchingCondition
Int -> ReadS EventBatchingCondition
ReadS [EventBatchingCondition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventBatchingCondition]
$creadListPrec :: ReadPrec [EventBatchingCondition]
readPrec :: ReadPrec EventBatchingCondition
$creadPrec :: ReadPrec EventBatchingCondition
readList :: ReadS [EventBatchingCondition]
$creadList :: ReadS [EventBatchingCondition]
readsPrec :: Int -> ReadS EventBatchingCondition
$creadsPrec :: Int -> ReadS EventBatchingCondition
Prelude.Read, Int -> EventBatchingCondition -> ShowS
[EventBatchingCondition] -> ShowS
EventBatchingCondition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventBatchingCondition] -> ShowS
$cshowList :: [EventBatchingCondition] -> ShowS
show :: EventBatchingCondition -> String
$cshow :: EventBatchingCondition -> String
showsPrec :: Int -> EventBatchingCondition -> ShowS
$cshowsPrec :: Int -> EventBatchingCondition -> ShowS
Prelude.Show, forall x. Rep EventBatchingCondition x -> EventBatchingCondition
forall x. EventBatchingCondition -> Rep EventBatchingCondition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EventBatchingCondition x -> EventBatchingCondition
$cfrom :: forall x. EventBatchingCondition -> Rep EventBatchingCondition x
Prelude.Generic)
newEventBatchingCondition ::
Prelude.Natural ->
EventBatchingCondition
newEventBatchingCondition :: Natural -> EventBatchingCondition
newEventBatchingCondition Natural
pBatchSize_ =
EventBatchingCondition'
{ $sel:batchWindow:EventBatchingCondition' :: Maybe Natural
batchWindow =
forall a. Maybe a
Prelude.Nothing,
$sel:batchSize:EventBatchingCondition' :: Natural
batchSize = Natural
pBatchSize_
}
eventBatchingCondition_batchWindow :: Lens.Lens' EventBatchingCondition (Prelude.Maybe Prelude.Natural)
eventBatchingCondition_batchWindow :: Lens' EventBatchingCondition (Maybe Natural)
eventBatchingCondition_batchWindow = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventBatchingCondition' {Maybe Natural
batchWindow :: Maybe Natural
$sel:batchWindow:EventBatchingCondition' :: EventBatchingCondition -> Maybe Natural
batchWindow} -> Maybe Natural
batchWindow) (\s :: EventBatchingCondition
s@EventBatchingCondition' {} Maybe Natural
a -> EventBatchingCondition
s {$sel:batchWindow:EventBatchingCondition' :: Maybe Natural
batchWindow = Maybe Natural
a} :: EventBatchingCondition)
eventBatchingCondition_batchSize :: Lens.Lens' EventBatchingCondition Prelude.Natural
eventBatchingCondition_batchSize :: Lens' EventBatchingCondition Natural
eventBatchingCondition_batchSize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventBatchingCondition' {Natural
batchSize :: Natural
$sel:batchSize:EventBatchingCondition' :: EventBatchingCondition -> Natural
batchSize} -> Natural
batchSize) (\s :: EventBatchingCondition
s@EventBatchingCondition' {} Natural
a -> EventBatchingCondition
s {$sel:batchSize:EventBatchingCondition' :: Natural
batchSize = Natural
a} :: EventBatchingCondition)
instance Data.FromJSON EventBatchingCondition where
parseJSON :: Value -> Parser EventBatchingCondition
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"EventBatchingCondition"
( \Object
x ->
Maybe Natural -> Natural -> EventBatchingCondition
EventBatchingCondition'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"BatchWindow")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"BatchSize")
)
instance Prelude.Hashable EventBatchingCondition where
hashWithSalt :: Int -> EventBatchingCondition -> Int
hashWithSalt Int
_salt EventBatchingCondition' {Natural
Maybe Natural
batchSize :: Natural
batchWindow :: Maybe Natural
$sel:batchSize:EventBatchingCondition' :: EventBatchingCondition -> Natural
$sel:batchWindow:EventBatchingCondition' :: EventBatchingCondition -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
batchWindow
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
batchSize
instance Prelude.NFData EventBatchingCondition where
rnf :: EventBatchingCondition -> ()
rnf EventBatchingCondition' {Natural
Maybe Natural
batchSize :: Natural
batchWindow :: Maybe Natural
$sel:batchSize:EventBatchingCondition' :: EventBatchingCondition -> Natural
$sel:batchWindow:EventBatchingCondition' :: EventBatchingCondition -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
batchWindow
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
batchSize
instance Data.ToJSON EventBatchingCondition where
toJSON :: EventBatchingCondition -> Value
toJSON EventBatchingCondition' {Natural
Maybe Natural
batchSize :: Natural
batchWindow :: Maybe Natural
$sel:batchSize:EventBatchingCondition' :: EventBatchingCondition -> Natural
$sel:batchWindow:EventBatchingCondition' :: EventBatchingCondition -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"BatchWindow" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
batchWindow,
forall a. a -> Maybe a
Prelude.Just (Key
"BatchSize" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
batchSize)
]
)