{-# 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.AlgorithmSpecification where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.MetricDefinition
import Amazonka.SageMaker.Types.TrainingInputMode
data AlgorithmSpecification = AlgorithmSpecification'
{
AlgorithmSpecification -> Maybe Bool
enableSageMakerMetricsTimeSeries :: Prelude.Maybe Prelude.Bool,
AlgorithmSpecification -> Maybe Text
algorithmName :: Prelude.Maybe Prelude.Text,
AlgorithmSpecification -> Maybe Text
trainingImage :: Prelude.Maybe Prelude.Text,
AlgorithmSpecification -> Maybe [MetricDefinition]
metricDefinitions :: Prelude.Maybe [MetricDefinition],
AlgorithmSpecification -> TrainingInputMode
trainingInputMode :: TrainingInputMode
}
deriving (AlgorithmSpecification -> AlgorithmSpecification -> Bool
(AlgorithmSpecification -> AlgorithmSpecification -> Bool)
-> (AlgorithmSpecification -> AlgorithmSpecification -> Bool)
-> Eq AlgorithmSpecification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AlgorithmSpecification -> AlgorithmSpecification -> Bool
$c/= :: AlgorithmSpecification -> AlgorithmSpecification -> Bool
== :: AlgorithmSpecification -> AlgorithmSpecification -> Bool
$c== :: AlgorithmSpecification -> AlgorithmSpecification -> Bool
Prelude.Eq, ReadPrec [AlgorithmSpecification]
ReadPrec AlgorithmSpecification
Int -> ReadS AlgorithmSpecification
ReadS [AlgorithmSpecification]
(Int -> ReadS AlgorithmSpecification)
-> ReadS [AlgorithmSpecification]
-> ReadPrec AlgorithmSpecification
-> ReadPrec [AlgorithmSpecification]
-> Read AlgorithmSpecification
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AlgorithmSpecification]
$creadListPrec :: ReadPrec [AlgorithmSpecification]
readPrec :: ReadPrec AlgorithmSpecification
$creadPrec :: ReadPrec AlgorithmSpecification
readList :: ReadS [AlgorithmSpecification]
$creadList :: ReadS [AlgorithmSpecification]
readsPrec :: Int -> ReadS AlgorithmSpecification
$creadsPrec :: Int -> ReadS AlgorithmSpecification
Prelude.Read, Int -> AlgorithmSpecification -> ShowS
[AlgorithmSpecification] -> ShowS
AlgorithmSpecification -> String
(Int -> AlgorithmSpecification -> ShowS)
-> (AlgorithmSpecification -> String)
-> ([AlgorithmSpecification] -> ShowS)
-> Show AlgorithmSpecification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AlgorithmSpecification] -> ShowS
$cshowList :: [AlgorithmSpecification] -> ShowS
show :: AlgorithmSpecification -> String
$cshow :: AlgorithmSpecification -> String
showsPrec :: Int -> AlgorithmSpecification -> ShowS
$cshowsPrec :: Int -> AlgorithmSpecification -> ShowS
Prelude.Show, (forall x. AlgorithmSpecification -> Rep AlgorithmSpecification x)
-> (forall x.
Rep AlgorithmSpecification x -> AlgorithmSpecification)
-> Generic AlgorithmSpecification
forall x. Rep AlgorithmSpecification x -> AlgorithmSpecification
forall x. AlgorithmSpecification -> Rep AlgorithmSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AlgorithmSpecification x -> AlgorithmSpecification
$cfrom :: forall x. AlgorithmSpecification -> Rep AlgorithmSpecification x
Prelude.Generic)
newAlgorithmSpecification ::
TrainingInputMode ->
AlgorithmSpecification
newAlgorithmSpecification :: TrainingInputMode -> AlgorithmSpecification
newAlgorithmSpecification TrainingInputMode
pTrainingInputMode_ =
AlgorithmSpecification' :: Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe [MetricDefinition]
-> TrainingInputMode
-> AlgorithmSpecification
AlgorithmSpecification'
{ $sel:enableSageMakerMetricsTimeSeries:AlgorithmSpecification' :: Maybe Bool
enableSageMakerMetricsTimeSeries =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:algorithmName:AlgorithmSpecification' :: Maybe Text
algorithmName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:trainingImage:AlgorithmSpecification' :: Maybe Text
trainingImage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:metricDefinitions:AlgorithmSpecification' :: Maybe [MetricDefinition]
metricDefinitions = Maybe [MetricDefinition]
forall a. Maybe a
Prelude.Nothing,
$sel:trainingInputMode:AlgorithmSpecification' :: TrainingInputMode
trainingInputMode = TrainingInputMode
pTrainingInputMode_
}
algorithmSpecification_enableSageMakerMetricsTimeSeries :: Lens.Lens' AlgorithmSpecification (Prelude.Maybe Prelude.Bool)
algorithmSpecification_enableSageMakerMetricsTimeSeries :: (Maybe Bool -> f (Maybe Bool))
-> AlgorithmSpecification -> f AlgorithmSpecification
algorithmSpecification_enableSageMakerMetricsTimeSeries = (AlgorithmSpecification -> Maybe Bool)
-> (AlgorithmSpecification -> Maybe Bool -> AlgorithmSpecification)
-> Lens
AlgorithmSpecification
AlgorithmSpecification
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlgorithmSpecification' {Maybe Bool
enableSageMakerMetricsTimeSeries :: Maybe Bool
$sel:enableSageMakerMetricsTimeSeries:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe Bool
enableSageMakerMetricsTimeSeries} -> Maybe Bool
enableSageMakerMetricsTimeSeries) (\s :: AlgorithmSpecification
s@AlgorithmSpecification' {} Maybe Bool
a -> AlgorithmSpecification
s {$sel:enableSageMakerMetricsTimeSeries:AlgorithmSpecification' :: Maybe Bool
enableSageMakerMetricsTimeSeries = Maybe Bool
a} :: AlgorithmSpecification)
algorithmSpecification_algorithmName :: Lens.Lens' AlgorithmSpecification (Prelude.Maybe Prelude.Text)
algorithmSpecification_algorithmName :: (Maybe Text -> f (Maybe Text))
-> AlgorithmSpecification -> f AlgorithmSpecification
algorithmSpecification_algorithmName = (AlgorithmSpecification -> Maybe Text)
-> (AlgorithmSpecification -> Maybe Text -> AlgorithmSpecification)
-> Lens
AlgorithmSpecification
AlgorithmSpecification
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlgorithmSpecification' {Maybe Text
algorithmName :: Maybe Text
$sel:algorithmName:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe Text
algorithmName} -> Maybe Text
algorithmName) (\s :: AlgorithmSpecification
s@AlgorithmSpecification' {} Maybe Text
a -> AlgorithmSpecification
s {$sel:algorithmName:AlgorithmSpecification' :: Maybe Text
algorithmName = Maybe Text
a} :: AlgorithmSpecification)
algorithmSpecification_trainingImage :: Lens.Lens' AlgorithmSpecification (Prelude.Maybe Prelude.Text)
algorithmSpecification_trainingImage :: (Maybe Text -> f (Maybe Text))
-> AlgorithmSpecification -> f AlgorithmSpecification
algorithmSpecification_trainingImage = (AlgorithmSpecification -> Maybe Text)
-> (AlgorithmSpecification -> Maybe Text -> AlgorithmSpecification)
-> Lens
AlgorithmSpecification
AlgorithmSpecification
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlgorithmSpecification' {Maybe Text
trainingImage :: Maybe Text
$sel:trainingImage:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe Text
trainingImage} -> Maybe Text
trainingImage) (\s :: AlgorithmSpecification
s@AlgorithmSpecification' {} Maybe Text
a -> AlgorithmSpecification
s {$sel:trainingImage:AlgorithmSpecification' :: Maybe Text
trainingImage = Maybe Text
a} :: AlgorithmSpecification)
algorithmSpecification_metricDefinitions :: Lens.Lens' AlgorithmSpecification (Prelude.Maybe [MetricDefinition])
algorithmSpecification_metricDefinitions :: (Maybe [MetricDefinition] -> f (Maybe [MetricDefinition]))
-> AlgorithmSpecification -> f AlgorithmSpecification
algorithmSpecification_metricDefinitions = (AlgorithmSpecification -> Maybe [MetricDefinition])
-> (AlgorithmSpecification
-> Maybe [MetricDefinition] -> AlgorithmSpecification)
-> Lens
AlgorithmSpecification
AlgorithmSpecification
(Maybe [MetricDefinition])
(Maybe [MetricDefinition])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlgorithmSpecification' {Maybe [MetricDefinition]
metricDefinitions :: Maybe [MetricDefinition]
$sel:metricDefinitions:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe [MetricDefinition]
metricDefinitions} -> Maybe [MetricDefinition]
metricDefinitions) (\s :: AlgorithmSpecification
s@AlgorithmSpecification' {} Maybe [MetricDefinition]
a -> AlgorithmSpecification
s {$sel:metricDefinitions:AlgorithmSpecification' :: Maybe [MetricDefinition]
metricDefinitions = Maybe [MetricDefinition]
a} :: AlgorithmSpecification) ((Maybe [MetricDefinition] -> f (Maybe [MetricDefinition]))
-> AlgorithmSpecification -> f AlgorithmSpecification)
-> ((Maybe [MetricDefinition] -> f (Maybe [MetricDefinition]))
-> Maybe [MetricDefinition] -> f (Maybe [MetricDefinition]))
-> (Maybe [MetricDefinition] -> f (Maybe [MetricDefinition]))
-> AlgorithmSpecification
-> f AlgorithmSpecification
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[MetricDefinition]
[MetricDefinition]
[MetricDefinition]
[MetricDefinition]
-> Iso
(Maybe [MetricDefinition])
(Maybe [MetricDefinition])
(Maybe [MetricDefinition])
(Maybe [MetricDefinition])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[MetricDefinition]
[MetricDefinition]
[MetricDefinition]
[MetricDefinition]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
algorithmSpecification_trainingInputMode :: Lens.Lens' AlgorithmSpecification TrainingInputMode
algorithmSpecification_trainingInputMode :: (TrainingInputMode -> f TrainingInputMode)
-> AlgorithmSpecification -> f AlgorithmSpecification
algorithmSpecification_trainingInputMode = (AlgorithmSpecification -> TrainingInputMode)
-> (AlgorithmSpecification
-> TrainingInputMode -> AlgorithmSpecification)
-> Lens
AlgorithmSpecification
AlgorithmSpecification
TrainingInputMode
TrainingInputMode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlgorithmSpecification' {TrainingInputMode
trainingInputMode :: TrainingInputMode
$sel:trainingInputMode:AlgorithmSpecification' :: AlgorithmSpecification -> TrainingInputMode
trainingInputMode} -> TrainingInputMode
trainingInputMode) (\s :: AlgorithmSpecification
s@AlgorithmSpecification' {} TrainingInputMode
a -> AlgorithmSpecification
s {$sel:trainingInputMode:AlgorithmSpecification' :: TrainingInputMode
trainingInputMode = TrainingInputMode
a} :: AlgorithmSpecification)
instance Core.FromJSON AlgorithmSpecification where
parseJSON :: Value -> Parser AlgorithmSpecification
parseJSON =
String
-> (Object -> Parser AlgorithmSpecification)
-> Value
-> Parser AlgorithmSpecification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AlgorithmSpecification"
( \Object
x ->
Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe [MetricDefinition]
-> TrainingInputMode
-> AlgorithmSpecification
AlgorithmSpecification'
(Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe [MetricDefinition]
-> TrainingInputMode
-> AlgorithmSpecification)
-> Parser (Maybe Bool)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe [MetricDefinition]
-> TrainingInputMode
-> AlgorithmSpecification)
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
"EnableSageMakerMetricsTimeSeries")
Parser
(Maybe Text
-> Maybe Text
-> Maybe [MetricDefinition]
-> TrainingInputMode
-> AlgorithmSpecification)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe [MetricDefinition]
-> TrainingInputMode
-> AlgorithmSpecification)
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
"AlgorithmName")
Parser
(Maybe Text
-> Maybe [MetricDefinition]
-> TrainingInputMode
-> AlgorithmSpecification)
-> Parser (Maybe Text)
-> Parser
(Maybe [MetricDefinition]
-> TrainingInputMode -> AlgorithmSpecification)
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
"TrainingImage")
Parser
(Maybe [MetricDefinition]
-> TrainingInputMode -> AlgorithmSpecification)
-> Parser (Maybe [MetricDefinition])
-> Parser (TrainingInputMode -> AlgorithmSpecification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [MetricDefinition]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MetricDefinitions"
Parser (Maybe (Maybe [MetricDefinition]))
-> Maybe [MetricDefinition] -> Parser (Maybe [MetricDefinition])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [MetricDefinition]
forall a. Monoid a => a
Prelude.mempty
)
Parser (TrainingInputMode -> AlgorithmSpecification)
-> Parser TrainingInputMode -> Parser AlgorithmSpecification
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser TrainingInputMode
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TrainingInputMode")
)
instance Prelude.Hashable AlgorithmSpecification
instance Prelude.NFData AlgorithmSpecification
instance Core.ToJSON AlgorithmSpecification where
toJSON :: AlgorithmSpecification -> Value
toJSON AlgorithmSpecification' {Maybe Bool
Maybe [MetricDefinition]
Maybe Text
TrainingInputMode
trainingInputMode :: TrainingInputMode
metricDefinitions :: Maybe [MetricDefinition]
trainingImage :: Maybe Text
algorithmName :: Maybe Text
enableSageMakerMetricsTimeSeries :: Maybe Bool
$sel:trainingInputMode:AlgorithmSpecification' :: AlgorithmSpecification -> TrainingInputMode
$sel:metricDefinitions:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe [MetricDefinition]
$sel:trainingImage:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe Text
$sel:algorithmName:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe Text
$sel:enableSageMakerMetricsTimeSeries:AlgorithmSpecification' :: AlgorithmSpecification -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"EnableSageMakerMetricsTimeSeries" 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
enableSageMakerMetricsTimeSeries,
(Text
"AlgorithmName" 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
algorithmName,
(Text
"TrainingImage" 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
trainingImage,
(Text
"MetricDefinitions" Text -> [MetricDefinition] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([MetricDefinition] -> Pair)
-> Maybe [MetricDefinition] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [MetricDefinition]
metricDefinitions,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"TrainingInputMode" Text -> TrainingInputMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TrainingInputMode
trainingInputMode)
]
)