{-# 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.ProfilerConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ProfilerConfig = ProfilerConfig'
{
ProfilerConfig -> Maybe (HashMap Text Text)
profilingParameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
ProfilerConfig -> Maybe Integer
profilingIntervalInMilliseconds :: Prelude.Maybe Prelude.Integer,
ProfilerConfig -> Text
s3OutputPath :: Prelude.Text
}
deriving (ProfilerConfig -> ProfilerConfig -> Bool
(ProfilerConfig -> ProfilerConfig -> Bool)
-> (ProfilerConfig -> ProfilerConfig -> Bool) -> Eq ProfilerConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProfilerConfig -> ProfilerConfig -> Bool
$c/= :: ProfilerConfig -> ProfilerConfig -> Bool
== :: ProfilerConfig -> ProfilerConfig -> Bool
$c== :: ProfilerConfig -> ProfilerConfig -> Bool
Prelude.Eq, ReadPrec [ProfilerConfig]
ReadPrec ProfilerConfig
Int -> ReadS ProfilerConfig
ReadS [ProfilerConfig]
(Int -> ReadS ProfilerConfig)
-> ReadS [ProfilerConfig]
-> ReadPrec ProfilerConfig
-> ReadPrec [ProfilerConfig]
-> Read ProfilerConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProfilerConfig]
$creadListPrec :: ReadPrec [ProfilerConfig]
readPrec :: ReadPrec ProfilerConfig
$creadPrec :: ReadPrec ProfilerConfig
readList :: ReadS [ProfilerConfig]
$creadList :: ReadS [ProfilerConfig]
readsPrec :: Int -> ReadS ProfilerConfig
$creadsPrec :: Int -> ReadS ProfilerConfig
Prelude.Read, Int -> ProfilerConfig -> ShowS
[ProfilerConfig] -> ShowS
ProfilerConfig -> String
(Int -> ProfilerConfig -> ShowS)
-> (ProfilerConfig -> String)
-> ([ProfilerConfig] -> ShowS)
-> Show ProfilerConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProfilerConfig] -> ShowS
$cshowList :: [ProfilerConfig] -> ShowS
show :: ProfilerConfig -> String
$cshow :: ProfilerConfig -> String
showsPrec :: Int -> ProfilerConfig -> ShowS
$cshowsPrec :: Int -> ProfilerConfig -> ShowS
Prelude.Show, (forall x. ProfilerConfig -> Rep ProfilerConfig x)
-> (forall x. Rep ProfilerConfig x -> ProfilerConfig)
-> Generic ProfilerConfig
forall x. Rep ProfilerConfig x -> ProfilerConfig
forall x. ProfilerConfig -> Rep ProfilerConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProfilerConfig x -> ProfilerConfig
$cfrom :: forall x. ProfilerConfig -> Rep ProfilerConfig x
Prelude.Generic)
newProfilerConfig ::
Prelude.Text ->
ProfilerConfig
newProfilerConfig :: Text -> ProfilerConfig
newProfilerConfig Text
pS3OutputPath_ =
ProfilerConfig' :: Maybe (HashMap Text Text)
-> Maybe Integer -> Text -> ProfilerConfig
ProfilerConfig'
{ $sel:profilingParameters:ProfilerConfig' :: Maybe (HashMap Text Text)
profilingParameters =
Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:profilingIntervalInMilliseconds:ProfilerConfig' :: Maybe Integer
profilingIntervalInMilliseconds = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:s3OutputPath:ProfilerConfig' :: Text
s3OutputPath = Text
pS3OutputPath_
}
profilerConfig_profilingParameters :: Lens.Lens' ProfilerConfig (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
profilerConfig_profilingParameters :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ProfilerConfig -> f ProfilerConfig
profilerConfig_profilingParameters = (ProfilerConfig -> Maybe (HashMap Text Text))
-> (ProfilerConfig -> Maybe (HashMap Text Text) -> ProfilerConfig)
-> Lens
ProfilerConfig
ProfilerConfig
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProfilerConfig' {Maybe (HashMap Text Text)
profilingParameters :: Maybe (HashMap Text Text)
$sel:profilingParameters:ProfilerConfig' :: ProfilerConfig -> Maybe (HashMap Text Text)
profilingParameters} -> Maybe (HashMap Text Text)
profilingParameters) (\s :: ProfilerConfig
s@ProfilerConfig' {} Maybe (HashMap Text Text)
a -> ProfilerConfig
s {$sel:profilingParameters:ProfilerConfig' :: Maybe (HashMap Text Text)
profilingParameters = Maybe (HashMap Text Text)
a} :: ProfilerConfig) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ProfilerConfig -> f ProfilerConfig)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ProfilerConfig
-> f ProfilerConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
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 AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
profilerConfig_profilingIntervalInMilliseconds :: Lens.Lens' ProfilerConfig (Prelude.Maybe Prelude.Integer)
profilerConfig_profilingIntervalInMilliseconds :: (Maybe Integer -> f (Maybe Integer))
-> ProfilerConfig -> f ProfilerConfig
profilerConfig_profilingIntervalInMilliseconds = (ProfilerConfig -> Maybe Integer)
-> (ProfilerConfig -> Maybe Integer -> ProfilerConfig)
-> Lens
ProfilerConfig ProfilerConfig (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProfilerConfig' {Maybe Integer
profilingIntervalInMilliseconds :: Maybe Integer
$sel:profilingIntervalInMilliseconds:ProfilerConfig' :: ProfilerConfig -> Maybe Integer
profilingIntervalInMilliseconds} -> Maybe Integer
profilingIntervalInMilliseconds) (\s :: ProfilerConfig
s@ProfilerConfig' {} Maybe Integer
a -> ProfilerConfig
s {$sel:profilingIntervalInMilliseconds:ProfilerConfig' :: Maybe Integer
profilingIntervalInMilliseconds = Maybe Integer
a} :: ProfilerConfig)
profilerConfig_s3OutputPath :: Lens.Lens' ProfilerConfig Prelude.Text
profilerConfig_s3OutputPath :: (Text -> f Text) -> ProfilerConfig -> f ProfilerConfig
profilerConfig_s3OutputPath = (ProfilerConfig -> Text)
-> (ProfilerConfig -> Text -> ProfilerConfig)
-> Lens ProfilerConfig ProfilerConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProfilerConfig' {Text
s3OutputPath :: Text
$sel:s3OutputPath:ProfilerConfig' :: ProfilerConfig -> Text
s3OutputPath} -> Text
s3OutputPath) (\s :: ProfilerConfig
s@ProfilerConfig' {} Text
a -> ProfilerConfig
s {$sel:s3OutputPath:ProfilerConfig' :: Text
s3OutputPath = Text
a} :: ProfilerConfig)
instance Core.FromJSON ProfilerConfig where
parseJSON :: Value -> Parser ProfilerConfig
parseJSON =
String
-> (Object -> Parser ProfilerConfig)
-> Value
-> Parser ProfilerConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ProfilerConfig"
( \Object
x ->
Maybe (HashMap Text Text)
-> Maybe Integer -> Text -> ProfilerConfig
ProfilerConfig'
(Maybe (HashMap Text Text)
-> Maybe Integer -> Text -> ProfilerConfig)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Maybe Integer -> Text -> ProfilerConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProfilingParameters"
Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty
)
Parser (Maybe Integer -> Text -> ProfilerConfig)
-> Parser (Maybe Integer) -> Parser (Text -> ProfilerConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProfilingIntervalInMilliseconds")
Parser (Text -> ProfilerConfig)
-> Parser Text -> Parser ProfilerConfig
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
"S3OutputPath")
)
instance Prelude.Hashable ProfilerConfig
instance Prelude.NFData ProfilerConfig
instance Core.ToJSON ProfilerConfig where
toJSON :: ProfilerConfig -> Value
toJSON ProfilerConfig' {Maybe Integer
Maybe (HashMap Text Text)
Text
s3OutputPath :: Text
profilingIntervalInMilliseconds :: Maybe Integer
profilingParameters :: Maybe (HashMap Text Text)
$sel:s3OutputPath:ProfilerConfig' :: ProfilerConfig -> Text
$sel:profilingIntervalInMilliseconds:ProfilerConfig' :: ProfilerConfig -> Maybe Integer
$sel:profilingParameters:ProfilerConfig' :: ProfilerConfig -> Maybe (HashMap Text Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ProfilingParameters" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
profilingParameters,
(Text
"ProfilingIntervalInMilliseconds" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
profilingIntervalInMilliseconds,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"S3OutputPath" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
s3OutputPath)
]
)