{-# 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.MonitoringOutputConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.MonitoringOutput
data MonitoringOutputConfig = MonitoringOutputConfig'
{
MonitoringOutputConfig -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
MonitoringOutputConfig -> NonEmpty MonitoringOutput
monitoringOutputs :: Prelude.NonEmpty MonitoringOutput
}
deriving (MonitoringOutputConfig -> MonitoringOutputConfig -> Bool
(MonitoringOutputConfig -> MonitoringOutputConfig -> Bool)
-> (MonitoringOutputConfig -> MonitoringOutputConfig -> Bool)
-> Eq MonitoringOutputConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MonitoringOutputConfig -> MonitoringOutputConfig -> Bool
$c/= :: MonitoringOutputConfig -> MonitoringOutputConfig -> Bool
== :: MonitoringOutputConfig -> MonitoringOutputConfig -> Bool
$c== :: MonitoringOutputConfig -> MonitoringOutputConfig -> Bool
Prelude.Eq, ReadPrec [MonitoringOutputConfig]
ReadPrec MonitoringOutputConfig
Int -> ReadS MonitoringOutputConfig
ReadS [MonitoringOutputConfig]
(Int -> ReadS MonitoringOutputConfig)
-> ReadS [MonitoringOutputConfig]
-> ReadPrec MonitoringOutputConfig
-> ReadPrec [MonitoringOutputConfig]
-> Read MonitoringOutputConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MonitoringOutputConfig]
$creadListPrec :: ReadPrec [MonitoringOutputConfig]
readPrec :: ReadPrec MonitoringOutputConfig
$creadPrec :: ReadPrec MonitoringOutputConfig
readList :: ReadS [MonitoringOutputConfig]
$creadList :: ReadS [MonitoringOutputConfig]
readsPrec :: Int -> ReadS MonitoringOutputConfig
$creadsPrec :: Int -> ReadS MonitoringOutputConfig
Prelude.Read, Int -> MonitoringOutputConfig -> ShowS
[MonitoringOutputConfig] -> ShowS
MonitoringOutputConfig -> String
(Int -> MonitoringOutputConfig -> ShowS)
-> (MonitoringOutputConfig -> String)
-> ([MonitoringOutputConfig] -> ShowS)
-> Show MonitoringOutputConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MonitoringOutputConfig] -> ShowS
$cshowList :: [MonitoringOutputConfig] -> ShowS
show :: MonitoringOutputConfig -> String
$cshow :: MonitoringOutputConfig -> String
showsPrec :: Int -> MonitoringOutputConfig -> ShowS
$cshowsPrec :: Int -> MonitoringOutputConfig -> ShowS
Prelude.Show, (forall x. MonitoringOutputConfig -> Rep MonitoringOutputConfig x)
-> (forall x.
Rep MonitoringOutputConfig x -> MonitoringOutputConfig)
-> Generic MonitoringOutputConfig
forall x. Rep MonitoringOutputConfig x -> MonitoringOutputConfig
forall x. MonitoringOutputConfig -> Rep MonitoringOutputConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MonitoringOutputConfig x -> MonitoringOutputConfig
$cfrom :: forall x. MonitoringOutputConfig -> Rep MonitoringOutputConfig x
Prelude.Generic)
newMonitoringOutputConfig ::
Prelude.NonEmpty MonitoringOutput ->
MonitoringOutputConfig
newMonitoringOutputConfig :: NonEmpty MonitoringOutput -> MonitoringOutputConfig
newMonitoringOutputConfig NonEmpty MonitoringOutput
pMonitoringOutputs_ =
MonitoringOutputConfig' :: Maybe Text -> NonEmpty MonitoringOutput -> MonitoringOutputConfig
MonitoringOutputConfig'
{ $sel:kmsKeyId:MonitoringOutputConfig' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:monitoringOutputs:MonitoringOutputConfig' :: NonEmpty MonitoringOutput
monitoringOutputs =
Tagged
(NonEmpty MonitoringOutput) (Identity (NonEmpty MonitoringOutput))
-> Tagged
(NonEmpty MonitoringOutput) (Identity (NonEmpty MonitoringOutput))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
(NonEmpty MonitoringOutput) (Identity (NonEmpty MonitoringOutput))
-> Tagged
(NonEmpty MonitoringOutput) (Identity (NonEmpty MonitoringOutput)))
-> NonEmpty MonitoringOutput -> NonEmpty MonitoringOutput
forall t b. AReview t b -> b -> t
Lens.# NonEmpty MonitoringOutput
pMonitoringOutputs_
}
monitoringOutputConfig_kmsKeyId :: Lens.Lens' MonitoringOutputConfig (Prelude.Maybe Prelude.Text)
monitoringOutputConfig_kmsKeyId :: (Maybe Text -> f (Maybe Text))
-> MonitoringOutputConfig -> f MonitoringOutputConfig
monitoringOutputConfig_kmsKeyId = (MonitoringOutputConfig -> Maybe Text)
-> (MonitoringOutputConfig -> Maybe Text -> MonitoringOutputConfig)
-> Lens
MonitoringOutputConfig
MonitoringOutputConfig
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringOutputConfig' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:MonitoringOutputConfig' :: MonitoringOutputConfig -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: MonitoringOutputConfig
s@MonitoringOutputConfig' {} Maybe Text
a -> MonitoringOutputConfig
s {$sel:kmsKeyId:MonitoringOutputConfig' :: Maybe Text
kmsKeyId = Maybe Text
a} :: MonitoringOutputConfig)
monitoringOutputConfig_monitoringOutputs :: Lens.Lens' MonitoringOutputConfig (Prelude.NonEmpty MonitoringOutput)
monitoringOutputConfig_monitoringOutputs :: (NonEmpty MonitoringOutput -> f (NonEmpty MonitoringOutput))
-> MonitoringOutputConfig -> f MonitoringOutputConfig
monitoringOutputConfig_monitoringOutputs = (MonitoringOutputConfig -> NonEmpty MonitoringOutput)
-> (MonitoringOutputConfig
-> NonEmpty MonitoringOutput -> MonitoringOutputConfig)
-> Lens
MonitoringOutputConfig
MonitoringOutputConfig
(NonEmpty MonitoringOutput)
(NonEmpty MonitoringOutput)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringOutputConfig' {NonEmpty MonitoringOutput
monitoringOutputs :: NonEmpty MonitoringOutput
$sel:monitoringOutputs:MonitoringOutputConfig' :: MonitoringOutputConfig -> NonEmpty MonitoringOutput
monitoringOutputs} -> NonEmpty MonitoringOutput
monitoringOutputs) (\s :: MonitoringOutputConfig
s@MonitoringOutputConfig' {} NonEmpty MonitoringOutput
a -> MonitoringOutputConfig
s {$sel:monitoringOutputs:MonitoringOutputConfig' :: NonEmpty MonitoringOutput
monitoringOutputs = NonEmpty MonitoringOutput
a} :: MonitoringOutputConfig) ((NonEmpty MonitoringOutput -> f (NonEmpty MonitoringOutput))
-> MonitoringOutputConfig -> f MonitoringOutputConfig)
-> ((NonEmpty MonitoringOutput -> f (NonEmpty MonitoringOutput))
-> NonEmpty MonitoringOutput -> f (NonEmpty MonitoringOutput))
-> (NonEmpty MonitoringOutput -> f (NonEmpty MonitoringOutput))
-> MonitoringOutputConfig
-> f MonitoringOutputConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty MonitoringOutput -> f (NonEmpty MonitoringOutput))
-> NonEmpty MonitoringOutput -> f (NonEmpty MonitoringOutput)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON MonitoringOutputConfig where
parseJSON :: Value -> Parser MonitoringOutputConfig
parseJSON =
String
-> (Object -> Parser MonitoringOutputConfig)
-> Value
-> Parser MonitoringOutputConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"MonitoringOutputConfig"
( \Object
x ->
Maybe Text -> NonEmpty MonitoringOutput -> MonitoringOutputConfig
MonitoringOutputConfig'
(Maybe Text -> NonEmpty MonitoringOutput -> MonitoringOutputConfig)
-> Parser (Maybe Text)
-> Parser (NonEmpty MonitoringOutput -> MonitoringOutputConfig)
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
"KmsKeyId")
Parser (NonEmpty MonitoringOutput -> MonitoringOutputConfig)
-> Parser (NonEmpty MonitoringOutput)
-> Parser MonitoringOutputConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty MonitoringOutput)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"MonitoringOutputs")
)
instance Prelude.Hashable MonitoringOutputConfig
instance Prelude.NFData MonitoringOutputConfig
instance Core.ToJSON MonitoringOutputConfig where
toJSON :: MonitoringOutputConfig -> Value
toJSON MonitoringOutputConfig' {Maybe Text
NonEmpty MonitoringOutput
monitoringOutputs :: NonEmpty MonitoringOutput
kmsKeyId :: Maybe Text
$sel:monitoringOutputs:MonitoringOutputConfig' :: MonitoringOutputConfig -> NonEmpty MonitoringOutput
$sel:kmsKeyId:MonitoringOutputConfig' :: MonitoringOutputConfig -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"KmsKeyId" 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
kmsKeyId,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"MonitoringOutputs" Text -> NonEmpty MonitoringOutput -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty MonitoringOutput
monitoringOutputs)
]
)