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