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