{-# 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.DataQualityBaselineConfig
-- 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.DataQualityBaselineConfig 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:/ 'newDataQualityBaselineConfig' smart constructor.
data DataQualityBaselineConfig = DataQualityBaselineConfig'
  { DataQualityBaselineConfig -> Maybe MonitoringConstraintsResource
constraintsResource :: Prelude.Maybe MonitoringConstraintsResource,
    DataQualityBaselineConfig -> Maybe MonitoringStatisticsResource
statisticsResource :: Prelude.Maybe MonitoringStatisticsResource,
    -- | The name of the job that performs baselining for the data quality
    -- monitoring job.
    DataQualityBaselineConfig -> Maybe Text
baseliningJobName :: Prelude.Maybe Prelude.Text
  }
  deriving (DataQualityBaselineConfig -> DataQualityBaselineConfig -> Bool
(DataQualityBaselineConfig -> DataQualityBaselineConfig -> Bool)
-> (DataQualityBaselineConfig -> DataQualityBaselineConfig -> Bool)
-> Eq DataQualityBaselineConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataQualityBaselineConfig -> DataQualityBaselineConfig -> Bool
$c/= :: DataQualityBaselineConfig -> DataQualityBaselineConfig -> Bool
== :: DataQualityBaselineConfig -> DataQualityBaselineConfig -> Bool
$c== :: DataQualityBaselineConfig -> DataQualityBaselineConfig -> Bool
Prelude.Eq, ReadPrec [DataQualityBaselineConfig]
ReadPrec DataQualityBaselineConfig
Int -> ReadS DataQualityBaselineConfig
ReadS [DataQualityBaselineConfig]
(Int -> ReadS DataQualityBaselineConfig)
-> ReadS [DataQualityBaselineConfig]
-> ReadPrec DataQualityBaselineConfig
-> ReadPrec [DataQualityBaselineConfig]
-> Read DataQualityBaselineConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataQualityBaselineConfig]
$creadListPrec :: ReadPrec [DataQualityBaselineConfig]
readPrec :: ReadPrec DataQualityBaselineConfig
$creadPrec :: ReadPrec DataQualityBaselineConfig
readList :: ReadS [DataQualityBaselineConfig]
$creadList :: ReadS [DataQualityBaselineConfig]
readsPrec :: Int -> ReadS DataQualityBaselineConfig
$creadsPrec :: Int -> ReadS DataQualityBaselineConfig
Prelude.Read, Int -> DataQualityBaselineConfig -> ShowS
[DataQualityBaselineConfig] -> ShowS
DataQualityBaselineConfig -> String
(Int -> DataQualityBaselineConfig -> ShowS)
-> (DataQualityBaselineConfig -> String)
-> ([DataQualityBaselineConfig] -> ShowS)
-> Show DataQualityBaselineConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataQualityBaselineConfig] -> ShowS
$cshowList :: [DataQualityBaselineConfig] -> ShowS
show :: DataQualityBaselineConfig -> String
$cshow :: DataQualityBaselineConfig -> String
showsPrec :: Int -> DataQualityBaselineConfig -> ShowS
$cshowsPrec :: Int -> DataQualityBaselineConfig -> ShowS
Prelude.Show, (forall x.
 DataQualityBaselineConfig -> Rep DataQualityBaselineConfig x)
-> (forall x.
    Rep DataQualityBaselineConfig x -> DataQualityBaselineConfig)
-> Generic DataQualityBaselineConfig
forall x.
Rep DataQualityBaselineConfig x -> DataQualityBaselineConfig
forall x.
DataQualityBaselineConfig -> Rep DataQualityBaselineConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DataQualityBaselineConfig x -> DataQualityBaselineConfig
$cfrom :: forall x.
DataQualityBaselineConfig -> Rep DataQualityBaselineConfig x
Prelude.Generic)

-- |
-- Create a value of 'DataQualityBaselineConfig' 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', 'dataQualityBaselineConfig_constraintsResource' - Undocumented member.
--
-- 'statisticsResource', 'dataQualityBaselineConfig_statisticsResource' - Undocumented member.
--
-- 'baseliningJobName', 'dataQualityBaselineConfig_baseliningJobName' - The name of the job that performs baselining for the data quality
-- monitoring job.
newDataQualityBaselineConfig ::
  DataQualityBaselineConfig
newDataQualityBaselineConfig :: DataQualityBaselineConfig
newDataQualityBaselineConfig =
  DataQualityBaselineConfig' :: Maybe MonitoringConstraintsResource
