{-# 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.IoTJobAbortConfig where
import qualified Amazonka.Core as Core
import Amazonka.GreengrassV2.Types.IoTJobAbortCriteria
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data IoTJobAbortConfig = IoTJobAbortConfig'
{
IoTJobAbortConfig -> NonEmpty IoTJobAbortCriteria
criteriaList :: Prelude.NonEmpty IoTJobAbortCriteria
}
deriving (IoTJobAbortConfig -> IoTJobAbortConfig -> Bool
(IoTJobAbortConfig -> IoTJobAbortConfig -> Bool)
-> (IoTJobAbortConfig -> IoTJobAbortConfig -> Bool)
-> Eq IoTJobAbortConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IoTJobAbortConfig -> IoTJobAbortConfig -> Bool
$c/= :: IoTJobAbortConfig -> IoTJobAbortConfig -> Bool
== :: IoTJobAbortConfig -> IoTJobAbortConfig -> Bool
$c== :: IoTJobAbortConfig -> IoTJobAbortConfig -> Bool
Prelude.Eq, ReadPrec [IoTJobAbortConfig]
ReadPrec IoTJobAbortConfig
Int -> ReadS IoTJobAbortConfig
ReadS [IoTJobAbortConfig]
(Int -> ReadS IoTJobAbortConfig)
-> ReadS [IoTJobAbortConfig]
-> ReadPrec IoTJobAbortConfig
-> ReadPrec [IoTJobAbortConfig]
-> Read IoTJobAbortConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IoTJobAbortConfig]
$creadListPrec :: ReadPrec [IoTJobAbortConfig]
readPrec :: ReadPrec IoTJobAbortConfig
$creadPrec :: ReadPrec IoTJobAbortConfig
readList :: ReadS [IoTJobAbortConfig]
$creadList :: ReadS [IoTJobAbortConfig]
readsPrec :: Int -> ReadS IoTJobAbortConfig
$creadsPrec :: Int -> ReadS IoTJobAbortConfig
Prelude.Read, Int -> IoTJobAbortConfig -> ShowS
[IoTJobAbortConfig] -> ShowS
IoTJobAbortConfig -> String
(Int -> IoTJobAbortConfig -> ShowS)
-> (IoTJobAbortConfig -> String)
-> ([IoTJobAbortConfig] -> ShowS)
-> Show IoTJobAbortConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IoTJobAbortConfig] -> ShowS
$cshowList :: [IoTJobAbortConfig] -> ShowS
show :: IoTJobAbortConfig -> String
$cshow :: IoTJobAbortConfig -> String
showsPrec :: Int -> IoTJobAbortConfig -> ShowS
$cshowsPrec :: Int -> IoTJobAbortConfig -> ShowS
Prelude.Show, (forall x. IoTJobAbortConfig -> Rep IoTJobAbortConfig x)
-> (forall x. Rep IoTJobAbortConfig x -> IoTJobAbortConfig)
-> Generic IoTJobAbortConfig
forall x. Rep IoTJobAbortConfig x -> IoTJobAbortConfig
forall x. IoTJobAbortConfig -> Rep IoTJobAbortConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IoTJobAbortConfig x -> IoTJobAbortConfig
$cfrom :: forall x. IoTJobAbortConfig -> Rep IoTJobAbortConfig x
Prelude.Generic)
newIoTJobAbortConfig ::
Prelude.NonEmpty IoTJobAbortCriteria ->
IoTJobAbortConfig
newIoTJobAbortConfig :: NonEmpty IoTJobAbortCriteria -> IoTJobAbortConfig
newIoTJobAbortConfig NonEmpty IoTJobAbortCriteria
pCriteriaList_ =
IoTJobAbortConfig' :: NonEmpty IoTJobAbortCriteria -> IoTJobAbortConfig
IoTJobAbortConfig'
{ $sel:criteriaList:IoTJobAbortConfig' :: NonEmpty IoTJobAbortCriteria
criteriaList =
Tagged
(NonEmpty IoTJobAbortCriteria)
(Identity (NonEmpty IoTJobAbortCriteria))
-> Tagged
(NonEmpty IoTJobAbortCriteria)
(Identity (NonEmpty IoTJobAbortCriteria))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
(NonEmpty IoTJobAbortCriteria)
(Identity (NonEmpty IoTJobAbortCriteria))
-> Tagged
(NonEmpty IoTJobAbortCriteria)
(Identity (NonEmpty IoTJobAbortCriteria)))
-> NonEmpty IoTJobAbortCriteria -> NonEmpty IoTJobAbortCriteria
forall t b. AReview t b -> b -> t
Lens.# NonEmpty IoTJobAbortCriteria
pCriteriaList_
}
ioTJobAbortConfig_criteriaList :: Lens.Lens' IoTJobAbortConfig (Prelude.NonEmpty IoTJobAbortCriteria)
ioTJobAbortConfig_criteriaList :: (NonEmpty IoTJobAbortCriteria -> f (NonEmpty IoTJobAbortCriteria))
-> IoTJobAbortConfig -> f IoTJobAbortConfig
ioTJobAbortConfig_criteriaList = (IoTJobAbortConfig -> NonEmpty IoTJobAbortCriteria)
-> (IoTJobAbortConfig
-> NonEmpty IoTJobAbortCriteria -> IoTJobAbortConfig)
-> Lens
IoTJobAbortConfig
IoTJobAbortConfig
(NonEmpty IoTJobAbortCriteria)
(NonEmpty IoTJobAbortCriteria)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IoTJobAbortConfig' {NonEmpty IoTJobAbortCriteria
criteriaList :: NonEmpty IoTJobAbortCriteria
$sel:criteriaList:IoTJobAbortConfig' :: IoTJobAbortConfig -> NonEmpty IoTJobAbortCriteria
criteriaList} -> NonEmpty IoTJobAbortCriteria
criteriaList) (\s :: IoTJobAbortConfig
s@IoTJobAbortConfig' {} NonEmpty IoTJobAbortCriteria
a -> IoTJobAbortConfig
s {$sel:criteriaList:IoTJobAbortConfig' :: NonEmpty IoTJobAbortCriteria
criteriaList = NonEmpty IoTJobAbortCriteria
a} :: IoTJobAbortConfig) ((NonEmpty IoTJobAbortCriteria -> f (NonEmpty IoTJobAbortCriteria))
-> IoTJobAbortConfig -> f IoTJobAbortConfig)
-> ((NonEmpty IoTJobAbortCriteria
-> f (NonEmpty IoTJobAbortCriteria))
-> NonEmpty IoTJobAbortCriteria
-> f (NonEmpty IoTJobAbortCriteria))
-> (NonEmpty IoTJobAbortCriteria
-> f (NonEmpty IoTJobAbortCriteria))
-> IoTJobAbortConfig
-> f IoTJobAbortConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty IoTJobAbortCriteria -> f (NonEmpty IoTJobAbortCriteria))
-> NonEmpty IoTJobAbortCriteria -> f (NonEmpty IoTJobAbortCriteria)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON IoTJobAbortConfig where
parseJSON :: Value -> Parser IoTJobAbortConfig
parseJSON =
String
-> (Object -> Parser IoTJobAbortConfig)
-> Value
-> Parser IoTJobAbortConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"IoTJobAbortConfig"
( \Object
x ->
NonEmpty IoTJobAbortCriteria -> IoTJobAbortConfig
IoTJobAbortConfig'
(NonEmpty IoTJobAbortCriteria -> IoTJobAbortConfig)
-> Parser (NonEmpty IoTJobAbortCriteria)
-> Parser IoTJobAbortConfig
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (NonEmpty IoTJobAbortCriteria)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"criteriaList")
)
instance Prelude.Hashable IoTJobAbortConfig
instance Prelude.NFData IoTJobAbortConfig
instance Core.ToJSON IoTJobAbortConfig where
toJSON :: IoTJobAbortConfig -> Value
toJSON IoTJobAbortConfig' {NonEmpty IoTJobAbortCriteria
criteriaList :: NonEmpty IoTJobAbortCriteria
$sel:criteriaList:IoTJobAbortConfig' :: IoTJobAbortConfig -> NonEmpty IoTJobAbortCriteria
..} =
[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
"criteriaList" Text -> NonEmpty IoTJobAbortCriteria -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty IoTJobAbortCriteria
criteriaList)]
)