{-# 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.GreengrassV2.Types.IoTJobAbortCriteria where
import qualified Amazonka.Core as Core
import Amazonka.GreengrassV2.Types.IoTJobAbortAction
import Amazonka.GreengrassV2.Types.IoTJobExecutionFailureType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data IoTJobAbortCriteria = IoTJobAbortCriteria'
{
IoTJobAbortCriteria -> IoTJobExecutionFailureType
failureType :: IoTJobExecutionFailureType,
IoTJobAbortCriteria -> IoTJobAbortAction
action :: IoTJobAbortAction,
IoTJobAbortCriteria -> Double
thresholdPercentage :: Prelude.Double,
IoTJobAbortCriteria -> Natural
minNumberOfExecutedThings :: Prelude.Natural
}
deriving (IoTJobAbortCriteria -> IoTJobAbortCriteria -> Bool
(IoTJobAbortCriteria -> IoTJobAbortCriteria -> Bool)
-> (IoTJobAbortCriteria -> IoTJobAbortCriteria -> Bool)
-> Eq IoTJobAbortCriteria
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IoTJobAbortCriteria -> IoTJobAbortCriteria -> Bool
$c/= :: IoTJobAbortCriteria -> IoTJobAbortCriteria -> Bool
== :: IoTJobAbortCriteria -> IoTJobAbortCriteria -> Bool
$c== :: IoTJobAbortCriteria -> IoTJobAbortCriteria -> Bool
Prelude.Eq, ReadPrec [IoTJobAbortCriteria]
ReadPrec IoTJobAbortCriteria
Int -> ReadS IoTJobAbortCriteria
ReadS [IoTJobAbortCriteria]
(Int -> ReadS IoTJobAbortCriteria)
-> ReadS [IoTJobAbortCriteria]
-> ReadPrec IoTJobAbortCriteria
-> ReadPrec [IoTJobAbortCriteria]
-> Read IoTJobAbortCriteria
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IoTJobAbortCriteria]
$creadListPrec :: ReadPrec [IoTJobAbortCriteria]
readPrec :: ReadPrec IoTJobAbortCriteria
$creadPrec :: ReadPrec IoTJobAbortCriteria
readList :: ReadS [IoTJobAbortCriteria]
$creadList :: ReadS [IoTJobAbortCriteria]
readsPrec :: Int -> ReadS IoTJobAbortCriteria
$creadsPrec :: Int -> ReadS IoTJobAbortCriteria
Prelude.Read, Int -> IoTJobAbortCriteria -> ShowS
[IoTJobAbortCriteria] -> ShowS
IoTJobAbortCriteria -> String
(Int -> IoTJobAbortCriteria -> ShowS)
-> (IoTJobAbortCriteria -> String)
-> ([IoTJobAbortCriteria] -> ShowS)
-> Show IoTJobAbortCriteria
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IoTJobAbortCriteria] -> ShowS
$cshowList :: [IoTJobAbortCriteria] -> ShowS
show :: IoTJobAbortCriteria -> String
$cshow :: IoTJobAbortCriteria -> String
showsPrec :: Int -> IoTJobAbortCriteria -> ShowS
$cshowsPrec :: Int -> IoTJobAbortCriteria -> ShowS
Prelude.Show, (forall x. IoTJobAbortCriteria -> Rep IoTJobAbortCriteria x)
-> (forall x. Rep IoTJobAbortCriteria x -> IoTJobAbortCriteria)
-> Generic IoTJobAbortCriteria
forall x. Rep IoTJobAbortCriteria x -> IoTJobAbortCriteria
forall x. IoTJobAbortCriteria -> Rep IoTJobAbortCriteria x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IoTJobAbortCriteria x -> IoTJobAbortCriteria
$cfrom :: forall x. IoTJobAbortCriteria -> Rep IoTJobAbortCriteria x
Prelude.Generic)
newIoTJobAbortCriteria ::
IoTJobExecutionFailureType ->
IoTJobAbortAction ->
Prelude.Double ->
Prelude.Natural ->
IoTJobAbortCriteria
newIoTJobAbortCriteria :: IoTJobExecutionFailureType
-> IoTJobAbortAction -> Double -> Natural -> IoTJobAbortCriteria
newIoTJobAbortCriteria
IoTJobExecutionFailureType
pFailureType_
IoTJobAbortAction
pAction_
Double
pThresholdPercentage_
Natural
pMinNumberOfExecutedThings_ =
IoTJobAbortCriteria' :: IoTJobExecutionFailureType
-> IoTJobAbortAction -> Double -> Natural -> IoTJobAbortCriteria
IoTJobAbortCriteria'
{ $sel:failureType:IoTJobAbortCriteria' :: IoTJobExecutionFailureType
failureType = IoTJobExecutionFailureType
pFailureType_,
$sel:action:IoTJobAbortCriteria' :: IoTJobAbortAction
action = IoTJobAbortAction
pAction_,
$sel:thresholdPercentage:IoTJobAbortCriteria' :: Double
thresholdPercentage = Double
pThresholdPercentage_,
$sel:minNumberOfExecutedThings:IoTJobAbortCriteria' :: Natural
minNumberOfExecutedThings =
Natural
pMinNumberOfExecutedThings_
}
ioTJobAbortCriteria_failureType :: Lens.Lens' IoTJobAbortCriteria IoTJobExecutionFailureType
ioTJobAbortCriteria_failureType :: (IoTJobExecutionFailureType -> f IoTJobExecutionFailureType)
-> IoTJobAbortCriteria -> f IoTJobAbortCriteria
ioTJobAbortCriteria_failureType = (IoTJobAbortCriteria -> IoTJobExecutionFailureType)
-> (IoTJobAbortCriteria
-> IoTJobExecutionFailureType -> IoTJobAbortCriteria)
-> Lens
IoTJobAbortCriteria
IoTJobAbortCriteria
IoTJobExecutionFailureType
IoTJobExecutionFailureType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IoTJobAbortCriteria' {IoTJobExecutionFailureType
failureType :: IoTJobExecutionFailureType
$sel:failureType:IoTJobAbortCriteria' :: IoTJobAbortCriteria -> IoTJobExecutionFailureType
failureType} -> IoTJobExecutionFailureType
failureType) (\s :: IoTJobAbortCriteria
s@IoTJobAbortCriteria' {} IoTJobExecutionFailureType
a -> IoTJobAbortCriteria
s {$sel:failureType:IoTJobAbortCriteria' :: IoTJobExecutionFailureType
failureType = IoTJobExecutionFailureType
a} :: IoTJobAbortCriteria)
ioTJobAbortCriteria_action :: Lens.Lens' IoTJobAbortCriteria IoTJobAbortAction
ioTJobAbortCriteria_action :: (IoTJobAbortAction -> f IoTJobAbortAction)
-> IoTJobAbortCriteria -> f IoTJobAbortCriteria
ioTJobAbortCriteria_action = (IoTJobAbortCriteria -> IoTJobAbortAction)
-> (IoTJobAbortCriteria
-> IoTJobAbortAction -> IoTJobAbortCriteria)
-> Lens
IoTJobAbortCriteria
IoTJobAbortCriteria
IoTJobAbortAction
IoTJobAbortAction
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IoTJobAbortCriteria' {IoTJobAbortAction
action :: IoTJobAbortAction
$sel:action:IoTJobAbortCriteria' :: IoTJobAbortCriteria -> IoTJobAbortAction
action} -> IoTJobAbortAction
action) (\s :: IoTJobAbortCriteria
s@IoTJobAbortCriteria' {} IoTJobAbortAction
a -> IoTJobAbortCriteria
s {$sel:action:IoTJobAbortCriteria' :: IoTJobAbortAction
action = IoTJobAbortAction
a} :: IoTJobAbortCriteria)
ioTJobAbortCriteria_thresholdPercentage :: Lens.Lens' IoTJobAbortCriteria Prelude.Double
ioTJobAbortCriteria_thresholdPercentage :: (Double -> f Double)
-> IoTJobAbortCriteria -> f IoTJobAbortCriteria
ioTJobAbortCriteria_thresholdPercentage = (IoTJobAbortCriteria -> Double)
-> (IoTJobAbortCriteria -> Double -> IoTJobAbortCriteria)
-> Lens IoTJobAbortCriteria IoTJobAbortCriteria Double Double
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IoTJobAbortCriteria' {Double
thresholdPercentage :: Double
$sel:thresholdPercentage:IoTJobAbortCriteria' :: IoTJobAbortCriteria -> Double
thresholdPercentage} -> Double
thresholdPercentage) (\s :: IoTJobAbortCriteria
s@IoTJobAbortCriteria' {} Double
a -> IoTJobAbortCriteria
s {$sel:thresholdPercentage:IoTJobAbortCriteria' :: Double
thresholdPercentage = Double
a} :: IoTJobAbortCriteria)
ioTJobAbortCriteria_minNumberOfExecutedThings :: Lens.Lens' IoTJobAbortCriteria Prelude.Natural
ioTJobAbortCriteria_minNumberOfExecutedThings :: (Natural -> f Natural)
-> IoTJobAbortCriteria -> f IoTJobAbortCriteria
ioTJobAbortCriteria_minNumberOfExecutedThings = (IoTJobAbortCriteria -> Natural)
-> (IoTJobAbortCriteria -> Natural -> IoTJobAbortCriteria)
-> Lens IoTJobAbortCriteria IoTJobAbortCriteria Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IoTJobAbortCriteria' {Natural
minNumberOfExecutedThings :: Natural
$sel:minNumberOfExecutedThings:IoTJobAbortCriteria' :: IoTJobAbortCriteria -> Natural
minNumberOfExecutedThings} -> Natural
minNumberOfExecutedThings) (\s :: IoTJobAbortCriteria
s@IoTJobAbortCriteria' {} Natural
a -> IoTJobAbortCriteria
s {$sel:minNumberOfExecutedThings:IoTJobAbortCriteria' :: Natural
minNumberOfExecutedThings = Natural
a} :: IoTJobAbortCriteria)
instance Core.FromJSON IoTJobAbortCriteria where
parseJSON :: Value -> Parser IoTJobAbortCriteria
parseJSON =
String
-> (Object -> Parser IoTJobAbortCriteria)
-> Value
-> Parser IoTJobAbortCriteria
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"IoTJobAbortCriteria"
( \Object
x ->
IoTJobExecutionFailureType
-> IoTJobAbortAction -> Double -> Natural -> IoTJobAbortCriteria
IoTJobAbortCriteria'
(IoTJobExecutionFailureType
-> IoTJobAbortAction -> Double -> Natural -> IoTJobAbortCriteria)
-> Parser IoTJobExecutionFailureType
-> Parser
(IoTJobAbortAction -> Double -> Natural -> IoTJobAbortCriteria)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser IoTJobExecutionFailureType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"failureType")
Parser
(IoTJobAbortAction -> Double -> Natural -> IoTJobAbortCriteria)
-> Parser IoTJobAbortAction
-> Parser (Double -> Natural -> IoTJobAbortCriteria)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser IoTJobAbortAction
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"action")
Parser (Double -> Natural -> IoTJobAbortCriteria)
-> Parser Double -> Parser (Natural -> IoTJobAbortCriteria)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Double
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"thresholdPercentage")
Parser (Natural -> IoTJobAbortCriteria)
-> Parser Natural -> Parser IoTJobAbortCriteria
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"minNumberOfExecutedThings")
)
instance Prelude.Hashable IoTJobAbortCriteria
instance Prelude.NFData IoTJobAbortCriteria
instance Core.ToJSON IoTJobAbortCriteria where
toJSON :: IoTJobAbortCriteria -> Value
toJSON IoTJobAbortCriteria' {Double
Natural
IoTJobAbortAction
IoTJobExecutionFailureType
minNumberOfExecutedThings :: Natural
thresholdPercentage :: Double
action :: IoTJobAbortAction
failureType :: IoTJobExecutionFailureType
$sel:minNumberOfExecutedThings:IoTJobAbortCriteria' :: IoTJobAbortCriteria -> Natural
$sel:thresholdPercentage:IoTJobAbortCriteria' :: IoTJobAbortCriteria -> Double
$sel:action:IoTJobAbortCriteria' :: IoTJobAbortCriteria -> IoTJobAbortAction
$sel:failureType:IoTJobAbortCriteria' :: IoTJobAbortCriteria -> IoTJobExecutionFailureType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"failureType" Text -> IoTJobExecutionFailureType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= IoTJobExecutionFailureType
failureType),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"action" Text -> IoTJobAbortAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= IoTJobAbortAction
action),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"thresholdPercentage" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Double
thresholdPercentage),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"minNumberOfExecutedThings"
Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
minNumberOfExecutedThings
)
]
)