{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SageMaker.Types.MonitoringBaselineConfig
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SageMaker.Types.MonitoringBaselineConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.MonitoringConstraintsResource
import Amazonka.SageMaker.Types.MonitoringStatisticsResource

-- | Configuration for monitoring constraints and monitoring statistics.
-- These baseline resources are compared against the results of the current
-- job from the series of jobs scheduled to collect data periodically.
--
-- /See:/ 'newMonitoringBaselineConfig' smart constructor.
data MonitoringBaselineConfig = MonitoringBaselineConfig'
  { -- | The baseline constraint file in Amazon S3 that the current monitoring
    -- job should validated against.
    MonitoringBaselineConfig -> Maybe MonitoringConstraintsResource
constraintsResource :: Prelude.Maybe MonitoringConstraintsResource,
    -- | The baseline statistics file in Amazon S3 that the current monitoring
    -- job should be validated against.
    MonitoringBaselineConfig -> Maybe MonitoringStatisticsResource
statisticsResource :: Prelude.Maybe MonitoringStatisticsResource,
    -- | The name of the job that performs baselining for the monitoring job.
    MonitoringBaselineConfig -> Maybe Text
baseliningJobName :: Prelude.Maybe Prelude.Text
  }
  deriving (MonitoringBaselineConfig -> MonitoringBaselineConfig -> Bool
(MonitoringBaselineConfig -> MonitoringBaselineConfig -> Bool)
-> (MonitoringBaselineConfig -> MonitoringBaselineConfig -> Bool)
-> Eq MonitoringBaselineConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MonitoringBaselineConfig -> MonitoringBaselineConfig -> Bool
$c/= :: MonitoringBaselineConfig -> MonitoringBaselineConfig -> Bool
== :: MonitoringBaselineConfig -> MonitoringBaselineConfig -> Bool
$c== :: MonitoringBaselineConfig -> MonitoringBaselineConfig -> Bool
Prelude.Eq, ReadPrec [MonitoringBaselineConfig]
ReadPrec MonitoringBaselineConfig
Int -> ReadS MonitoringBaselineConfig
ReadS [MonitoringBaselineConfig]
(Int -> ReadS MonitoringBaselineConfig)
-> ReadS [MonitoringBaselineConfig]
-> ReadPrec MonitoringBaselineConfig
-> ReadPrec [MonitoringBaselineConfig]
-> Read MonitoringBaselineConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MonitoringBaselineConfig]
$creadListPrec :: ReadPrec [MonitoringBaselineConfig]
readPrec :: ReadPrec MonitoringBaselineConfig
$creadPrec :: ReadPrec MonitoringBaselineConfig
readList :: ReadS [MonitoringBaselineConfig]
$creadList :: ReadS [MonitoringBaselineConfig]
readsPrec :: Int -> ReadS MonitoringBaselineConfig
$creadsPrec :: Int -> ReadS MonitoringBaselineConfig
Prelude.Read, Int -> MonitoringBaselineConfig -> ShowS
[MonitoringBaselineConfig] -> ShowS
MonitoringBaselineConfig -> String
(Int -> MonitoringBaselineConfig -> ShowS)
-> (MonitoringBaselineConfig -> String)
-> ([MonitoringBaselineConfig] -> ShowS)
-> Show MonitoringBaselineConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MonitoringBaselineConfig] -> ShowS
$cshowList :: [MonitoringBaselineConfig] -> ShowS
show :: MonitoringBaselineConfig -> String
$cshow :: MonitoringBaselineConfig -> String
showsPrec :: Int -> MonitoringBaselineConfig -> ShowS
$cshowsPrec :: Int -> MonitoringBaselineConfig -> ShowS
Prelude.Show, (forall x.
 MonitoringBaselineConfig -> Rep MonitoringBaselineConfig x)
-> (forall x.
    Rep MonitoringBaselineConfig x -> MonitoringBaselineConfig)
-> Generic MonitoringBaselineConfig
forall x.
Rep MonitoringBaselineConfig x -> MonitoringBaselineConfig
forall x.
MonitoringBaselineConfig -> Rep MonitoringBaselineConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MonitoringBaselineConfig x -> MonitoringBaselineConfig
$cfrom :: forall x.
MonitoringBaselineConfig -> Rep MonitoringBaselineConfig x
Prelude.Generic)

