{-# 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.HyperParameterSpecification where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.ParameterRange
import Amazonka.SageMaker.Types.ParameterType
data HyperParameterSpecification = HyperParameterSpecification'
{
HyperParameterSpecification -> Maybe Bool
isTunable :: Prelude.Maybe Prelude.Bool,
HyperParameterSpecification -> Maybe ParameterRange
range :: Prelude.Maybe ParameterRange,
HyperParameterSpecification -> Maybe Text
defaultValue :: Prelude.Maybe Prelude.Text,
HyperParameterSpecification -> Maybe Bool
isRequired :: Prelude.Maybe Prelude.Bool,
HyperParameterSpecification -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
HyperParameterSpecification -> Text
name :: Prelude.Text,
HyperParameterSpecification -> ParameterType
type' :: ParameterType
}
deriving (HyperParameterSpecification -> HyperParameterSpecification -> Bool
(HyperParameterSpecification
-> HyperParameterSpecification -> Bool)
-> (HyperParameterSpecification
-> HyperParameterSpecification -> Bool)
-> Eq HyperParameterSpecification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HyperParameterSpecification -> HyperParameterSpecification -> Bool
$c/= :: HyperParameterSpecification -> HyperParameterSpecification -> Bool
== :: HyperParameterSpecification -> HyperParameterSpecification -> Bool
$c== :: HyperParameterSpecification -> HyperParameterSpecification -> Bool
Prelude.Eq, ReadPrec [HyperParameterSpecification]
ReadPrec HyperParameterSpecification
Int -> ReadS HyperParameterSpecification
ReadS [HyperParameterSpecification]
(Int -> ReadS HyperParameterSpecification)
-> ReadS [HyperParameterSpecification]
-> ReadPrec HyperParameterSpecification
-> ReadPrec [HyperParameterSpecification]
-> Read HyperParameterSpecification
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HyperParameterSpecification]
$creadListPrec :: ReadPrec [HyperParameterSpecification]
readPrec :: ReadPrec HyperParameterSpecification
$creadPrec :: ReadPrec HyperParameterSpecification
readList :: ReadS [HyperParameterSpecification]
$creadList :: ReadS [HyperParameterSpecification]
readsPrec :: Int -> ReadS HyperParameterSpecification
$creadsPrec :: Int -> ReadS HyperParameterSpecification
Prelude.Read, Int -> HyperParameterSpecification -> ShowS
[HyperParameterSpecification] -> ShowS
HyperParameterSpecification -> String
(Int -> HyperParameterSpecification -> ShowS)
-> (HyperParameterSpecification -> String)
-> ([HyperParameterSpecification] -> ShowS)
-> Show HyperParameterSpecification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HyperParameterSpecification] -> ShowS
$cshowList :: [HyperParameterSpecification] -> ShowS
show :: HyperParameterSpecification -> String
$cshow :: HyperParameterSpecification -> String
showsPrec :: Int -> HyperParameterSpecification -> ShowS
$cshowsPrec :: Int -> HyperParameterSpecification -> ShowS
Prelude.Show, (forall x.
HyperParameterSpecification -> Rep HyperParameterSpecification x)
-> (forall x.
Rep HyperParameterSpecification x -> HyperParameterSpecification)
-> Generic HyperParameterSpecification
forall x.
Rep HyperParameterSpecification x -> HyperParameterSpecification
forall x.
HyperParameterSpecification -> Rep HyperParameterSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep HyperParameterSpecification x -> HyperParameterSpecification
$cfrom :: forall x.
HyperParameterSpecification -> Rep HyperParameterSpecification x
Prelude.Generic)
newHyperParameterSpecification ::
Prelude.Text ->
ParameterType ->
HyperParameterSpecification
newHyperParameterSpecification :: Text -> ParameterType -> HyperParameterSpecification
newHyperParameterSpecification Text
pName_ ParameterType
pType_ =
HyperParameterSpecification' :: Maybe Bool
-> Maybe ParameterRange
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Text
-> ParameterType
-> HyperParameterSpecification
HyperParameterSpecification'
{ $sel:isTunable:HyperParameterSpecification' :: Maybe Bool
isTunable =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:range:HyperParameterSpecification' :: Maybe ParameterRange
range = Maybe ParameterRange
forall a. Maybe a
Prelude.Nothing,
$sel:defaultValue:HyperParameterSpecification' :: Maybe Text
defaultValue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:isRequired:HyperParameterSpecification' :: Maybe Bool
isRequired = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:description:HyperParameterSpecification' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:HyperParameterSpecification' :: Text
name = Text
pName_,
$sel:type':HyperParameterSpecification' :: ParameterType
type' = ParameterType
pType_
}
hyperParameterSpecification_isTunable :: Lens.Lens' HyperParameterSpecification (Prelude.Maybe Prelude.Bool)
hyperParameterSpecification_isTunable :: (Maybe Bool -> f (Maybe Bool))
-> HyperParameterSpecification -> f HyperParameterSpecification
hyperParameterSpecification_isTunable = (HyperParameterSpecification -> Maybe Bool)
-> (HyperParameterSpecification
-> Maybe Bool -> HyperParameterSpecification)
-> Lens
HyperParameterSpecification
HyperParameterSpecification
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperParameterSpecification' {Maybe Bool
isTunable :: Maybe Bool
$sel:isTunable:HyperParameterSpecification' :: HyperParameterSpecification -> Maybe Bool
isTunable} -> Maybe Bool
isTunable) (\s :: HyperParameterSpecification
s@HyperParameterSpecification' {} Maybe Bool
a -> HyperParameterSpecification
s {$sel:isTunable:HyperParameterSpecification' :: Maybe Bool
isTunable = Maybe Bool
a} :: HyperParameterSpecification)
hyperParameterSpecification_range :: Lens.Lens' HyperParameterSpecification (Prelude.Maybe ParameterRange)
hyperParameterSpecification_range :: (Maybe ParameterRange -> f (Maybe ParameterRange))
-> HyperParameterSpecification -> f HyperParameterSpecification
hyperParameterSpecification_range = (HyperParameterSpecification -> Maybe ParameterRange)
-> (HyperParameterSpecification
-> Maybe ParameterRange -> HyperParameterSpecification)
-> Lens
HyperParameterSpecification
HyperParameterSpecification
(Maybe ParameterRange)
(Maybe ParameterRange)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperParameterSpecification' {Maybe ParameterRange
range :: Maybe ParameterRange
$sel:range:HyperParameterSpecification' :: HyperParameterSpecification -> Maybe ParameterRange
range} -> Maybe ParameterRange
range) (\s :: HyperParameterSpecification
s@HyperParameterSpecification' {} Maybe ParameterRange
a -> HyperParameterSpecification
s {$sel:range:HyperParameterSpecification' :: Maybe ParameterRange
range = Maybe ParameterRange
a} :: HyperParameterSpecification)
hyperParameterSpecification_defaultValue :: Lens.Lens' HyperParameterSpecification (Prelude.Maybe Prelude.Text)
hyperParameterSpecification_defaultValue :: (Maybe Text -> f (Maybe Text))
-> HyperParameterSpecification -> f HyperParameterSpecification
hyperParameterSpecification_defaultValue = (HyperParameterSpecification -> Maybe Text)
-> (HyperParameterSpecification
-> Maybe Text -> HyperParameterSpecification)
-> Lens
HyperParameterSpecification
HyperParameterSpecification
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperParameterSpecification' {Maybe Text
defaultValue :: Maybe Text
$sel:defaultValue:HyperParameterSpecification' :: HyperParameterSpecification -> Maybe Text
defaultValue} -> Maybe Text
defaultValue) (\s :: HyperParameterSpecification
s@HyperParameterSpecification' {} Maybe Text
a -> HyperParameterSpecification
s {$sel:defaultValue:HyperParameterSpecification' :: Maybe Text
defaultValue = Maybe Text
a} :: HyperParameterSpecification)
hyperParameterSpecification_isRequired :: Lens.Lens' HyperParameterSpecification (Prelude.Maybe Prelude.Bool)
hyperParameterSpecification_isRequired :: (Maybe Bool -> f (Maybe Bool))
-> HyperParameterSpecification -> f HyperParameterSpecification
hyperParameterSpecification_isRequired = (HyperParameterSpecification -> Maybe Bool)
-> (HyperParameterSpecification
-> Maybe Bool -> HyperParameterSpecification)
-> Lens
HyperParameterSpecification
HyperParameterSpecification
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperParameterSpecification' {Maybe Bool
isRequired :: Maybe Bool
$sel:isRequired:HyperParameterSpecification' :: HyperParameterSpecification -> Maybe Bool
isRequired} -> Maybe Bool
isRequired) (\s :: HyperParameterSpecification
s@HyperParameterSpecification' {} Maybe Bool
a -> HyperParameterSpecification
s {$sel:isRequired:HyperParameterSpecification' :: Maybe Bool
isRequired = Maybe Bool
a} :: HyperParameterSpecification)
hyperParameterSpecification_description :: Lens.Lens' HyperParameterSpecification (Prelude.Maybe Prelude.Text)
hyperParameterSpecification_description :: (Maybe Text -> f (Maybe Text))
-> HyperParameterSpecification -> f HyperParameterSpecification
hyperParameterSpecification_description = (HyperParameterSpecification -> Maybe Text)
-> (HyperParameterSpecification
-> Maybe Text -> HyperParameterSpecification)
-> Lens
HyperParameterSpecification
HyperParameterSpecification
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperParameterSpecification' {Maybe Text
description :: Maybe Text
$sel:description:HyperParameterSpecification' :: HyperParameterSpecification -> Maybe Text
description} -> Maybe Text
description) (\s :: HyperParameterSpecification
s@HyperParameterSpecification' {} Maybe Text
a -> HyperParameterSpecification
s {$sel:description:HyperParameterSpecification' :: Maybe Text
description = Maybe Text
a} :: HyperParameterSpecification)
hyperParameterSpecification_name :: Lens.Lens' HyperParameterSpecification Prelude.Text
hyperParameterSpecification_name :: (Text -> f Text)
-> HyperParameterSpecification -> f HyperParameterSpecification
hyperParameterSpecification_name = (HyperParameterSpecification -> Text)
-> (HyperParameterSpecification
-> Text -> HyperParameterSpecification)
-> Lens
HyperParameterSpecification HyperParameterSpecification Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperParameterSpecification' {Text
name :: Text
$sel:name:HyperParameterSpecification' :: HyperParameterSpecification -> Text
name} -> Text
name) (\s :: HyperParameterSpecification
s@HyperParameterSpecification' {} Text
a -> HyperParameterSpecification
s {$sel:name:HyperParameterSpecification' :: Text
name = Text
a} :: HyperParameterSpecification)
hyperParameterSpecification_type :: Lens.Lens' HyperParameterSpecification ParameterType
hyperParameterSpecification_type :: (ParameterType -> f ParameterType)
-> HyperParameterSpecification -> f HyperParameterSpecification
hyperParameterSpecification_type = (HyperParameterSpecification -> ParameterType)
-> (HyperParameterSpecification
-> ParameterType -> HyperParameterSpecification)
-> Lens
HyperParameterSpecification
HyperParameterSpecification
ParameterType
ParameterType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperParameterSpecification' {ParameterType
type' :: ParameterType
$sel:type':HyperParameterSpecification' :: HyperParameterSpecification -> ParameterType
type'} -> ParameterType
type') (\s :: HyperParameterSpecification
s@HyperParameterSpecification' {} ParameterType
a -> HyperParameterSpecification
s {$sel:type':HyperParameterSpecification' :: ParameterType
type' = ParameterType
a} :: HyperParameterSpecification)
instance Core.FromJSON HyperParameterSpecification where
parseJSON :: Value -> Parser HyperParameterSpecification
parseJSON =
String
-> (Object -> Parser HyperParameterSpecification)
-> Value
-> Parser HyperParameterSpecification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"HyperParameterSpecification"
( \Object
x ->
Maybe Bool
-> Maybe ParameterRange
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Text
-> ParameterType
-> HyperParameterSpecification
HyperParameterSpecification'
(Maybe Bool
-> Maybe ParameterRange
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Text
-> ParameterType
-> HyperParameterSpecification)
-> Parser (Maybe Bool)
-> Parser
(Maybe ParameterRange
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Text
-> ParameterType
-> HyperParameterSpecification)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IsTunable")
Parser
(Maybe ParameterRange
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Text
-> ParameterType
-> HyperParameterSpecification)
-> Parser (Maybe ParameterRange)
-> Parser
(Maybe Text
-> Maybe Bool
-> Maybe Text
-> Text
-> ParameterType
-> HyperParameterSpecification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ParameterRange)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Range")
Parser
(Maybe Text
-> Maybe Bool
-> Maybe Text
-> Text
-> ParameterType
-> HyperParameterSpecification)
-> Parser (Maybe Text)
-> Parser
(Maybe Bool
-> Maybe Text
-> Text
-> ParameterType
-> HyperParameterSpecification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DefaultValue")
Parser
(Maybe Bool
-> Maybe Text
-> Text
-> ParameterType
-> HyperParameterSpecification)
-> Parser (Maybe Bool)
-> Parser
(Maybe Text
-> Text -> ParameterType -> HyperParameterSpecification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IsRequired")
Parser
(Maybe Text
-> Text -> ParameterType -> HyperParameterSpecification)
-> Parser (Maybe Text)
-> Parser (Text -> ParameterType -> HyperParameterSpecification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Description")
Parser (Text -> ParameterType -> HyperParameterSpecification)
-> Parser Text
-> Parser (ParameterType -> HyperParameterSpecification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Name")
Parser (ParameterType -> HyperParameterSpecification)
-> Parser ParameterType -> Parser HyperParameterSpecification
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ParameterType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Type")
)
instance Prelude.Hashable HyperParameterSpecification
instance Prelude.NFData HyperParameterSpecification
instance Core.ToJSON HyperParameterSpecification where
toJSON :: HyperParameterSpecification -> Value
toJSON HyperParameterSpecification' {Maybe Bool
Maybe Text
Maybe ParameterRange
Text
ParameterType
type' :: ParameterType
name :: Text
description :: Maybe Text
isRequired :: Maybe Bool
defaultValue :: Maybe Text
range :: Maybe ParameterRange
isTunable :: Maybe Bool
$sel:type':HyperParameterSpecification' :: HyperParameterSpecification -> ParameterType
$sel:name:HyperParameterSpecification' :: HyperParameterSpecification -> Text
$sel:description:HyperParameterSpecification' :: HyperParameterSpecification -> Maybe Text
$sel:isRequired:HyperParameterSpecification' :: HyperParameterSpecification -> Maybe Bool
$sel:defaultValue:HyperParameterSpecification' :: HyperParameterSpecification -> Maybe Text
$sel:range:HyperParameterSpecification' :: HyperParameterSpecification -> Maybe ParameterRange
$sel:isTunable:HyperParameterSpecification' :: HyperParameterSpecification -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"IsTunable" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
isTunable,
(Text
"Range" Text -> ParameterRange -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ParameterRange -> Pair) -> Maybe ParameterRange -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ParameterRange
range,
(Text
"DefaultValue" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
defaultValue,
(Text
"IsRequired" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
isRequired,
(Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> ParameterType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ParameterType
type')
]
)