{-# 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.MonitoringScheduleConfig
-- 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.MonitoringScheduleConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.MonitoringJobDefinition
import Amazonka.SageMaker.Types.MonitoringType
import Amazonka.SageMaker.Types.ScheduleConfig

-- | Configures the monitoring schedule and defines the monitoring job.
--
-- /See:/ 'newMonitoringScheduleConfig' smart constructor.
data MonitoringScheduleConfig = MonitoringScheduleConfig'
  { -- | The type of the monitoring job definition to schedule.
    MonitoringScheduleConfig -> Maybe MonitoringType
monitoringType :: Prelude.Maybe MonitoringType,
    -- | Configures the monitoring schedule.
    MonitoringScheduleConfig -> Maybe ScheduleConfig
scheduleConfig :: Prelude.Maybe ScheduleConfig,
    -- | Defines the monitoring job.
    MonitoringScheduleConfig -> Maybe MonitoringJobDefinition
monitoringJobDefinition :: Prelude.Maybe MonitoringJobDefinition,
    -- | The name of the monitoring job definition to schedule.
    MonitoringScheduleConfig -> Maybe Text
monitoringJobDefinitionName :: Prelude.Maybe Prelude.Text
  }
  deriving (MonitoringScheduleConfig -> MonitoringScheduleConfig -> Bool
(MonitoringScheduleConfig -> MonitoringScheduleConfig -> Bool)
-> (MonitoringScheduleConfig -> MonitoringScheduleConfig -> Bool)
-> Eq MonitoringScheduleConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MonitoringScheduleConfig -> MonitoringScheduleConfig -> Bool
$c/= :: MonitoringScheduleConfig -> MonitoringScheduleConfig -> Bool
== :: MonitoringScheduleConfig -> MonitoringScheduleConfig -> Bool
$c== :: MonitoringScheduleConfig -> MonitoringScheduleConfig -> Bool
Prelude.Eq, ReadPrec [MonitoringScheduleConfig]
ReadPrec MonitoringScheduleConfig
Int -> ReadS MonitoringScheduleConfig
ReadS [MonitoringScheduleConfig]
(Int -> ReadS MonitoringScheduleConfig)
-> ReadS [MonitoringScheduleConfig]
-> ReadPrec MonitoringScheduleConfig
-> ReadPrec [MonitoringScheduleConfig]
-> Read MonitoringScheduleConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MonitoringScheduleConfig]
$creadListPrec :: ReadPrec [MonitoringScheduleConfig]
readPrec :: ReadPrec MonitoringScheduleConfig
$creadPrec :: ReadPrec MonitoringScheduleConfig
readList :: ReadS [MonitoringScheduleConfig]
$creadList :: ReadS [MonitoringScheduleConfig]
readsPrec :: Int -> ReadS MonitoringScheduleConfig
$creadsPrec :: Int -> ReadS MonitoringScheduleConfig
Prelude.Read, Int -> MonitoringScheduleConfig -> ShowS
[MonitoringScheduleConfig] -> ShowS
MonitoringScheduleConfig -> String
(Int -> MonitoringScheduleConfig -> ShowS)
-> (MonitoringScheduleConfig -> String)
-> ([MonitoringScheduleConfig] -> ShowS)
-> Show MonitoringScheduleConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MonitoringScheduleConfig] -> ShowS
$cshowList :: [MonitoringScheduleConfig] -> ShowS
show :: MonitoringScheduleConfig -> String
$cshow :: MonitoringScheduleConfig -> String
showsPrec :: Int -> MonitoringScheduleConfig -> ShowS
$cshowsPrec :: Int -> MonitoringScheduleConfig -> ShowS
Prelude.Show, (forall x.
 MonitoringScheduleConfig -> Rep MonitoringScheduleConfig x)
-> (forall x.
    Rep MonitoringScheduleConfig x -> MonitoringScheduleConfig)
