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