{-# 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.SageMaker.Types.StoppingCondition where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data StoppingCondition = StoppingCondition'
{
StoppingCondition -> Maybe Natural
maxWaitTimeInSeconds :: Prelude.Maybe Prelude.Natural,
StoppingCondition -> Maybe Natural
maxRuntimeInSeconds :: Prelude.Maybe Prelude.Natural
}
deriving (StoppingCondition -> StoppingCondition -> Bool
(StoppingCondition -> StoppingCondition -> Bool)
-> (StoppingCondition -> StoppingCondition -> Bool)
-> Eq StoppingCondition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StoppingCondition -> StoppingCondition -> Bool
$c/= :: StoppingCondition -> StoppingCondition -> Bool
== :: StoppingCondition -> StoppingCondition -> Bool
$c== :: StoppingCondition -> StoppingCondition -> Bool
Prelude.Eq, ReadPrec [StoppingCondition]
ReadPrec StoppingCondition
Int -> ReadS StoppingCondition
ReadS [StoppingCondition]
(Int -> ReadS StoppingCondition)
-> ReadS [StoppingCondition]
-> ReadPrec StoppingCondition
-> ReadPrec [StoppingCondition]
-> Read StoppingCondition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StoppingCondition]
$creadListPrec :: ReadPrec [StoppingCondition]
readPrec :: ReadPrec StoppingCondition
$creadPrec :: ReadPrec StoppingCondition
readList :: ReadS [StoppingCondition]
$creadList :: ReadS [StoppingCondition]
readsPrec :: Int -> ReadS StoppingCondition
$creadsPrec :: Int -> ReadS StoppingCondition
Prelude.Read, Int -> StoppingCondition -> ShowS
[StoppingCondition] -> ShowS
StoppingCondition -> String
(Int -> StoppingCondition -> ShowS)
-> (StoppingCondition -> String)
-> ([StoppingCondition] -> ShowS)
-> Show StoppingCondition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StoppingCondition] -> ShowS
$cshowList :: [StoppingCondition] -> ShowS
show :: StoppingCondition -> String
$cshow :: StoppingCondition -> String
showsPrec :: Int -> StoppingCondition -> ShowS
$cshowsPrec :: Int -> StoppingCondition -> ShowS
Prelude.Show, (forall x. StoppingCondition -> Rep StoppingCondition x)
-> (forall x. Rep StoppingCondition x -> StoppingCondition)
-> Generic StoppingCondition
forall x. Rep StoppingCondition x -> StoppingCondition
forall x. StoppingCondition -> Rep StoppingCondition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StoppingCondition x -> StoppingCondition
$cfrom :: forall x. StoppingCondition -> Rep StoppingCondition x
Prelude.Generic)
newStoppingCondition ::
StoppingCondition
newStoppingCondition :: StoppingCondition
newStoppingCondition =
StoppingCondition' :: Maybe Natural -> Maybe Natural -> StoppingCondition
StoppingCondition'
{ $sel:maxWaitTimeInSeconds:StoppingCondition' :: Maybe Natural
maxWaitTimeInSeconds =
Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:maxRuntimeInSeconds:StoppingCondition' :: Maybe Natural
maxRuntimeInSeconds = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
stoppingCondition_maxWaitTimeInSeconds :: Lens.Lens' StoppingCondition (Prelude.Maybe Prelude.Natural)
stoppingCondition_maxWaitTimeInSeconds :: (Maybe Natural -> f (Maybe Natural))
-> StoppingCondition -> f StoppingCondition
stoppingCondition_maxWaitTimeInSeconds = (StoppingCondition -> Maybe Natural)
-> (StoppingCondition -> Maybe Natural -> StoppingCondition)
-> Lens
StoppingCondition StoppingCondition (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StoppingCondition' {Maybe Natural
maxWaitTimeInSeconds :: Maybe Natural
$sel:maxWaitTimeInSeconds:StoppingCondition' :: StoppingCondition -> Maybe Natural
maxWaitTimeInSeconds} -> Maybe Natural
maxWaitTimeInSeconds) (\s :: StoppingCondition
s@StoppingCondition' {} Maybe Natural
a -> StoppingCondition
s {$sel:maxWaitTimeInSeconds:StoppingCondition' :: Maybe Natural
maxWaitTimeInSeconds = Maybe Natural
a} :: StoppingCondition)
stoppingCondition_maxRuntimeInSeconds :: Lens.Lens' StoppingCondition (Prelude.Maybe Prelude.Natural)
stoppingCondition_maxRuntimeInSeconds :: (Maybe Natural -> f (Maybe Natural))
-> StoppingCondition -> f StoppingCondition
stoppingCondition_maxRuntimeInSeconds = (StoppingCondition -> Maybe Natural)
-> (StoppingCondition -> Maybe Natural -> StoppingCondition)
-> Lens
StoppingCondition StoppingCondition (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StoppingCondition' {Maybe Natural
maxRuntimeInSeconds :: Maybe Natural
$sel:maxRuntimeInSeconds:StoppingCondition' :: StoppingCondition -> Maybe Natural
maxRuntimeInSeconds} -> Maybe Natural
maxRuntimeInSeconds) (\s :: StoppingCondition
s@StoppingCondition' {} Maybe Natural
a -> StoppingCondition
s {$sel:maxRuntimeInSeconds:StoppingCondition' :: Maybe Natural
maxRuntimeInSeconds = Maybe Natural
a} :: StoppingCondition)
instance Core.FromJSON StoppingCondition where
parseJSON :: Value -> Parser StoppingCondition
parseJSON =
String
-> (Object -> Parser StoppingCondition)
-> Value
-> Parser StoppingCondition
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"StoppingCondition"
( \Object
x ->
Maybe Natural -> Maybe Natural -> StoppingCondition
StoppingCondition'
(Maybe Natural -> Maybe Natural -> StoppingCondition)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> StoppingCondition)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MaxWaitTimeInSeconds")
Parser (Maybe Natural -> StoppingCondition)
-> Parser (Maybe Natural) -> Parser StoppingCondition
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MaxRuntimeInSeconds")
)
instance Prelude.Hashable StoppingCondition
instance Prelude.NFData StoppingCondition
instance Core.ToJSON StoppingCondition where
toJSON :: StoppingCondition -> Value
toJSON StoppingCondition' {Maybe Natural
maxRuntimeInSeconds :: Maybe Natural
maxWaitTimeInSeconds :: Maybe Natural
$sel:maxRuntimeInSeconds:StoppingCondition' :: StoppingCondition -> Maybe Natural
$sel:maxWaitTimeInSeconds:StoppingCondition' :: StoppingCondition -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"MaxWaitTimeInSeconds" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxWaitTimeInSeconds,
(Text
"MaxRuntimeInSeconds" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxRuntimeInSeconds
]
)