-> Generic MonitoringScheduleConfig
forall x.
Rep MonitoringScheduleConfig x -> MonitoringScheduleConfig
forall x.
MonitoringScheduleConfig -> Rep MonitoringScheduleConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MonitoringScheduleConfig x -> MonitoringScheduleConfig
$cfrom :: forall x.
MonitoringScheduleConfig -> Rep MonitoringScheduleConfig x
Prelude.Generic)

-- |
-- Create a value of 'MonitoringScheduleConfig' 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:
--
-- 'monitoringType', 'monitoringScheduleConfig_monitoringType' - The type of the monitoring job definition to schedule.
--
-- 'scheduleConfig', 'monitoringScheduleConfig_scheduleConfig' - Configures the monitoring schedule.
--
-- 'monitoringJobDefinition', 'monitoringScheduleConfig_monitoringJobDefinition' - Defines the monitoring job.
--
-- 'monitoringJobDefinitionName', 'monitoringScheduleConfig_monitoringJobDefinitionName' - The name of the monitoring job definition to schedule.
newMonitoringScheduleConfig ::
  MonitoringScheduleConfig
newMonitoringScheduleConfig :: MonitoringScheduleConfig
newMonitoringScheduleConfig =
  MonitoringScheduleConfig' :: Maybe MonitoringType
-> Maybe ScheduleConfig
-> Maybe MonitoringJobDefinition
-> Maybe Text
-> MonitoringScheduleConfig
MonitoringScheduleConfig'
    { $sel:monitoringType:MonitoringScheduleConfig' :: Maybe MonitoringType
monitoringType =
        Maybe MonitoringType
forall a. Maybe a
Prelude.Nothing,
      $sel:scheduleConfig:MonitoringScheduleConfig' :: Maybe ScheduleConfig
scheduleConfig = Maybe ScheduleConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:monitoringJobDefinition:MonitoringScheduleConfig' :: Maybe MonitoringJobDefinition
monitoringJobDefinition = Maybe MonitoringJobDefinition
forall a. Maybe a
Prelude.Nothing,
      $sel:monitoringJobDefinitionName:MonitoringScheduleConfig' :: Maybe Text
monitoringJobDefinitionName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The type of the monitoring job definition to schedule.
monitoringScheduleConfig_monitoringType :: Lens.Lens' MonitoringScheduleConfig (Prelude.Maybe MonitoringType)
monitoringScheduleConfig_monitoringType :: (Maybe MonitoringType -> f (Maybe MonitoringType))
-> MonitoringScheduleConfig -> f MonitoringScheduleConfig
monitoringScheduleConfig_monitoringType = (MonitoringScheduleConfig -> Maybe MonitoringType)
-> (MonitoringScheduleConfig
    -> Maybe MonitoringType -> MonitoringScheduleConfig)
-> Lens
     MonitoringScheduleConfig
     MonitoringScheduleConfig
     (Maybe MonitoringType)
     (Maybe MonitoringType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringScheduleConfig' {Maybe MonitoringType
monitoringType :: Maybe MonitoringType
$sel:monitoringType:MonitoringScheduleConfig' :: MonitoringScheduleConfig -> Maybe MonitoringType
monitoringType} -> Maybe MonitoringType
monitoringType) (\s :: MonitoringScheduleConfig
s@MonitoringScheduleConfig' {} Maybe MonitoringType
a -> MonitoringScheduleConfig
s {$sel:monitoringType:MonitoringScheduleConfig' :: Maybe MonitoringType
monitoringType = Maybe MonitoringType
a} :: MonitoringScheduleConfig)

-- | Configures the monitoring schedule.
monitoringScheduleConfig_scheduleConfig :: Lens.Lens' MonitoringScheduleConfig (Prelude.Maybe ScheduleConfig)
monitoringScheduleConfig_scheduleConfig :: (Maybe ScheduleConfig -> f (Maybe ScheduleConfig))
-> MonitoringScheduleConfig -> f MonitoringScheduleConfig
monitoringScheduleConfig_scheduleConfig = (MonitoringScheduleConfig -> Maybe ScheduleConfig)
-> (MonitoringScheduleConfig
    -> Maybe ScheduleConfig -> MonitoringScheduleConfig)
