{-# 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.HyperbandStrategyConfig 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 HyperbandStrategyConfig = HyperbandStrategyConfig'
{
HyperbandStrategyConfig -> Maybe Natural
maxResource :: Prelude.Maybe Prelude.Natural,
HyperbandStrategyConfig -> Maybe Natural
minResource :: Prelude.Maybe Prelude.Natural
}
deriving (HyperbandStrategyConfig -> HyperbandStrategyConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HyperbandStrategyConfig -> HyperbandStrategyConfig -> Bool
$c/= :: HyperbandStrategyConfig -> HyperbandStrategyConfig -> Bool
== :: HyperbandStrategyConfig -> HyperbandStrategyConfig -> Bool
$c== :: HyperbandStrategyConfig -> HyperbandStrategyConfig -> Bool
Prelude.Eq, ReadPrec [HyperbandStrategyConfig]
ReadPrec HyperbandStrategyConfig
Int -> ReadS HyperbandStrategyConfig
ReadS [HyperbandStrategyConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HyperbandStrategyConfig]
$creadListPrec :: ReadPrec [HyperbandStrategyConfig]
readPrec :: ReadPrec HyperbandStrategyConfig
$creadPrec :: ReadPrec HyperbandStrategyConfig
readList :: ReadS [HyperbandStrategyConfig]
$creadList :: ReadS [HyperbandStrategyConfig]
readsPrec :: Int -> ReadS HyperbandStrategyConfig
$creadsPrec :: Int -> ReadS HyperbandStrategyConfig
Prelude.Read, Int -> HyperbandStrategyConfig -> ShowS
[HyperbandStrategyConfig] -> ShowS
HyperbandStrategyConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HyperbandStrategyConfig] -> ShowS
$cshowList :: [HyperbandStrategyConfig] -> ShowS
show :: HyperbandStrategyConfig -> String
$cshow :: HyperbandStrategyConfig -> String
showsPrec :: Int -> HyperbandStrategyConfig -> ShowS
$cshowsPrec :: Int -> HyperbandStrategyConfig -> ShowS
Prelude.Show, forall x. Rep HyperbandStrategyConfig x -> HyperbandStrategyConfig
forall x. HyperbandStrategyConfig -> Rep HyperbandStrategyConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HyperbandStrategyConfig x -> HyperbandStrategyConfig
$cfrom :: forall x. HyperbandStrategyConfig -> Rep HyperbandStrategyConfig x
Prelude.Generic)
newHyperbandStrategyConfig ::
HyperbandStrategyConfig
newHyperbandStrategyConfig :: HyperbandStrategyConfig
newHyperbandStrategyConfig =
HyperbandStrategyConfig'
{ $sel:maxResource:HyperbandStrategyConfig' :: Maybe Natural
maxResource =
forall a. Maybe a
Prelude.Nothing,
$sel:minResource:HyperbandStrategyConfig' :: Maybe Natural
minResource = forall a. Maybe a
Prelude.Nothing
}
hyperbandStrategyConfig_maxResource :: Lens.Lens' HyperbandStrategyConfig (Prelude.Maybe Prelude.Natural)
hyperbandStrategyConfig_maxResource :: Lens' HyperbandStrategyConfig (Maybe Natural)
hyperbandStrategyConfig_maxResource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperbandStrategyConfig' {Maybe Natural
maxResource :: Maybe Natural
$sel:maxResource:HyperbandStrategyConfig' :: HyperbandStrategyConfig -> Maybe Natural
maxResource} -> Maybe Natural
maxResource) (\s :: HyperbandStrategyConfig
s@HyperbandStrategyConfig' {} Maybe Natural
a -> HyperbandStrategyConfig
s {$sel:maxResource:HyperbandStrategyConfig' :: Maybe Natural
maxResource = Maybe Natural
a} :: HyperbandStrategyConfig)
hyperbandStrategyConfig_minResource :: Lens.Lens' HyperbandStrategyConfig (Prelude.Maybe Prelude.Natural)
hyperbandStrategyConfig_minResource :: Lens' HyperbandStrategyConfig (Maybe Natural)
hyperbandStrategyConfig_minResource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperbandStrategyConfig' {Maybe Natural
minResource :: Maybe Natural
$sel:minResource:HyperbandStrategyConfig' :: HyperbandStrategyConfig -> Maybe Natural
minResource} -> Maybe Natural
minResource) (\s :: HyperbandStrategyConfig
s@HyperbandStrategyConfig' {} Maybe Natural
a -> HyperbandStrategyConfig
s {$sel:minResource:HyperbandStrategyConfig' :: Maybe Natural
minResource = Maybe Natural
a} :: HyperbandStrategyConfig)
instance Data.FromJSON HyperbandStrategyConfig where
parseJSON :: Value -> Parser HyperbandStrategyConfig
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"HyperbandStrategyConfig"
( \Object
x ->
Maybe Natural -> Maybe Natural -> HyperbandStrategyConfig
HyperbandStrategyConfig'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"MaxResource")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"MinResource")
)
instance Prelude.Hashable HyperbandStrategyConfig where
hashWithSalt :: Int -> HyperbandStrategyConfig -> Int
hashWithSalt Int
_salt HyperbandStrategyConfig' {Maybe Natural
minResource :: Maybe Natural
maxResource :: Maybe Natural
$sel:minResource:HyperbandStrategyConfig' :: HyperbandStrategyConfig -> Maybe Natural
$sel:maxResource:HyperbandStrategyConfig' :: HyperbandStrategyConfig -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResource
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
minResource
instance Prelude.NFData HyperbandStrategyConfig where
rnf :: HyperbandStrategyConfig -> ()
rnf HyperbandStrategyConfig' {Maybe Natural
minResource :: Maybe Natural
maxResource :: Maybe Natural
$sel:minResource:HyperbandStrategyConfig' :: HyperbandStrategyConfig -> Maybe Natural
$sel:maxResource:HyperbandStrategyConfig' :: HyperbandStrategyConfig -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResource
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
minResource
instance Data.ToJSON HyperbandStrategyConfig where
toJSON :: HyperbandStrategyConfig -> Value
toJSON HyperbandStrategyConfig' {Maybe Natural
minResource :: Maybe Natural
maxResource :: Maybe Natural
$sel:minResource:HyperbandStrategyConfig' :: HyperbandStrategyConfig -> Maybe Natural
$sel:maxResource:HyperbandStrategyConfig' :: HyperbandStrategyConfig -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"MaxResource" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResource,
(Key
"MinResource" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
minResource
]
)