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