-> Lens
     MonitoringScheduleConfig
     MonitoringScheduleConfig
     (Maybe ScheduleConfig)
     (Maybe ScheduleConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringScheduleConfig' {Maybe ScheduleConfig
scheduleConfig :: Maybe ScheduleConfig
$sel:scheduleConfig:MonitoringScheduleConfig' :: MonitoringScheduleConfig -> Maybe ScheduleConfig
scheduleConfig} -> Maybe ScheduleConfig
scheduleConfig) (\s :: MonitoringScheduleConfig
s@MonitoringScheduleConfig' {} Maybe ScheduleConfig
a -> MonitoringScheduleConfig
s {$sel:scheduleConfig:MonitoringScheduleConfig' :: Maybe ScheduleConfig
scheduleConfig = Maybe ScheduleConfig
a} :: MonitoringScheduleConfig)

-- | Defines the monitoring job.
monitoringScheduleConfig_monitoringJobDefinition :: Lens.Lens' MonitoringScheduleConfig (Prelude.Maybe MonitoringJobDefinition)
monitoringScheduleConfig_monitoringJobDefinition :: (Maybe MonitoringJobDefinition
 -> f (Maybe MonitoringJobDefinition))
-> MonitoringScheduleConfig -> f MonitoringScheduleConfig
monitoringScheduleConfig_monitoringJobDefinition = (MonitoringScheduleConfig -> Maybe MonitoringJobDefinition)
-> (MonitoringScheduleConfig
    -> Maybe MonitoringJobDefinition -> MonitoringScheduleConfig)
-> Lens
     MonitoringScheduleConfig
     MonitoringScheduleConfig
     (Maybe MonitoringJobDefinition)
     (Maybe MonitoringJobDefinition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringScheduleConfig' {Maybe MonitoringJobDefinition
monitoringJobDefinition :: Maybe MonitoringJobDefinition
$sel:monitoringJobDefinition:MonitoringScheduleConfig' :: MonitoringScheduleConfig -> Maybe MonitoringJobDefinition
monitoringJobDefinition} -> Maybe MonitoringJobDefinition
monitoringJobDefinition) (\s :: MonitoringScheduleConfig
s@MonitoringScheduleConfig' {} Maybe MonitoringJobDefinition
a -> MonitoringScheduleConfig
s {$sel:monitoringJobDefinition:MonitoringScheduleConfig' :: Maybe MonitoringJobDefinition
monitoringJobDefinition = Maybe MonitoringJobDefinition
a} :: MonitoringScheduleConfig)

-- | The name of the monitoring job definition to schedule.
monitoringScheduleConfig_monitoringJobDefinitionName :: Lens.Lens' MonitoringScheduleConfig (Prelude.Maybe Prelude.Text)
monitoringScheduleConfig_monitoringJobDefinitionName :: (Maybe Text -> f (Maybe Text))
-> MonitoringScheduleConfig -> f MonitoringScheduleConfig
monitoringScheduleConfig_monitoringJobDefinitionName = (MonitoringScheduleConfig -> Maybe Text)
-> (MonitoringScheduleConfig
    -> Maybe Text -> MonitoringScheduleConfig)
-> Lens
     MonitoringScheduleConfig
     MonitoringScheduleConfig
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringScheduleConfig' {Maybe Text
monitoringJobDefinitionName :: Maybe Text
$sel:monitoringJobDefinitionName:MonitoringScheduleConfig' :: MonitoringScheduleConfig -> Maybe Text
monitoringJobDefinitionName} -> Maybe Text
monitoringJobDefinitionName) (\s :: MonitoringScheduleConfig
s@MonitoringScheduleConfig' {} Maybe Text
a -> MonitoringScheduleConfig
s {$sel:monitoringJobDefinitionName:MonitoringScheduleConfig' :: Maybe Text
monitoringJobDefinitionName = Maybe Text
a} :: MonitoringScheduleConfig)

