{-# 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.CloudWatchEvents.Types.BatchParameters where
import Amazonka.CloudWatchEvents.Types.BatchArrayProperties
import Amazonka.CloudWatchEvents.Types.BatchRetryStrategy
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data BatchParameters = BatchParameters'
{
BatchParameters -> Maybe BatchRetryStrategy
retryStrategy :: Prelude.Maybe BatchRetryStrategy,
BatchParameters -> Maybe BatchArrayProperties
arrayProperties :: Prelude.Maybe BatchArrayProperties,
BatchParameters -> Text
jobDefinition :: Prelude.Text,
BatchParameters -> Text
jobName :: Prelude.Text
}
deriving (BatchParameters -> BatchParameters -> Bool
(BatchParameters -> BatchParameters -> Bool)
-> (BatchParameters -> BatchParameters -> Bool)
-> Eq BatchParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchParameters -> BatchParameters -> Bool
$c/= :: BatchParameters -> BatchParameters -> Bool
== :: BatchParameters -> BatchParameters -> Bool
$c== :: BatchParameters -> BatchParameters -> Bool
Prelude.Eq, ReadPrec [BatchParameters]
ReadPrec BatchParameters
Int -> ReadS BatchParameters
ReadS [BatchParameters]
(Int -> ReadS BatchParameters)
-> ReadS [BatchParameters]
-> ReadPrec BatchParameters
-> ReadPrec [BatchParameters]
-> Read BatchParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchParameters]
$creadListPrec :: ReadPrec [BatchParameters]
readPrec :: ReadPrec BatchParameters
$creadPrec :: ReadPrec BatchParameters
readList :: ReadS [BatchParameters]
$creadList :: ReadS [BatchParameters]
readsPrec :: Int -> ReadS BatchParameters
$creadsPrec :: Int -> ReadS BatchParameters
Prelude.Read, Int -> BatchParameters -> ShowS
[BatchParameters] -> ShowS
BatchParameters -> String
(Int -> BatchParameters -> ShowS)
-> (BatchParameters -> String)
-> ([BatchParameters] -> ShowS)
-> Show BatchParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchParameters] -> ShowS
$cshowList :: [BatchParameters] -> ShowS
show :: BatchParameters -> String
$cshow :: BatchParameters -> String
showsPrec :: Int -> BatchParameters -> ShowS
$cshowsPrec :: Int -> BatchParameters -> ShowS
Prelude.Show, (forall x. BatchParameters -> Rep BatchParameters x)
-> (forall x. Rep BatchParameters x -> BatchParameters)
-> Generic BatchParameters
forall x. Rep BatchParameters x -> BatchParameters
forall x. BatchParameters -> Rep BatchParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchParameters x -> BatchParameters
$cfrom :: forall x. BatchParameters -> Rep BatchParameters x
Prelude.Generic)
newBatchParameters ::
Prelude.Text ->
Prelude.Text ->
BatchParameters
newBatchParameters :: Text -> Text -> BatchParameters
newBatchParameters Text
pJobDefinition_ Text
pJobName_ =
BatchParameters' :: Maybe BatchRetryStrategy
-> Maybe BatchArrayProperties -> Text -> Text -> BatchParameters
BatchParameters'
{ $sel:retryStrategy:BatchParameters' :: Maybe BatchRetryStrategy
retryStrategy = Maybe BatchRetryStrategy
forall a. Maybe a
Prelude.Nothing,
$sel:arrayProperties:BatchParameters' :: Maybe BatchArrayProperties
arrayProperties = Maybe BatchArrayProperties
forall a. Maybe a
Prelude.Nothing,
$sel:jobDefinition:BatchParameters' :: Text
jobDefinition = Text
pJobDefinition_,
$sel:jobName:BatchParameters' :: Text
jobName = Text
pJobName_
}
batchParameters_retryStrategy :: Lens.Lens' BatchParameters (Prelude.Maybe BatchRetryStrategy)
batchParameters_retryStrategy :: (Maybe BatchRetryStrategy -> f (Maybe BatchRetryStrategy))
-> BatchParameters -> f BatchParameters
batchParameters_retryStrategy = (BatchParameters -> Maybe BatchRetryStrategy)
-> (BatchParameters -> Maybe BatchRetryStrategy -> BatchParameters)
-> Lens
BatchParameters
BatchParameters
(Maybe BatchRetryStrategy)
(Maybe BatchRetryStrategy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchParameters' {Maybe BatchRetryStrategy
retryStrategy :: Maybe BatchRetryStrategy
$sel:retryStrategy:BatchParameters' :: BatchParameters -> Maybe BatchRetryStrategy
retryStrategy} -> Maybe BatchRetryStrategy
retryStrategy) (\s :: BatchParameters
s@BatchParameters' {} Maybe BatchRetryStrategy
a -> BatchParameters
s {$sel:retryStrategy:BatchParameters' :: Maybe BatchRetryStrategy
retryStrategy = Maybe BatchRetryStrategy
a} :: BatchParameters)
batchParameters_arrayProperties :: Lens.Lens' BatchParameters (Prelude.Maybe BatchArrayProperties)
batchParameters_arrayProperties :: (Maybe BatchArrayProperties -> f (Maybe BatchArrayProperties))
-> BatchParameters -> f BatchParameters
batchParameters_arrayProperties = (BatchParameters -> Maybe BatchArrayProperties)
-> (BatchParameters
-> Maybe BatchArrayProperties -> BatchParameters)
-> Lens
BatchParameters
BatchParameters
(Maybe BatchArrayProperties)
(Maybe BatchArrayProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchParameters' {Maybe BatchArrayProperties
arrayProperties :: Maybe BatchArrayProperties
$sel:arrayProperties:BatchParameters' :: BatchParameters -> Maybe BatchArrayProperties
arrayProperties} -> Maybe BatchArrayProperties
arrayProperties) (\s :: BatchParameters
s@BatchParameters' {} Maybe BatchArrayProperties
a -> BatchParameters
s {$sel:arrayProperties:BatchParameters' :: Maybe BatchArrayProperties
arrayProperties = Maybe BatchArrayProperties
a} :: BatchParameters)
batchParameters_jobDefinition :: Lens.Lens' BatchParameters Prelude.Text
batchParameters_jobDefinition :: (Text -> f Text) -> BatchParameters -> f BatchParameters
batchParameters_jobDefinition = (BatchParameters -> Text)
-> (BatchParameters -> Text -> BatchParameters)
-> Lens BatchParameters BatchParameters Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchParameters' {Text
jobDefinition :: Text
$sel:jobDefinition:BatchParameters' :: BatchParameters -> Text
jobDefinition} -> Text
jobDefinition) (\s :: BatchParameters
s@BatchParameters' {} Text
a -> BatchParameters
s {$sel:jobDefinition:BatchParameters' :: Text
jobDefinition = Text
a} :: BatchParameters)
batchParameters_jobName :: Lens.Lens' BatchParameters Prelude.Text
batchParameters_jobName :: (Text -> f Text) -> BatchParameters -> f BatchParameters
batchParameters_jobName = (BatchParameters -> Text)
-> (BatchParameters -> Text -> BatchParameters)
-> Lens BatchParameters BatchParameters Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchParameters' {Text
jobName :: Text
$sel:jobName:BatchParameters' :: BatchParameters -> Text
jobName} -> Text
jobName) (\s :: BatchParameters
s@BatchParameters' {} Text
a -> BatchParameters
s {$sel:jobName:BatchParameters' :: Text
jobName = Text
a} :: BatchParameters)
instance Core.FromJSON BatchParameters where
parseJSON :: Value -> Parser BatchParameters
parseJSON =
String
-> (Object -> Parser BatchParameters)
-> Value
-> Parser BatchParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"BatchParameters"
( \Object
x ->
Maybe BatchRetryStrategy
-> Maybe BatchArrayProperties -> Text -> Text -> BatchParameters
BatchParameters'
(Maybe BatchRetryStrategy
-> Maybe BatchArrayProperties -> Text -> Text -> BatchParameters)
-> Parser (Maybe BatchRetryStrategy)
-> Parser
(Maybe BatchArrayProperties -> Text -> Text -> BatchParameters)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe BatchRetryStrategy)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RetryStrategy")
Parser
(Maybe BatchArrayProperties -> Text -> Text -> BatchParameters)
-> Parser (Maybe BatchArrayProperties)
-> Parser (Text -> Text -> BatchParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe BatchArrayProperties)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ArrayProperties")
Parser (Text -> Text -> BatchParameters)
-> Parser Text -> Parser (Text -> BatchParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"JobDefinition")
Parser (Text -> BatchParameters)
-> Parser Text -> Parser BatchParameters
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"JobName")
)
instance Prelude.Hashable BatchParameters
instance Prelude.NFData BatchParameters
instance Core.ToJSON BatchParameters where
toJSON :: BatchParameters -> Value
toJSON BatchParameters' {Maybe BatchArrayProperties
Maybe BatchRetryStrategy
Text
jobName :: Text
jobDefinition :: Text
arrayProperties :: Maybe BatchArrayProperties
retryStrategy :: Maybe BatchRetryStrategy
$sel:jobName:BatchParameters' :: BatchParameters -> Text
$sel:jobDefinition:BatchParameters' :: BatchParameters -> Text
$sel:arrayProperties:BatchParameters' :: BatchParameters -> Maybe BatchArrayProperties
$sel:retryStrategy:BatchParameters' :: BatchParameters -> Maybe BatchRetryStrategy
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"RetryStrategy" Text -> BatchRetryStrategy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (BatchRetryStrategy -> Pair)
-> Maybe BatchRetryStrategy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BatchRetryStrategy
retryStrategy,
(Text
"ArrayProperties" Text -> BatchArrayProperties -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(BatchArrayProperties -> Pair)
-> Maybe BatchArrayProperties -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BatchArrayProperties
arrayProperties,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"JobDefinition" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
jobDefinition),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"JobName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
jobName)
]
)