{-# 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.KinesisAnalyticsV2.Types.MonitoringConfigurationUpdate
-- 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.KinesisAnalyticsV2.Types.MonitoringConfigurationUpdate where

import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalyticsV2.Types.ConfigurationType
import Amazonka.KinesisAnalyticsV2.Types.LogLevel
import Amazonka.KinesisAnalyticsV2.Types.MetricsLevel
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes updates to configuration parameters for Amazon CloudWatch
-- logging for an application.
--
-- /See:/ 'newMonitoringConfigurationUpdate' smart constructor.
data MonitoringConfigurationUpdate = MonitoringConfigurationUpdate'
  { -- | Describes updates to the granularity of the CloudWatch Logs for an
    -- application. The @Parallelism@ level is not recommended for applications
    -- with a Parallelism over 64 due to excessive costs.
    MonitoringConfigurationUpdate -> Maybe MetricsLevel
metricsLevelUpdate :: Prelude.Maybe MetricsLevel,
    -- | Describes updates to the verbosity of the CloudWatch Logs for an
    -- application.
    MonitoringConfigurationUpdate -> Maybe LogLevel
logLevelUpdate :: Prelude.Maybe LogLevel,
    -- | Describes updates to whether to use the default CloudWatch logging
    -- configuration for an application. You must set this property to @CUSTOM@
    -- in order to set the @LogLevel@ or @MetricsLevel@ parameters.
    MonitoringConfigurationUpdate -> Maybe ConfigurationType
configurationTypeUpdate :: Prelude.Maybe ConfigurationType
  }
  deriving (MonitoringConfigurationUpdate
-> MonitoringConfigurationUpdate -> Bool
(MonitoringConfigurationUpdate
 -> MonitoringConfigurationUpdate -> Bool)
-> (MonitoringConfigurationUpdate
    -> MonitoringConfigurationUpdate -> Bool)
-> Eq MonitoringConfigurationUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MonitoringConfigurationUpdate
-> MonitoringConfigurationUpdate -> Bool
$c/= :: MonitoringConfigurationUpdate
-> MonitoringConfigurationUpdate -> Bool
== :: MonitoringConfigurationUpdate
-> MonitoringConfigurationUpdate -> Bool
$c== :: MonitoringConfigurationUpdate
-> MonitoringConfigurationUpdate -> Bool
Prelude.Eq, ReadPrec [MonitoringConfigurationUpdate]
ReadPrec MonitoringConfigurationUpdate
Int -> ReadS MonitoringConfigurationUpdate
ReadS [MonitoringConfigurationUpdate]
(Int -> ReadS MonitoringConfigurationUpdate)
-> ReadS [MonitoringConfigurationUpdate]
-> ReadPrec MonitoringConfigurationUpdate
-> ReadPrec [MonitoringConfigurationUpdate]
-> Read MonitoringConfigurationUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MonitoringConfigurationUpdate]
$creadListPrec :: ReadPrec [MonitoringConfigurationUpdate]
readPrec :: ReadPrec MonitoringConfigurationUpdate
$creadPrec :: ReadPrec MonitoringConfigurationUpdate
readList :: ReadS [MonitoringConfigurationUpdate]
$creadList :: ReadS [MonitoringConfigurationUpdate]
readsPrec :: Int -> ReadS MonitoringConfigurationUpdate
$creadsPrec :: Int -> ReadS MonitoringConfigurationUpdate
Prelude.Read, Int -> MonitoringConfigurationUpdate -> ShowS
[MonitoringConfigurationUpdate] -> ShowS
MonitoringConfigurationUpdate -> String
(Int -> MonitoringConfigurationUpdate -> ShowS)
-> (MonitoringConfigurationUpdate -> String)
-> ([MonitoringConfigurationUpdate] -> ShowS)
-> Show MonitoringConfigurationUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MonitoringConfigurationUpdate] -> ShowS
$cshowList :: [MonitoringConfigurationUpdate] -> ShowS
show :: MonitoringConfigurationUpdate -> String
$cshow :: MonitoringConfigurationUpdate -> String
showsPrec :: Int -> MonitoringConfigurationUpdate -> ShowS
$cshowsPrec :: Int -> MonitoringConfigurationUpdate -> ShowS
Prelude.Show, (forall x.
 MonitoringConfigurationUpdate
 -> Rep MonitoringConfigurationUpdate x)
-> (forall x.
    Rep MonitoringConfigurationUpdate x
    -> MonitoringConfigurationUpdate)