instance Core.FromJSON MonitoringScheduleConfig where
  parseJSON :: Value -> Parser MonitoringScheduleConfig
parseJSON =
    String
-> (Object -> Parser MonitoringScheduleConfig)
-> Value
-> Parser MonitoringScheduleConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MonitoringScheduleConfig"
      ( \Object
x ->
          Maybe MonitoringType
-> Maybe ScheduleConfig
-> Maybe MonitoringJobDefinition
-> Maybe Text
-> MonitoringScheduleConfig
MonitoringScheduleConfig'
            (Maybe MonitoringType
 -> Maybe ScheduleConfig
 -> Maybe MonitoringJobDefinition
 -> Maybe Text
 -> MonitoringScheduleConfig)
-> Parser (Maybe MonitoringType)
-> Parser
     (Maybe ScheduleConfig
      -> Maybe MonitoringJobDefinition
      -> Maybe Text
      -> MonitoringScheduleConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe MonitoringType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MonitoringType")
            Parser
  (Maybe ScheduleConfig
   -> Maybe MonitoringJobDefinition
   -> Maybe Text
   -> MonitoringScheduleConfig)
-> Parser (Maybe ScheduleConfig)
-> Parser
     (Maybe MonitoringJobDefinition
      -> Maybe Text -> MonitoringScheduleConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ScheduleConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ScheduleConfig")
            Parser
  (Maybe MonitoringJobDefinition
   -> Maybe Text -> MonitoringScheduleConfig)
-> Parser (Maybe MonitoringJobDefinition)
-> Parser (Maybe Text -> MonitoringScheduleConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MonitoringJobDefinition)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MonitoringJobDefinition")
            Parser (Maybe Text -> MonitoringScheduleConfig)
-> Parser (Maybe Text) -> Parser MonitoringScheduleConfig
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
"MonitoringJobDefinitionName")
      )

instance Prelude.Hashable MonitoringScheduleConfig

instance Prelude.NFData MonitoringScheduleConfig

instance Core.ToJSON MonitoringScheduleConfig where
  toJSON :: MonitoringScheduleConfig -> Value
toJSON MonitoringScheduleConfig' {Maybe Text
Maybe MonitoringType
Maybe ScheduleConfig
Maybe MonitoringJobDefinition
monitoringJobDefinitionName :: Maybe Text
monitoringJobDefinition :: Maybe MonitoringJobDefinition
scheduleConfig :: Maybe ScheduleConfig
monitoringType :: Maybe MonitoringType
$sel:monitoringJobDefinitionName:MonitoringScheduleConfig' :: MonitoringScheduleConfig -> Maybe Text
$sel:monitoringJobDefinition:MonitoringScheduleConfig' :: MonitoringScheduleConfig -> Maybe MonitoringJobDefinition
$sel:scheduleConfig:MonitoringScheduleConfig' :: MonitoringScheduleConfig -> Maybe ScheduleConfig
$sel:monitoringType:MonitoringScheduleConfig' :: MonitoringScheduleConfig -> Maybe MonitoringType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"MonitoringType" Text -> MonitoringType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (MonitoringType -> Pair) -> Maybe MonitoringType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MonitoringType
monitoringType,
            (Text
"ScheduleConfig" Text -> ScheduleConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ScheduleConfig -> Pair) -> Maybe ScheduleConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ScheduleConfig
scheduleConfig,
            (Text
"MonitoringJobDefinition" Text -> MonitoringJobDefinition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (MonitoringJobDefinition -> Pair)
-> Maybe MonitoringJobDefinition -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MonitoringJobDefinition
monitoringJobDefinition,
            (Text
"MonitoringJobDefinitionName" 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
monitoringJobDefinitionName
          ]
      )