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