-> Generic MonitoringConfigurationUpdate
forall x.
Rep MonitoringConfigurationUpdate x
-> MonitoringConfigurationUpdate
forall x.
MonitoringConfigurationUpdate
-> Rep MonitoringConfigurationUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MonitoringConfigurationUpdate x
-> MonitoringConfigurationUpdate
$cfrom :: forall x.
MonitoringConfigurationUpdate
-> Rep MonitoringConfigurationUpdate x
Prelude.Generic)

-- |
-- Create a value of 'MonitoringConfigurationUpdate' 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:
--
-- 'metricsLevelUpdate', 'monitoringConfigurationUpdate_metricsLevelUpdate' - Describes updates to the granularity of the CloudWatch Logs for an
-- application. The @Parallelism@ level is not recommended for applications
-- with a Parallelism over 64 due to excessive costs.
--
-- 'logLevelUpdate', 'monitoringConfigurationUpdate_logLevelUpdate' - Describes updates to the verbosity of the CloudWatch Logs for an
-- application.
--
-- 'configurationTypeUpdate', 'monitoringConfigurationUpdate_configurationTypeUpdate' - Describes updates to whether to use the default CloudWatch logging
-- configuration for an application. You must set this property to @CUSTOM@
-- in order to set the @LogLevel@ or @MetricsLevel@ parameters.
newMonitoringConfigurationUpdate ::
  MonitoringConfigurationUpdate
newMonitoringConfigurationUpdate :: MonitoringConfigurationUpdate
newMonitoringConfigurationUpdate =
  MonitoringConfigurationUpdate' :: Maybe MetricsLevel
-> Maybe LogLevel
-> Maybe ConfigurationType
-> MonitoringConfigurationUpdate
MonitoringConfigurationUpdate'
    { $sel:metricsLevelUpdate:MonitoringConfigurationUpdate' :: Maybe MetricsLevel
metricsLevelUpdate =
        Maybe MetricsLevel
forall a. Maybe a
Prelude.Nothing,
      $sel:logLevelUpdate:MonitoringConfigurationUpdate' :: Maybe LogLevel
logLevelUpdate = Maybe LogLevel
forall a. Maybe a
Prelude.Nothing,
      $sel:configurationTypeUpdate:MonitoringConfigurationUpdate' :: Maybe ConfigurationType
configurationTypeUpdate = Maybe ConfigurationType
forall a. Maybe a
Prelude.Nothing
    }

-- | Describes updates to the granularity of the CloudWatch Logs for an
-- application. The @Parallelism@ level is not recommended for applications
-- with a Parallelism over 64 due to excessive costs.
monitoringConfigurationUpdate_metricsLevelUpdate :: Lens.Lens' MonitoringConfigurationUpdate (Prelude.Maybe MetricsLevel)
monitoringConfigurationUpdate_metricsLevelUpdate :: (Maybe MetricsLevel -> f (Maybe MetricsLevel))
-> MonitoringConfigurationUpdate -> f MonitoringConfigurationUpdate
monitoringConfigurationUpdate_metricsLevelUpdate = (MonitoringConfigurationUpdate -> Maybe MetricsLevel)
-> (MonitoringConfigurationUpdate
    -> Maybe MetricsLevel -> MonitoringConfigurationUpdate)
-> Lens
     MonitoringConfigurationUpdate
     MonitoringConfigurationUpdate
     (Maybe MetricsLevel)
     (Maybe MetricsLevel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringConfigurationUpdate' {Maybe MetricsLevel
metricsLevelUpdate :: Maybe MetricsLevel
$sel:metricsLevelUpdate:MonitoringConfigurationUpdate' :: MonitoringConfigurationUpdate -> Maybe MetricsLevel
metricsLevelUpdate} -> Maybe MetricsLevel
metricsLevelUpdate) (\s :: MonitoringConfigurationUpdate
s@MonitoringConfigurationUpdate' {} Maybe MetricsLevel
a -> MonitoringConfigurationUpdate
s {$sel:metricsLevelUpdate:MonitoringConfigurationUpdate' :: Maybe MetricsLevel
metricsLevelUpdate = Maybe MetricsLevel
a} :: MonitoringConfigurationUpdate)

-- | Describes updates to the verbosity of the CloudWatch Logs for an
-- application.
monitoringConfigurationUpdate_logLevelUpdate :: Lens.Lens' MonitoringConfigurationUpdate (Prelude.Maybe LogLevel)
monitoringConfigurationUpdate_logLevelUpdate :: (Maybe LogLevel -> f (Maybe LogLevel))
-> MonitoringConfigurationUpdate -> f MonitoringConfigurationUpdate
monitoringConfigurationUpdate_logLevelUpdate = (MonitoringConfigurationUpdate -> Maybe LogLevel)
-> (MonitoringConfigurationUpdate
    -> Maybe LogLevel -> MonitoringConfigurationUpdate)