-- |
-- Create a value of 'MonitoringBaselineConfig' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'constraintsResource', 'monitoringBaselineConfig_constraintsResource' - The baseline constraint file in Amazon S3 that the current monitoring
-- job should validated against.
--
-- 'statisticsResource', 'monitoringBaselineConfig_statisticsResource' - The baseline statistics file in Amazon S3 that the current monitoring
-- job should be validated against.
--
-- 'baseliningJobName', 'monitoringBaselineConfig_baseliningJobName' - The name of the job that performs baselining for the monitoring job.
newMonitoringBaselineConfig ::
  MonitoringBaselineConfig
newMonitoringBaselineConfig :: MonitoringBaselineConfig
newMonitoringBaselineConfig =
  MonitoringBaselineConfig' :: Maybe MonitoringConstraintsResource
-> Maybe MonitoringStatisticsResource
-> Maybe Text
-> MonitoringBaselineConfig
MonitoringBaselineConfig'
    { $sel:constraintsResource:MonitoringBaselineConfig' :: Maybe MonitoringConstraintsResource
constraintsResource =
        Maybe MonitoringConstraintsResource
forall a. Maybe a
Prelude.Nothing,
      $sel:statisticsResource:MonitoringBaselineConfig' :: Maybe MonitoringStatisticsResource
statisticsResource = Maybe MonitoringStatisticsResource
forall a. Maybe a
Prelude.Nothing,
      $sel:baseliningJobName:MonitoringBaselineConfig' :: Maybe Text
baseliningJobName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The baseline constraint file in Amazon S3 that the current monitoring
-- job should validated against.
monitoringBaselineConfig_constraintsResource :: Lens.Lens' MonitoringBaselineConfig (Prelude.Maybe MonitoringConstraintsResource)
monitoringBaselineConfig_constraintsResource :: (Maybe MonitoringConstraintsResource
 -> f (Maybe MonitoringConstraintsResource))
-> MonitoringBaselineConfig -> f MonitoringBaselineConfig
monitoringBaselineConfig_constraintsResource = (MonitoringBaselineConfig -> Maybe MonitoringConstraintsResource)
-> (MonitoringBaselineConfig
    -> Maybe MonitoringConstraintsResource -> MonitoringBaselineConfig)
-> Lens
     MonitoringBaselineConfig
     MonitoringBaselineConfig
     (Maybe MonitoringConstraintsResource)
     (Maybe MonitoringConstraintsResource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringBaselineConfig' {Maybe MonitoringConstraintsResource
constraintsResource :: Maybe MonitoringConstraintsResource
$sel:constraintsResource:MonitoringBaselineConfig' :: MonitoringBaselineConfig -> Maybe MonitoringConstraintsResource
constraintsResource} -> Maybe MonitoringConstraintsResource
constraintsResource) (\s :: MonitoringBaselineConfig
s@MonitoringBaselineConfig' {} Maybe MonitoringConstraintsResource
a -> MonitoringBaselineConfig
s {$sel:constraintsResource:MonitoringBaselineConfig' :: Maybe MonitoringConstraintsResource
constraintsResource = Maybe MonitoringConstraintsResource
a} :: MonitoringBaselineConfig)

-- | The baseline statistics file in Amazon S3 that the current monitoring
-- job should be validated against.
monitoringBaselineConfig_statisticsResource :: Lens.Lens' MonitoringBaselineConfig (Prelude.Maybe MonitoringStatisticsResource)
monitoringBaselineConfig_statisticsResource :: (Maybe MonitoringStatisticsResource
 -> f (Maybe MonitoringStatisticsResource))
-> MonitoringBaselineConfig -> f MonitoringBaselineConfig
monitoringBaselineConfig_statisticsResource = (MonitoringBaselineConfig -> Maybe MonitoringStatisticsResource)
-> (MonitoringBaselineConfig
    -> Maybe MonitoringStatisticsResource -> MonitoringBaselineConfig)
-> Lens
     MonitoringBaselineConfig
     MonitoringBaselineConfig
     (Maybe MonitoringStatisticsResource)
     (Maybe MonitoringStatisticsResource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringBaselineConfig' {Maybe MonitoringStatisticsResource
statisticsResource :: Maybe MonitoringStatisticsResource
$sel:statisticsResource:MonitoringBaselineConfig' :: MonitoringBaselineConfig -> Maybe MonitoringStatisticsResource
statisticsResource} -> Maybe MonitoringStatisticsResource
statisticsResource) (\s :: MonitoringBaselineConfig
s@MonitoringBaselineConfig' {} Maybe MonitoringStatisticsResource
a -> MonitoringBaselineConfig
s {$sel:statisticsResource:MonitoringBaselineConfig' :: Maybe MonitoringStatisticsResource
statisticsResource = Maybe MonitoringStatisticsResource
a} :: MonitoringBaselineConfig)