-> Maybe MonitoringStatisticsResource
-> Maybe Text
-> DataQualityBaselineConfig
DataQualityBaselineConfig'
    { $sel:constraintsResource:DataQualityBaselineConfig' :: Maybe MonitoringConstraintsResource
constraintsResource =
        Maybe MonitoringConstraintsResource
forall a. Maybe a
Prelude.Nothing,
      $sel:statisticsResource:DataQualityBaselineConfig' :: Maybe MonitoringStatisticsResource
statisticsResource = Maybe MonitoringStatisticsResource
forall a. Maybe a
Prelude.Nothing,
      $sel:baseliningJobName:DataQualityBaselineConfig' :: Maybe Text
baseliningJobName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
dataQualityBaselineConfig_constraintsResource :: Lens.Lens' DataQualityBaselineConfig (Prelude.Maybe MonitoringConstraintsResource)
dataQualityBaselineConfig_constraintsResource :: (Maybe MonitoringConstraintsResource
 -> f (Maybe MonitoringConstraintsResource))
-> DataQualityBaselineConfig -> f DataQualityBaselineConfig
dataQualityBaselineConfig_constraintsResource = (DataQualityBaselineConfig -> Maybe MonitoringConstraintsResource)
-> (DataQualityBaselineConfig
    -> Maybe MonitoringConstraintsResource
    -> DataQualityBaselineConfig)
-> Lens
     DataQualityBaselineConfig
     DataQualityBaselineConfig
     (Maybe MonitoringConstraintsResource)
     (Maybe MonitoringConstraintsResource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataQualityBaselineConfig' {Maybe MonitoringConstraintsResource
constraintsResource :: Maybe MonitoringConstraintsResource
$sel:constraintsResource:DataQualityBaselineConfig' :: DataQualityBaselineConfig -> Maybe MonitoringConstraintsResource
constraintsResource} -> Maybe MonitoringConstraintsResource
constraintsResource) (\s :: DataQualityBaselineConfig
s@DataQualityBaselineConfig' {} Maybe MonitoringConstraintsResource
a -> DataQualityBaselineConfig
s {$sel:constraintsResource:DataQualityBaselineConfig' :: Maybe MonitoringConstraintsResource
constraintsResource = Maybe MonitoringConstraintsResource
a} :: DataQualityBaselineConfig)

-- | Undocumented member.
dataQualityBaselineConfig_statisticsResource :: Lens.Lens' DataQualityBaselineConfig (Prelude.Maybe MonitoringStatisticsResource)
dataQualityBaselineConfig_statisticsResource :: (Maybe MonitoringStatisticsResource
 -> f (Maybe MonitoringStatisticsResource))
-> DataQualityBaselineConfig -> f DataQualityBaselineConfig
dataQualityBaselineConfig_statisticsResource = (DataQualityBaselineConfig -> Maybe MonitoringStatisticsResource)
-> (DataQualityBaselineConfig
    -> Maybe MonitoringStatisticsResource -> DataQualityBaselineConfig)
-> Lens
     DataQualityBaselineConfig
     DataQualityBaselineConfig
     (Maybe MonitoringStatisticsResource)
     (Maybe MonitoringStatisticsResource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataQualityBaselineConfig' {Maybe MonitoringStatisticsResource
statisticsResource :: Maybe MonitoringStatisticsResource
$sel:statisticsResource:DataQualityBaselineConfig' :: DataQualityBaselineConfig -> Maybe MonitoringStatisticsResource
statisticsResource} -> Maybe MonitoringStatisticsResource
statisticsResource) (\s :: DataQualityBaselineConfig
s@DataQualityBaselineConfig' {} Maybe MonitoringStatisticsResource
a -> DataQualityBaselineConfig
s {$sel:statisticsResource:DataQualityBaselineConfig' :: Maybe MonitoringStatisticsResource
statisticsResource = Maybe MonitoringStatisticsResource
a} :: DataQualityBaselineConfig)

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

instance Core.FromJSON DataQualityBaselineConfig where
  parseJSON :: Value -> Parser DataQualityBaselineConfig
parseJSON =
    String
-> (Object -> Parser DataQualityBaselineConfig)
-> Value
-> Parser DataQualityBaselineConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DataQualityBaselineConfig"
      ( \Object
x ->
          Maybe MonitoringConstraintsResource
-> Maybe MonitoringStatisticsResource
-> Maybe Text
-> DataQualityBaselineConfig
DataQualityBaselineConfig'
            (Maybe MonitoringConstraintsResource
 -> Maybe MonitoringStatisticsResource
 -> Maybe Text
 -> DataQualityBaselineConfig)
-> Parser (Maybe MonitoringConstraintsResource)
-> Parser
     (Maybe MonitoringStatisticsResource
      -> Maybe Text -> DataQualityBaselineConfig)
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 -> DataQualityBaselineConfig)
-> Parser (Maybe MonitoringStatisticsResource)
-> Parser (Maybe Text -> DataQualityBaselineConfig)
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 -> DataQualityBaselineConfig)
-> Parser (Maybe Text) -> Parser DataQualityBaselineConfig
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 DataQualityBaselineConfig

instance Prelude.NFData DataQualityBaselineConfig

instance Core.ToJSON DataQualityBaselineConfig where
  toJSON :: DataQualityBaselineConfig -> Value
toJSON DataQualityBaselineConfig' {Maybe Text
Maybe MonitoringConstraintsResource
Maybe MonitoringStatisticsResource
baseliningJobName :: Maybe Text
statisticsResource :: Maybe MonitoringStatisticsResource
constraintsResource :: Maybe MonitoringConstraintsResource
$sel:baseliningJobName:DataQualityBaselineConfig' :: DataQualityBaselineConfig -> Maybe Text
$sel:statisticsResource:DataQualityBaselineConfig' :: DataQualityBaselineConfig -> Maybe MonitoringStatisticsResource
$sel:constraintsResource:DataQualityBaselineConfig' :: DataQualityBaselineConfig -> 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
          ]
      )