-> Lens
     MonitoringConfigurationUpdate
     MonitoringConfigurationUpdate
     (Maybe LogLevel)
     (Maybe LogLevel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringConfigurationUpdate' {Maybe LogLevel
logLevelUpdate :: Maybe LogLevel
$sel:logLevelUpdate:MonitoringConfigurationUpdate' :: MonitoringConfigurationUpdate -> Maybe LogLevel
logLevelUpdate} -> Maybe LogLevel
logLevelUpdate) (\s :: MonitoringConfigurationUpdate
s@MonitoringConfigurationUpdate' {} Maybe LogLevel
a -> MonitoringConfigurationUpdate
s {$sel:logLevelUpdate:MonitoringConfigurationUpdate' :: Maybe LogLevel
logLevelUpdate = Maybe LogLevel
a} :: MonitoringConfigurationUpdate)

-- | Describes updates to whether to use the default CloudWatch logging
-- configuration for an application. You must set this property to @CUSTOM@
-- in order to set the @LogLevel@ or @MetricsLevel@ parameters.
monitoringConfigurationUpdate_configurationTypeUpdate :: Lens.Lens' MonitoringConfigurationUpdate (Prelude.Maybe ConfigurationType)
monitoringConfigurationUpdate_configurationTypeUpdate :: (Maybe ConfigurationType -> f (Maybe ConfigurationType))
-> MonitoringConfigurationUpdate -> f MonitoringConfigurationUpdate
monitoringConfigurationUpdate_configurationTypeUpdate = (MonitoringConfigurationUpdate -> Maybe ConfigurationType)
-> (MonitoringConfigurationUpdate
    -> Maybe ConfigurationType -> MonitoringConfigurationUpdate)
-> Lens
     MonitoringConfigurationUpdate
     MonitoringConfigurationUpdate
     (Maybe ConfigurationType)
     (Maybe ConfigurationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringConfigurationUpdate' {Maybe ConfigurationType
configurationTypeUpdate :: Maybe ConfigurationType
$sel:configurationTypeUpdate:MonitoringConfigurationUpdate' :: MonitoringConfigurationUpdate -> Maybe ConfigurationType
configurationTypeUpdate} -> Maybe ConfigurationType
configurationTypeUpdate) (\s :: MonitoringConfigurationUpdate
s@MonitoringConfigurationUpdate' {} Maybe ConfigurationType
a -> MonitoringConfigurationUpdate
s {$sel:configurationTypeUpdate:MonitoringConfigurationUpdate' :: Maybe ConfigurationType
configurationTypeUpdate = Maybe ConfigurationType
a} :: MonitoringConfigurationUpdate)

instance
  Prelude.Hashable
    MonitoringConfigurationUpdate

instance Prelude.NFData MonitoringConfigurationUpdate

instance Core.ToJSON MonitoringConfigurationUpdate where
  toJSON :: MonitoringConfigurationUpdate -> Value
toJSON MonitoringConfigurationUpdate' {Maybe ConfigurationType
Maybe LogLevel
Maybe MetricsLevel
configurationTypeUpdate :: Maybe ConfigurationType
logLevelUpdate :: Maybe LogLevel
metricsLevelUpdate :: Maybe MetricsLevel
$sel:configurationTypeUpdate:MonitoringConfigurationUpdate' :: MonitoringConfigurationUpdate -> Maybe ConfigurationType
$sel:logLevelUpdate:MonitoringConfigurationUpdate' :: MonitoringConfigurationUpdate -> Maybe LogLevel
$sel:metricsLevelUpdate:MonitoringConfigurationUpdate' :: MonitoringConfigurationUpdate -> Maybe MetricsLevel
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"MetricsLevelUpdate" Text -> MetricsLevel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (MetricsLevel -> Pair) -> Maybe MetricsLevel -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MetricsLevel
metricsLevelUpdate,
            (Text
"LogLevelUpdate" Text -> LogLevel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (LogLevel -> Pair) -> Maybe LogLevel -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LogLevel
logLevelUpdate,
            (Text
"ConfigurationTypeUpdate" Text -> ConfigurationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ConfigurationType -> Pair)
-> Maybe ConfigurationType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConfigurationType
configurationTypeUpdate
          ]
      )