-- | The name of the job that performs baselining for the monitoring job.
monitoringBaselineConfig_baseliningJobName :: Lens.Lens' MonitoringBaselineConfig (Prelude.Maybe Prelude.Text)
monitoringBaselineConfig_baseliningJobName :: (Maybe Text -> f (Maybe Text))
-> MonitoringBaselineConfig -> f MonitoringBaselineConfig
monitoringBaselineConfig_baseliningJobName = (MonitoringBaselineConfig -> Maybe Text)
-> (MonitoringBaselineConfig
    -> Maybe Text -> MonitoringBaselineConfig)
-> Lens
     MonitoringBaselineConfig
     MonitoringBaselineConfig
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringBaselineConfig' {Maybe Text
baseliningJobName :: Maybe Text
$sel:baseliningJobName:MonitoringBaselineConfig' :: MonitoringBaselineConfig -> Maybe Text
baseliningJobName} -> Maybe Text
baseliningJobName) (\s :: MonitoringBaselineConfig
s@MonitoringBaselineConfig' {} Maybe Text
a -> MonitoringBaselineConfig
s {$sel:baseliningJobName:MonitoringBaselineConfig' :: Maybe Text
baseliningJobName = Maybe Text
a} :: MonitoringBaselineConfig)

instance Core.FromJSON MonitoringBaselineConfig where
  parseJSON :: Value -> Parser MonitoringBaselineConfig
parseJSON =
    String
-> (Object -> Parser MonitoringBaselineConfig)
-> Value
-> Parser MonitoringBaselineConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MonitoringBaselineConfig"
      ( \Object
x ->
          Maybe MonitoringConstraintsResource
-> Maybe MonitoringStatisticsResource
-> Maybe Text
-> MonitoringBaselineConfig
MonitoringBaselineConfig'
            (Maybe MonitoringConstraintsResource
 -> Maybe MonitoringStatisticsResource
 -> Maybe Text
 -> MonitoringBaselineConfig)
-> Parser (Maybe MonitoringConstraintsResource)
-> Parser
     (Maybe MonitoringStatisticsResource
      -> Maybe Text -> MonitoringBaselineConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe MonitoringConstraintsResource)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ConstraintsResource")
            Parser
  (Maybe MonitoringStatisticsResource
   -> Maybe Text -> MonitoringBaselineConfig)
-> Parser (Maybe MonitoringStatisticsResource)
-> Parser (Maybe Text -> MonitoringBaselineConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MonitoringStatisticsResource)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StatisticsResource")
            Parser (Maybe Text -> MonitoringBaselineConfig)
-> Parser (Maybe Text) -> Parser MonitoringBaselineConfig
forall (f :: * -> *) a b. Applicative f => 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
"BaseliningJobName")
      )

instance Prelude.Hashable MonitoringBaselineConfig

instance Prelude.NFData MonitoringBaselineConfig

instance Core.ToJSON MonitoringBaselineConfig where
  toJSON :: MonitoringBaselineConfig -> Value
toJSON MonitoringBaselineConfig' {Maybe Text
Maybe MonitoringConstraintsResource
Maybe MonitoringStatisticsResource
baseliningJobName :: Maybe Text
statisticsResource :: Maybe MonitoringStatisticsResource
constraintsResource :: Maybe MonitoringConstraintsResource
$sel:baseliningJobName:MonitoringBaselineConfig' :: MonitoringBaselineConfig -> Maybe Text
$sel:statisticsResource:MonitoringBaselineConfig' :: MonitoringBaselineConfig -> Maybe MonitoringStatisticsResource
$sel:constraintsResource:MonitoringBaselineConfig' :: MonitoringBaselineConfig -> Maybe MonitoringConstraintsResource
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ConstraintsResource" Text -> MonitoringConstraintsResource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (MonitoringConstraintsResource -> Pair)
-> Maybe MonitoringConstraintsResource -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MonitoringConstraintsResource
constraintsResource,
            (Text
"StatisticsResource" Text -> MonitoringStatisticsResource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (MonitoringStatisticsResource -> Pair)
-> Maybe MonitoringStatisticsResource -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MonitoringStatisticsResource
statisticsResource,
            (Text
"BaseliningJobName" 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
baseliningJobName
          ]
      )