{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.InstanceGroup
import Amazonka.SageMaker.Types.TrainingInstanceType
data ResourceConfig = ResourceConfig'
{
ResourceConfig -> Maybe Natural
instanceCount :: Prelude.Maybe Prelude.Natural,
ResourceConfig -> Maybe [InstanceGroup]
instanceGroups :: Prelude.Maybe [InstanceGroup],
ResourceConfig -> Maybe TrainingInstanceType
instanceType :: Prelude.Maybe TrainingInstanceType,
ResourceConfig -> Maybe Natural
keepAlivePeriodInSeconds :: Prelude.Maybe Prelude.Natural,
ResourceConfig -> Maybe Text
volumeKmsKeyId :: Prelude.Maybe Prelude.Text,
ResourceConfig -> Natural
volumeSizeInGB :: Prelude.Natural
}
deriving (ResourceConfig -> ResourceConfig -> Bool
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]
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
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. 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 ::
Prelude.Natural ->
ResourceConfig
newResourceConfig :: Natural -> ResourceConfig
newResourceConfig Natural
pVolumeSizeInGB_ =
ResourceConfig'
{ $sel:instanceCount:ResourceConfig' :: Maybe Natural
instanceCount = forall a. Maybe a
Prelude.Nothing,
$sel:instanceGroups:ResourceConfig' :: Maybe [InstanceGroup]
instanceGroups = forall a. Maybe a
Prelude.Nothing,
$sel:instanceType:ResourceConfig' :: Maybe TrainingInstanceType
instanceType = forall a. Maybe a
Prelude.Nothing,
$sel:keepAlivePeriodInSeconds:ResourceConfig' :: Maybe Natural
keepAlivePeriodInSeconds = forall a. Maybe a
Prelude.Nothing,
$sel:volumeKmsKeyId:ResourceConfig' :: Maybe Text
volumeKmsKeyId = forall a. Maybe a
Prelude.Nothing,
$sel:volumeSizeInGB:ResourceConfig' :: Natural
volumeSizeInGB = Natural
pVolumeSizeInGB_
}
resourceConfig_instanceCount :: Lens.Lens' ResourceConfig (Prelude.Maybe Prelude.Natural)
resourceConfig_instanceCount :: Lens' ResourceConfig (Maybe Natural)
resourceConfig_instanceCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceConfig' {Maybe Natural
instanceCount :: Maybe Natural
$sel:instanceCount:ResourceConfig' :: ResourceConfig -> Maybe Natural
instanceCount} -> Maybe Natural
instanceCount) (\s :: ResourceConfig
s@ResourceConfig' {} Maybe Natural
a -> ResourceConfig
s {$sel:instanceCount:ResourceConfig' :: Maybe Natural
instanceCount = Maybe Natural
a} :: ResourceConfig)
resourceConfig_instanceGroups :: Lens.Lens' ResourceConfig (Prelude.Maybe [InstanceGroup])
resourceConfig_instanceGroups :: Lens' ResourceConfig (Maybe [InstanceGroup])
resourceConfig_instanceGroups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceConfig' {Maybe [InstanceGroup]
instanceGroups :: Maybe [InstanceGroup]
$sel:instanceGroups:ResourceConfig' :: ResourceConfig -> Maybe [InstanceGroup]
instanceGroups} -> Maybe [InstanceGroup]
instanceGroups) (\s :: ResourceConfig
s@ResourceConfig' {} Maybe [InstanceGroup]
a -> ResourceConfig
s {$sel:instanceGroups:ResourceConfig' :: Maybe [InstanceGroup]
instanceGroups = Maybe [InstanceGroup]
a} :: ResourceConfig) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
resourceConfig_instanceType :: Lens.Lens' ResourceConfig (Prelude.Maybe TrainingInstanceType)
resourceConfig_instanceType :: Lens' ResourceConfig (Maybe TrainingInstanceType)
resourceConfig_instanceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceConfig' {Maybe TrainingInstanceType
instanceType :: Maybe TrainingInstanceType
$sel:instanceType:ResourceConfig' :: ResourceConfig -> Maybe TrainingInstanceType
instanceType} -> Maybe TrainingInstanceType
instanceType) (\s :: ResourceConfig
s@ResourceConfig' {} Maybe TrainingInstanceType
a -> ResourceConfig
s {$sel:instanceType:ResourceConfig' :: Maybe TrainingInstanceType
instanceType = Maybe TrainingInstanceType
a} :: ResourceConfig)
resourceConfig_keepAlivePeriodInSeconds :: Lens.Lens' ResourceConfig (Prelude.Maybe Prelude.Natural)
resourceConfig_keepAlivePeriodInSeconds :: Lens' ResourceConfig (Maybe Natural)
resourceConfig_keepAlivePeriodInSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceConfig' {Maybe Natural
keepAlivePeriodInSeconds :: Maybe Natural
$sel:keepAlivePeriodInSeconds:ResourceConfig' :: ResourceConfig -> Maybe Natural
keepAlivePeriodInSeconds} -> Maybe Natural
keepAlivePeriodInSeconds) (\s :: ResourceConfig
s@ResourceConfig' {} Maybe Natural
a -> ResourceConfig
s {$sel:keepAlivePeriodInSeconds:ResourceConfig' :: Maybe Natural
keepAlivePeriodInSeconds = Maybe Natural
a} :: ResourceConfig)
resourceConfig_volumeKmsKeyId :: Lens.Lens' ResourceConfig (Prelude.Maybe Prelude.Text)
resourceConfig_volumeKmsKeyId :: Lens' ResourceConfig (Maybe Text)
resourceConfig_volumeKmsKeyId = 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_volumeSizeInGB :: Lens.Lens' ResourceConfig Prelude.Natural
resourceConfig_volumeSizeInGB :: Lens' ResourceConfig Natural
resourceConfig_volumeSizeInGB = 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 Data.FromJSON ResourceConfig where
parseJSON :: Value -> Parser ResourceConfig
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ResourceConfig"
( \Object
x ->
Maybe Natural
-> Maybe [InstanceGroup]
-> Maybe TrainingInstanceType
-> Maybe Natural
-> Maybe Text
-> Natural
-> ResourceConfig
ResourceConfig'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"InstanceCount")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"InstanceGroups" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"InstanceType")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"KeepAlivePeriodInSeconds")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"VolumeKmsKeyId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"VolumeSizeInGB")
)
instance Prelude.Hashable ResourceConfig where
hashWithSalt :: Int -> ResourceConfig -> Int
hashWithSalt Int
_salt ResourceConfig' {Natural
Maybe Natural
Maybe [InstanceGroup]
Maybe Text
Maybe TrainingInstanceType
volumeSizeInGB :: Natural
volumeKmsKeyId :: Maybe Text
keepAlivePeriodInSeconds :: Maybe Natural
instanceType :: Maybe TrainingInstanceType
instanceGroups :: Maybe [InstanceGroup]
instanceCount :: Maybe Natural
$sel:volumeSizeInGB:ResourceConfig' :: ResourceConfig -> Natural
$sel:volumeKmsKeyId:ResourceConfig' :: ResourceConfig -> Maybe Text
$sel:keepAlivePeriodInSeconds:ResourceConfig' :: ResourceConfig -> Maybe Natural
$sel:instanceType:ResourceConfig' :: ResourceConfig -> Maybe TrainingInstanceType
$sel:instanceGroups:ResourceConfig' :: ResourceConfig -> Maybe [InstanceGroup]
$sel:instanceCount:ResourceConfig' :: ResourceConfig -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
instanceCount
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [InstanceGroup]
instanceGroups
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TrainingInstanceType
instanceType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
keepAlivePeriodInSeconds
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
volumeKmsKeyId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
volumeSizeInGB
instance Prelude.NFData ResourceConfig where
rnf :: ResourceConfig -> ()
rnf ResourceConfig' {Natural
Maybe Natural
Maybe [InstanceGroup]
Maybe Text
Maybe TrainingInstanceType
volumeSizeInGB :: Natural
volumeKmsKeyId :: Maybe Text
keepAlivePeriodInSeconds :: Maybe Natural
instanceType :: Maybe TrainingInstanceType
instanceGroups :: Maybe [InstanceGroup]
instanceCount :: Maybe Natural
$sel:volumeSizeInGB:ResourceConfig' :: ResourceConfig -> Natural
$sel:volumeKmsKeyId:ResourceConfig' :: ResourceConfig -> Maybe Text
$sel:keepAlivePeriodInSeconds:ResourceConfig' :: ResourceConfig -> Maybe Natural
$sel:instanceType:ResourceConfig' :: ResourceConfig -> Maybe TrainingInstanceType
$sel:instanceGroups:ResourceConfig' :: ResourceConfig -> Maybe [InstanceGroup]
$sel:instanceCount:ResourceConfig' :: ResourceConfig -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
instanceCount
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [InstanceGroup]
instanceGroups
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TrainingInstanceType
instanceType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
keepAlivePeriodInSeconds
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
volumeKmsKeyId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
volumeSizeInGB
instance Data.ToJSON ResourceConfig where
toJSON :: ResourceConfig -> Value
toJSON ResourceConfig' {Natural
Maybe Natural
Maybe [InstanceGroup]
Maybe Text
Maybe TrainingInstanceType
volumeSizeInGB :: Natural
volumeKmsKeyId :: Maybe Text
keepAlivePeriodInSeconds :: Maybe Natural
instanceType :: Maybe TrainingInstanceType
instanceGroups :: Maybe [InstanceGroup]
instanceCount :: Maybe Natural
$sel:volumeSizeInGB:ResourceConfig' :: ResourceConfig -> Natural
$sel:volumeKmsKeyId:ResourceConfig' :: ResourceConfig -> Maybe Text
$sel:keepAlivePeriodInSeconds:ResourceConfig' :: ResourceConfig -> Maybe Natural
$sel:instanceType:ResourceConfig' :: ResourceConfig -> Maybe TrainingInstanceType
$sel:instanceGroups:ResourceConfig' :: ResourceConfig -> Maybe [InstanceGroup]
$sel:instanceCount:ResourceConfig' :: ResourceConfig -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"InstanceCount" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
instanceCount,
(Key
"InstanceGroups" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [InstanceGroup]
instanceGroups,
(Key
"InstanceType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TrainingInstanceType
instanceType,
(Key
"KeepAlivePeriodInSeconds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
keepAlivePeriodInSeconds,
(Key
"VolumeKmsKeyId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
volumeKmsKeyId,
forall a. a -> Maybe a
Prelude.Just
(Key
"VolumeSizeInGB" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
volumeSizeInGB)
]
)