{-# 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.ResourceConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.TrainingInstanceType
data ResourceConfig = ResourceConfig'
{
ResourceConfig -> Maybe Text
volumeKmsKeyId :: Prelude.Maybe Prelude.Text,
ResourceConfig -> TrainingInstanceType
instanceType :: TrainingInstanceType,
ResourceConfig -> Natural
instanceCount :: Prelude.Natural,
ResourceConfig -> Natural
volumeSizeInGB :: Prelude.Natural
}
deriving (ResourceConfig -> ResourceConfig -> Bool
(ResourceConfig -> ResourceConfig -> Bool)
-> (ResourceConfig -> ResourceConfig -> Bool) -> Eq ResourceConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceConfig -> ResourceConfig -> Bool
$c/= :: ResourceConfig -> ResourceConfig -> Bool
== :: ResourceConfig -> ResourceConfig -> Bool
$c== :: ResourceConfig -> ResourceConfig -> Bool
Prelude.Eq, ReadPrec [ResourceConfig]
ReadPrec ResourceConfig
Int -> ReadS ResourceConfig
ReadS [ResourceConfig]
(Int -> ReadS ResourceConfig)
-> ReadS [ResourceConfig]
-> ReadPrec ResourceConfig
-> ReadPrec [ResourceConfig]
-> Read ResourceConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceConfig]
$creadListPrec :: ReadPrec [ResourceConfig]
readPrec :: ReadPrec ResourceConfig
$creadPrec :: ReadPrec ResourceConfig
readList :: ReadS [ResourceConfig]
$creadList :: ReadS [ResourceConfig]
readsPrec :: Int -> ReadS ResourceConfig
$creadsPrec :: Int -> ReadS ResourceConfig
Prelude.Read, Int -> ResourceConfig -> ShowS
[ResourceConfig] -> ShowS
ResourceConfig -> String
(Int -> ResourceConfig -> ShowS)
-> (ResourceConfig -> String)
-> ([ResourceConfig] -> ShowS)
-> Show ResourceConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceConfig] -> ShowS
$cshowList :: [ResourceConfig] -> ShowS
show :: ResourceConfig -> String
$cshow :: ResourceConfig -> String
showsPrec :: Int -> ResourceConfig -> ShowS
$cshowsPrec :: Int -> ResourceConfig -> ShowS
Prelude.Show, (forall x. ResourceConfig -> Rep ResourceConfig x)
-> (forall x. Rep ResourceConfig x -> ResourceConfig)
-> Generic ResourceConfig
forall x. Rep ResourceConfig x -> ResourceConfig
forall x. ResourceConfig -> Rep ResourceConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResourceConfig x -> ResourceConfig
$cfrom :: forall x. ResourceConfig -> Rep ResourceConfig x
Prelude.Generic)
newResourceConfig ::
TrainingInstanceType ->
Prelude.Natural ->
Prelude.Natural ->
ResourceConfig
newResourceConfig :: TrainingInstanceType -> Natural -> Natural -> ResourceConfig
newResourceConfig
TrainingInstanceType
pInstanceType_
Natural
pInstanceCount_
Natural
pVolumeSizeInGB_ =
ResourceConfig' :: Maybe Text
-> TrainingInstanceType -> Natural -> Natural -> ResourceConfig
ResourceConfig'
{ $sel:volumeKmsKeyId:ResourceConfig' :: Maybe Text
volumeKmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:instanceType:ResourceConfig' :: TrainingInstanceType
instanceType = TrainingInstanceType
pInstanceType_,
$sel:instanceCount:ResourceConfig' :: Natural
instanceCount = Natural
pInstanceCount_,
$sel:volumeSizeInGB:ResourceConfig' :: Natural
volumeSizeInGB = Natural
pVolumeSizeInGB_
}
resourceConfig_volumeKmsKeyId :: Lens.Lens' ResourceConfig (Prelude.Maybe Prelude.Text)
resourceConfig_volumeKmsKeyId :: (Maybe Text -> f (Maybe Text))
-> ResourceConfig -> f ResourceConfig
resourceConfig_volumeKmsKeyId = (ResourceConfig -> Maybe Text)
-> (ResourceConfig -> Maybe Text -> ResourceConfig)
-> Lens ResourceConfig ResourceConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceConfig' {Maybe Text
volumeKmsKeyId :: Maybe Text
$sel:volumeKmsKeyId:ResourceConfig' :: ResourceConfig -> Maybe Text
volumeKmsKeyId} -> Maybe Text
volumeKmsKeyId) (\s :: ResourceConfig
s@ResourceConfig' {} Maybe Text
a -> ResourceConfig
s {$sel:volumeKmsKeyId:ResourceConfig' :: Maybe Text
volumeKmsKeyId = Maybe Text
a} :: ResourceConfig)
resourceConfig_instanceType :: Lens.Lens' ResourceConfig TrainingInstanceType
resourceConfig_instanceType :: (TrainingInstanceType -> f TrainingInstanceType)
-> ResourceConfig -> f ResourceConfig
resourceConfig_instanceType = (ResourceConfig -> TrainingInstanceType)
-> (ResourceConfig -> TrainingInstanceType -> ResourceConfig)
-> Lens
ResourceConfig
ResourceConfig
TrainingInstanceType
TrainingInstanceType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceConfig' {TrainingInstanceType
instanceType :: TrainingInstanceType
$sel:instanceType:ResourceConfig' :: ResourceConfig -> TrainingInstanceType
instanceType} -> TrainingInstanceType
instanceType) (\s :: ResourceConfig
s@ResourceConfig' {} TrainingInstanceType
a -> ResourceConfig
s {$sel:instanceType:ResourceConfig' :: TrainingInstanceType
instanceType = TrainingInstanceType
a} :: ResourceConfig)
resourceConfig_instanceCount :: Lens.Lens' ResourceConfig Prelude.Natural
resourceConfig_instanceCount :: (Natural -> f Natural) -> ResourceConfig -> f ResourceConfig
resourceConfig_instanceCount = (ResourceConfig -> Natural)
-> (ResourceConfig -> Natural -> ResourceConfig)
-> Lens ResourceConfig ResourceConfig Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceConfig' {Natural
instanceCount :: Natural
$sel:instanceCount:ResourceConfig' :: ResourceConfig -> Natural
instanceCount} -> Natural
instanceCount) (\s :: ResourceConfig
s@ResourceConfig' {} Natural
a -> ResourceConfig
s {$sel:instanceCount:ResourceConfig' :: Natural
instanceCount = Natural
a} :: ResourceConfig)
resourceConfig_volumeSizeInGB :: Lens.Lens' ResourceConfig Prelude.Natural
resourceConfig_volumeSizeInGB :: (Natural -> f Natural) -> ResourceConfig -> f ResourceConfig
resourceConfig_volumeSizeInGB = (ResourceConfig -> Natural)
-> (ResourceConfig -> Natural -> ResourceConfig)
-> Lens ResourceConfig ResourceConfig Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceConfig' {Natural
volumeSizeInGB :: Natural
$sel:volumeSizeInGB:ResourceConfig' :: ResourceConfig -> Natural
volumeSizeInGB} -> Natural
volumeSizeInGB) (\s :: ResourceConfig
s@ResourceConfig' {} Natural
a -> ResourceConfig
s {$sel:volumeSizeInGB:ResourceConfig' :: Natural
volumeSizeInGB = Natural
a} :: ResourceConfig)
instance Core.FromJSON ResourceConfig where
parseJSON :: Value -> Parser ResourceConfig
parseJSON =
String
-> (Object -> Parser ResourceConfig)
-> Value
-> Parser ResourceConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ResourceConfig"
( \Object
x ->
Maybe Text
-> TrainingInstanceType -> Natural -> Natural -> ResourceConfig
ResourceConfig'
(Maybe Text
-> TrainingInstanceType -> Natural -> Natural -> ResourceConfig)
-> Parser (Maybe Text)
-> Parser
(TrainingInstanceType -> Natural -> Natural -> ResourceConfig)
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
"VolumeKmsKeyId")
Parser
(TrainingInstanceType -> Natural -> Natural -> ResourceConfig)
-> Parser TrainingInstanceType
-> Parser (Natural -> Natural -> ResourceConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser TrainingInstanceType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"InstanceType")
Parser (Natural -> Natural -> ResourceConfig)
-> Parser Natural -> Parser (Natural -> ResourceConfig)
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
"InstanceCount")
Parser (Natural -> ResourceConfig)
-> Parser Natural -> Parser ResourceConfig
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
"VolumeSizeInGB")
)
instance Prelude.Hashable ResourceConfig
instance Prelude.NFData ResourceConfig
instance Core.ToJSON ResourceConfig where
toJSON :: ResourceConfig -> Value
toJSON ResourceConfig' {Natural
Maybe Text
TrainingInstanceType
volumeSizeInGB :: Natural
instanceCount :: Natural
instanceType :: TrainingInstanceType
volumeKmsKeyId :: Maybe Text
$sel:volumeSizeInGB:ResourceConfig' :: ResourceConfig -> Natural
$sel:instanceCount:ResourceConfig' :: ResourceConfig -> Natural
$sel:instanceType:ResourceConfig' :: ResourceConfig -> TrainingInstanceType
$sel:volumeKmsKeyId:ResourceConfig' :: ResourceConfig -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"VolumeKmsKeyId" 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
volumeKmsKeyId,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"InstanceType" Text -> TrainingInstanceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TrainingInstanceType
instanceType),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"InstanceCount" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
instanceCount),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"VolumeSizeInGB" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
volumeSizeInGB)
]
)