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