{-# 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.ProductionVariant where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.ProductionVariantAcceleratorType
import Amazonka.SageMaker.Types.ProductionVariantCoreDumpConfig
import Amazonka.SageMaker.Types.ProductionVariantInstanceType
data ProductionVariant = ProductionVariant'
{
ProductionVariant -> Maybe ProductionVariantAcceleratorType
acceleratorType :: Prelude.Maybe ProductionVariantAcceleratorType,
ProductionVariant -> Maybe ProductionVariantCoreDumpConfig
coreDumpConfig :: Prelude.Maybe ProductionVariantCoreDumpConfig,
ProductionVariant -> Maybe Double
initialVariantWeight :: Prelude.Maybe Prelude.Double,
ProductionVariant -> Text
variantName :: Prelude.Text,
ProductionVariant -> Text
modelName :: Prelude.Text,
ProductionVariant -> Natural
initialInstanceCount :: Prelude.Natural,
ProductionVariant -> ProductionVariantInstanceType
instanceType :: ProductionVariantInstanceType
}
deriving (ProductionVariant -> ProductionVariant -> Bool
(ProductionVariant -> ProductionVariant -> Bool)
-> (ProductionVariant -> ProductionVariant -> Bool)
-> Eq ProductionVariant
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProductionVariant -> ProductionVariant -> Bool
$c/= :: ProductionVariant -> ProductionVariant -> Bool
== :: ProductionVariant -> ProductionVariant -> Bool
$c== :: ProductionVariant -> ProductionVariant -> Bool
Prelude.Eq, ReadPrec [ProductionVariant]
ReadPrec ProductionVariant
Int -> ReadS ProductionVariant
ReadS [ProductionVariant]
(Int -> ReadS ProductionVariant)
-> ReadS [ProductionVariant]
-> ReadPrec ProductionVariant
-> ReadPrec [ProductionVariant]
-> Read ProductionVariant
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProductionVariant]
$creadListPrec :: ReadPrec [ProductionVariant]
readPrec :: ReadPrec ProductionVariant
$creadPrec :: ReadPrec ProductionVariant
readList :: ReadS [ProductionVariant]
$creadList :: ReadS [ProductionVariant]
readsPrec :: Int -> ReadS ProductionVariant
$creadsPrec :: Int -> ReadS ProductionVariant
Prelude.Read, Int -> ProductionVariant -> ShowS
[ProductionVariant] -> ShowS
ProductionVariant -> String
(Int -> ProductionVariant -> ShowS)
-> (ProductionVariant -> String)
-> ([ProductionVariant] -> ShowS)
-> Show ProductionVariant
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProductionVariant] -> ShowS
$cshowList :: [ProductionVariant] -> ShowS
show :: ProductionVariant -> String
$cshow :: ProductionVariant -> String
showsPrec :: Int -> ProductionVariant -> ShowS
$cshowsPrec :: Int -> ProductionVariant -> ShowS
Prelude.Show, (forall x. ProductionVariant -> Rep ProductionVariant x)
-> (forall x. Rep ProductionVariant x -> ProductionVariant)
-> Generic ProductionVariant
forall x. Rep ProductionVariant x -> ProductionVariant
forall x. ProductionVariant -> Rep ProductionVariant x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProductionVariant x -> ProductionVariant
$cfrom :: forall x. ProductionVariant -> Rep ProductionVariant x
Prelude.Generic)
newProductionVariant ::
Prelude.Text ->
Prelude.Text ->
Prelude.Natural ->
ProductionVariantInstanceType ->
ProductionVariant
newProductionVariant :: Text
-> Text
-> Natural
-> ProductionVariantInstanceType
-> ProductionVariant
newProductionVariant
Text
pVariantName_
Text
pModelName_
Natural
pInitialInstanceCount_
ProductionVariantInstanceType
pInstanceType_ =
ProductionVariant' :: Maybe ProductionVariantAcceleratorType
-> Maybe ProductionVariantCoreDumpConfig
-> Maybe Double
-> Text
-> Text
-> Natural
-> ProductionVariantInstanceType
-> ProductionVariant
ProductionVariant'
{ $sel:acceleratorType:ProductionVariant' :: Maybe ProductionVariantAcceleratorType
acceleratorType =
Maybe ProductionVariantAcceleratorType
forall a. Maybe a
Prelude.Nothing,
$sel:coreDumpConfig:ProductionVariant' :: Maybe ProductionVariantCoreDumpConfig
coreDumpConfig = Maybe ProductionVariantCoreDumpConfig
forall a. Maybe a
Prelude.Nothing,
$sel:initialVariantWeight:ProductionVariant' :: Maybe Double
initialVariantWeight = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:variantName:ProductionVariant' :: Text
variantName = Text
pVariantName_,
$sel:modelName:ProductionVariant' :: Text
modelName = Text
pModelName_,
$sel:initialInstanceCount:ProductionVariant' :: Natural
initialInstanceCount = Natural
pInitialInstanceCount_,
$sel:instanceType:ProductionVariant' :: ProductionVariantInstanceType
instanceType = ProductionVariantInstanceType
pInstanceType_
}
productionVariant_acceleratorType :: Lens.Lens' ProductionVariant (Prelude.Maybe ProductionVariantAcceleratorType)
productionVariant_acceleratorType :: (Maybe ProductionVariantAcceleratorType
-> f (Maybe ProductionVariantAcceleratorType))
-> ProductionVariant -> f ProductionVariant
productionVariant_acceleratorType = (ProductionVariant -> Maybe ProductionVariantAcceleratorType)
-> (ProductionVariant
-> Maybe ProductionVariantAcceleratorType -> ProductionVariant)
-> Lens
ProductionVariant
ProductionVariant
(Maybe ProductionVariantAcceleratorType)
(Maybe ProductionVariantAcceleratorType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductionVariant' {Maybe ProductionVariantAcceleratorType
acceleratorType :: Maybe ProductionVariantAcceleratorType
$sel:acceleratorType:ProductionVariant' :: ProductionVariant -> Maybe ProductionVariantAcceleratorType
acceleratorType} -> Maybe ProductionVariantAcceleratorType
acceleratorType) (\s :: ProductionVariant
s@ProductionVariant' {} Maybe ProductionVariantAcceleratorType
a -> ProductionVariant
s {$sel:acceleratorType:ProductionVariant' :: Maybe ProductionVariantAcceleratorType
acceleratorType = Maybe ProductionVariantAcceleratorType
a} :: ProductionVariant)
productionVariant_coreDumpConfig :: Lens.Lens' ProductionVariant (Prelude.Maybe ProductionVariantCoreDumpConfig)
productionVariant_coreDumpConfig :: (Maybe ProductionVariantCoreDumpConfig
-> f (Maybe ProductionVariantCoreDumpConfig))
-> ProductionVariant -> f ProductionVariant
productionVariant_coreDumpConfig = (ProductionVariant -> Maybe ProductionVariantCoreDumpConfig)
-> (ProductionVariant
-> Maybe ProductionVariantCoreDumpConfig -> ProductionVariant)
-> Lens
ProductionVariant
ProductionVariant
(Maybe ProductionVariantCoreDumpConfig)
(Maybe ProductionVariantCoreDumpConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductionVariant' {Maybe ProductionVariantCoreDumpConfig
coreDumpConfig :: Maybe ProductionVariantCoreDumpConfig
$sel:coreDumpConfig:ProductionVariant' :: ProductionVariant -> Maybe ProductionVariantCoreDumpConfig
coreDumpConfig} -> Maybe ProductionVariantCoreDumpConfig
coreDumpConfig) (\s :: ProductionVariant
s@ProductionVariant' {} Maybe ProductionVariantCoreDumpConfig
a -> ProductionVariant
s {$sel:coreDumpConfig:ProductionVariant' :: Maybe ProductionVariantCoreDumpConfig
coreDumpConfig = Maybe ProductionVariantCoreDumpConfig
a} :: ProductionVariant)
productionVariant_initialVariantWeight :: Lens.Lens' ProductionVariant (Prelude.Maybe Prelude.Double)
productionVariant_initialVariantWeight :: (Maybe Double -> f (Maybe Double))
-> ProductionVariant -> f ProductionVariant
productionVariant_initialVariantWeight = (ProductionVariant -> Maybe Double)
-> (ProductionVariant -> Maybe Double -> ProductionVariant)
-> Lens
ProductionVariant ProductionVariant (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductionVariant' {Maybe Double
initialVariantWeight :: Maybe Double
$sel:initialVariantWeight:ProductionVariant' :: ProductionVariant -> Maybe Double
initialVariantWeight} -> Maybe Double
initialVariantWeight) (\s :: ProductionVariant
s@ProductionVariant' {} Maybe Double
a -> ProductionVariant
s {$sel:initialVariantWeight:ProductionVariant' :: Maybe Double
initialVariantWeight = Maybe Double
a} :: ProductionVariant)
productionVariant_variantName :: Lens.Lens' ProductionVariant Prelude.Text
productionVariant_variantName :: (Text -> f Text) -> ProductionVariant -> f ProductionVariant
productionVariant_variantName = (ProductionVariant -> Text)
-> (ProductionVariant -> Text -> ProductionVariant)
-> Lens ProductionVariant ProductionVariant Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductionVariant' {Text
variantName :: Text
$sel:variantName:ProductionVariant' :: ProductionVariant -> Text
variantName} -> Text
variantName) (\s :: ProductionVariant
s@ProductionVariant' {} Text
a -> ProductionVariant
s {$sel:variantName:ProductionVariant' :: Text
variantName = Text
a} :: ProductionVariant)
productionVariant_modelName :: Lens.Lens' ProductionVariant Prelude.Text
productionVariant_modelName :: (Text -> f Text) -> ProductionVariant -> f ProductionVariant
productionVariant_modelName = (ProductionVariant -> Text)
-> (ProductionVariant -> Text -> ProductionVariant)
-> Lens ProductionVariant ProductionVariant Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductionVariant' {Text
modelName :: Text
$sel:modelName:ProductionVariant' :: ProductionVariant -> Text
modelName} -> Text
modelName) (\s :: ProductionVariant
s@ProductionVariant' {} Text
a -> ProductionVariant
s {$sel:modelName:ProductionVariant' :: Text
modelName = Text
a} :: ProductionVariant)
productionVariant_initialInstanceCount :: Lens.Lens' ProductionVariant Prelude.Natural
productionVariant_initialInstanceCount :: (Natural -> f Natural) -> ProductionVariant -> f ProductionVariant
productionVariant_initialInstanceCount = (ProductionVariant -> Natural)
-> (ProductionVariant -> Natural -> ProductionVariant)
-> Lens ProductionVariant ProductionVariant Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductionVariant' {Natural
initialInstanceCount :: Natural
$sel:initialInstanceCount:ProductionVariant' :: ProductionVariant -> Natural
initialInstanceCount} -> Natural
initialInstanceCount) (\s :: ProductionVariant
s@ProductionVariant' {} Natural
a -> ProductionVariant
s {$sel:initialInstanceCount:ProductionVariant' :: Natural
initialInstanceCount = Natural
a} :: ProductionVariant)
productionVariant_instanceType :: Lens.Lens' ProductionVariant ProductionVariantInstanceType
productionVariant_instanceType :: (ProductionVariantInstanceType -> f ProductionVariantInstanceType)
-> ProductionVariant -> f ProductionVariant
productionVariant_instanceType = (ProductionVariant -> ProductionVariantInstanceType)
-> (ProductionVariant
-> ProductionVariantInstanceType -> ProductionVariant)
-> Lens
ProductionVariant
ProductionVariant
ProductionVariantInstanceType
ProductionVariantInstanceType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductionVariant' {ProductionVariantInstanceType
instanceType :: ProductionVariantInstanceType
$sel:instanceType:ProductionVariant' :: ProductionVariant -> ProductionVariantInstanceType
instanceType} -> ProductionVariantInstanceType
instanceType) (\s :: ProductionVariant
s@ProductionVariant' {} ProductionVariantInstanceType
a -> ProductionVariant
s {$sel:instanceType:ProductionVariant' :: ProductionVariantInstanceType
instanceType = ProductionVariantInstanceType
a} :: ProductionVariant)
instance Core.FromJSON ProductionVariant where
parseJSON :: Value -> Parser ProductionVariant
parseJSON =
String
-> (Object -> Parser ProductionVariant)
-> Value
-> Parser ProductionVariant
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ProductionVariant"
( \Object
x ->
Maybe ProductionVariantAcceleratorType
-> Maybe ProductionVariantCoreDumpConfig
-> Maybe Double
-> Text
-> Text
-> Natural
-> ProductionVariantInstanceType
-> ProductionVariant
ProductionVariant'
(Maybe ProductionVariantAcceleratorType
-> Maybe ProductionVariantCoreDumpConfig
-> Maybe Double
-> Text
-> Text
-> Natural
-> ProductionVariantInstanceType
-> ProductionVariant)
-> Parser (Maybe ProductionVariantAcceleratorType)
-> Parser
(Maybe ProductionVariantCoreDumpConfig
-> Maybe Double
-> Text
-> Text
-> Natural
-> ProductionVariantInstanceType
-> ProductionVariant)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ProductionVariantAcceleratorType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AcceleratorType")
Parser
(Maybe ProductionVariantCoreDumpConfig
-> Maybe Double
-> Text
-> Text
-> Natural
-> ProductionVariantInstanceType
-> ProductionVariant)
-> Parser (Maybe ProductionVariantCoreDumpConfig)
-> Parser
(Maybe Double
-> Text
-> Text
-> Natural
-> ProductionVariantInstanceType
-> ProductionVariant)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ProductionVariantCoreDumpConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CoreDumpConfig")
Parser
(Maybe Double
-> Text
-> Text
-> Natural
-> ProductionVariantInstanceType
-> ProductionVariant)
-> Parser (Maybe Double)
-> Parser
(Text
-> Text
-> Natural
-> ProductionVariantInstanceType
-> ProductionVariant)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InitialVariantWeight")
Parser
(Text
-> Text
-> Natural
-> ProductionVariantInstanceType
-> ProductionVariant)
-> Parser Text
-> Parser
(Text
-> Natural -> ProductionVariantInstanceType -> ProductionVariant)
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
"VariantName")
Parser
(Text
-> Natural -> ProductionVariantInstanceType -> ProductionVariant)
-> Parser Text
-> Parser
(Natural -> ProductionVariantInstanceType -> ProductionVariant)
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
"ModelName")
Parser
(Natural -> ProductionVariantInstanceType -> ProductionVariant)
-> Parser Natural
-> Parser (ProductionVariantInstanceType -> ProductionVariant)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"InitialInstanceCount")
Parser (ProductionVariantInstanceType -> ProductionVariant)
-> Parser ProductionVariantInstanceType -> Parser ProductionVariant
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ProductionVariantInstanceType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"InstanceType")
)
instance Prelude.Hashable ProductionVariant
instance Prelude.NFData ProductionVariant
instance Core.ToJSON ProductionVariant where
toJSON :: ProductionVariant -> Value
toJSON ProductionVariant' {Natural
Maybe Double
Maybe ProductionVariantAcceleratorType
Maybe ProductionVariantCoreDumpConfig
Text
ProductionVariantInstanceType
instanceType :: ProductionVariantInstanceType
initialInstanceCount :: Natural
modelName :: Text
variantName :: Text
initialVariantWeight :: Maybe Double
coreDumpConfig :: Maybe ProductionVariantCoreDumpConfig
acceleratorType :: Maybe ProductionVariantAcceleratorType
$sel:instanceType:ProductionVariant' :: ProductionVariant -> ProductionVariantInstanceType
$sel:initialInstanceCount:ProductionVariant' :: ProductionVariant -> Natural
$sel:modelName:ProductionVariant' :: ProductionVariant -> Text
$sel:variantName:ProductionVariant' :: ProductionVariant -> Text
$sel:initialVariantWeight:ProductionVariant' :: ProductionVariant -> Maybe Double
$sel:coreDumpConfig:ProductionVariant' :: ProductionVariant -> Maybe ProductionVariantCoreDumpConfig
$sel:acceleratorType:ProductionVariant' :: ProductionVariant -> Maybe ProductionVariantAcceleratorType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"AcceleratorType" Text -> ProductionVariantAcceleratorType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(ProductionVariantAcceleratorType -> Pair)
-> Maybe ProductionVariantAcceleratorType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ProductionVariantAcceleratorType
acceleratorType,
(Text
"CoreDumpConfig" Text -> ProductionVariantCoreDumpConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(ProductionVariantCoreDumpConfig -> Pair)
-> Maybe ProductionVariantCoreDumpConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ProductionVariantCoreDumpConfig
coreDumpConfig,
(Text
"InitialVariantWeight" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
initialVariantWeight,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"VariantName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
variantName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ModelName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
modelName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"InitialInstanceCount"
Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
initialInstanceCount
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"InstanceType" Text -> ProductionVariantInstanceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ProductionVariantInstanceType
instanceType)
]
)