{-# 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.MonitoringConfigurationDescription
-- 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.MonitoringConfigurationDescription 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 configuration parameters for CloudWatch logging for an
-- application.
--
-- /See:/ 'newMonitoringConfigurationDescription' smart constructor.
data MonitoringConfigurationDescription = MonitoringConfigurationDescription'
  { -- | Describes the verbosity of the CloudWatch Logs for an application.
    MonitoringConfigurationDescription -> Maybe LogLevel
logLevel :: Prelude.Maybe LogLevel,
    -- | Describes whether to use the default CloudWatch logging configuration
    -- for an application.
    MonitoringConfigurationDescription -> Maybe ConfigurationType
configurationType :: Prelude.Maybe ConfigurationType,
    -- | Describes the granularity of the CloudWatch Logs for an application.
    MonitoringConfigurationDescription -> Maybe MetricsLevel
metricsLevel :: Prelude.Maybe MetricsLevel
  }
  deriving (MonitoringConfigurationDescription
-> MonitoringConfigurationDescription -> Bool
(MonitoringConfigurationDescription
 -> MonitoringConfigurationDescription -> Bool)
-> (MonitoringConfigurationDescription
    -> MonitoringConfigurationDescription -> Bool)
-> Eq MonitoringConfigurationDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MonitoringConfigurationDescription
-> MonitoringConfigurationDescription -> Bool
$c/= :: MonitoringConfigurationDescription
-> MonitoringConfigurationDescription -> Bool
== :: MonitoringConfigurationDescription
-> MonitoringConfigurationDescription -> Bool
$c== :: MonitoringConfigurationDescription
-> MonitoringConfigurationDescription -> Bool
Prelude.Eq, ReadPrec [MonitoringConfigurationDescription]
ReadPrec MonitoringConfigurationDescription
Int -> ReadS MonitoringConfigurationDescription
ReadS [MonitoringConfigurationDescription]
(Int -> ReadS MonitoringConfigurationDescription)
-> ReadS [MonitoringConfigurationDescription]
-> ReadPrec MonitoringConfigurationDescription
-> ReadPrec [MonitoringConfigurationDescription]
-> Read MonitoringConfigurationDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MonitoringConfigurationDescription]
$creadListPrec :: ReadPrec [MonitoringConfigurationDescription]
readPrec :: ReadPrec MonitoringConfigurationDescription
$creadPrec :: ReadPrec MonitoringConfigurationDescription
readList :: ReadS [MonitoringConfigurationDescription]
$creadList :: ReadS [MonitoringConfigurationDescription]
readsPrec :: Int -> ReadS MonitoringConfigurationDescription
$creadsPrec :: Int -> ReadS MonitoringConfigurationDescription
Prelude.Read, Int -> MonitoringConfigurationDescription -> ShowS
[MonitoringConfigurationDescription] -> ShowS
MonitoringConfigurationDescription -> String
(Int -> MonitoringConfigurationDescription -> ShowS)
-> (MonitoringConfigurationDescription -> String)
-> ([MonitoringConfigurationDescription] -> ShowS)
-> Show MonitoringConfigurationDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MonitoringConfigurationDescription] -> ShowS
$cshowList :: [MonitoringConfigurationDescription] -> ShowS
show :: MonitoringConfigurationDescription -> String
$cshow :: MonitoringConfigurationDescription -> String
showsPrec :: Int -> MonitoringConfigurationDescription -> ShowS
$cshowsPrec :: Int -> MonitoringConfigurationDescription -> ShowS
Prelude.Show, (forall x.
 MonitoringConfigurationDescription
 -> Rep MonitoringConfigurationDescription x)
-> (forall x.
    Rep MonitoringConfigurationDescription x
    -> MonitoringConfigurationDescription)
-> Generic MonitoringConfigurationDescription
forall x.
Rep MonitoringConfigurationDescription x
-> MonitoringConfigurationDescription
forall x.
MonitoringConfigurationDescription
-> Rep MonitoringConfigurationDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MonitoringConfigurationDescription x
-> MonitoringConfigurationDescription
$cfrom :: forall x.
MonitoringConfigurationDescription
-> Rep MonitoringConfigurationDescription x
Prelude.Generic)

-- |
-- Create a value of 'MonitoringConfigurationDescription' 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:
--
-- 'logLevel', 'monitoringConfigurationDescription_logLevel' - Describes the verbosity of the CloudWatch Logs for an application.
--
-- 'configurationType', 'monitoringConfigurationDescription_configurationType' - Describes whether to use the default CloudWatch logging configuration
-- for an application.
--
-- 'metricsLevel', 'monitoringConfigurationDescription_metricsLevel' - Describes the granularity of the CloudWatch Logs for an application.
newMonitoringConfigurationDescription ::
  MonitoringConfigurationDescription
newMonitoringConfigurationDescription :: MonitoringConfigurationDescription
newMonitoringConfigurationDescription =
  MonitoringConfigurationDescription' :: Maybe LogLevel
-> Maybe ConfigurationType
-> Maybe MetricsLevel
-> MonitoringConfigurationDescription
MonitoringConfigurationDescription'
    { $sel:logLevel:MonitoringConfigurationDescription' :: Maybe LogLevel
logLevel =
        Maybe LogLevel
forall a. Maybe a
Prelude.Nothing,
      $sel:configurationType:MonitoringConfigurationDescription' :: Maybe ConfigurationType
configurationType = Maybe ConfigurationType
forall a. Maybe a
Prelude.Nothing,
      $sel:metricsLevel:MonitoringConfigurationDescription' :: Maybe MetricsLevel
metricsLevel = Maybe MetricsLevel
forall a. Maybe a
Prelude.Nothing
    }

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

-- | Describes whether to use the default CloudWatch logging configuration
-- for an application.
monitoringConfigurationDescription_configurationType :: Lens.Lens' MonitoringConfigurationDescription (Prelude.Maybe ConfigurationType)
monitoringConfigurationDescription_configurationType :: (Maybe ConfigurationType -> f (Maybe ConfigurationType))
-> MonitoringConfigurationDescription
-> f MonitoringConfigurationDescription
monitoringConfigurationDescription_configurationType = (MonitoringConfigurationDescription -> Maybe ConfigurationType)
-> (MonitoringConfigurationDescription
    -> Maybe ConfigurationType -> MonitoringConfigurationDescription)
-> Lens
     MonitoringConfigurationDescription
     MonitoringConfigurationDescription
     (Maybe ConfigurationType)
     (Maybe ConfigurationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringConfigurationDescription' {Maybe ConfigurationType
configurationType :: Maybe ConfigurationType
$sel:configurationType:MonitoringConfigurationDescription' :: MonitoringConfigurationDescription -> Maybe ConfigurationType
configurationType} -> Maybe ConfigurationType
configurationType) (\s :: MonitoringConfigurationDescription
s@MonitoringConfigurationDescription' {} Maybe ConfigurationType
a -> MonitoringConfigurationDescription
s {$sel:configurationType:MonitoringConfigurationDescription' :: Maybe ConfigurationType
configurationType = Maybe ConfigurationType
a} :: MonitoringConfigurationDescription)

-- | Describes the granularity of the CloudWatch Logs for an application.
monitoringConfigurationDescription_metricsLevel :: Lens.Lens' MonitoringConfigurationDescription (Prelude.Maybe MetricsLevel)
monitoringConfigurationDescription_metricsLevel :: (Maybe MetricsLevel -> f (Maybe MetricsLevel))
-> MonitoringConfigurationDescription
-> f MonitoringConfigurationDescription
monitoringConfigurationDescription_metricsLevel = (MonitoringConfigurationDescription -> Maybe MetricsLevel)
-> (MonitoringConfigurationDescription
    -> Maybe MetricsLevel -> MonitoringConfigurationDescription)
-> Lens
     MonitoringConfigurationDescription
     MonitoringConfigurationDescription
     (Maybe MetricsLevel)
     (Maybe MetricsLevel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringConfigurationDescription' {Maybe MetricsLevel
metricsLevel :: Maybe MetricsLevel
$sel:metricsLevel:MonitoringConfigurationDescription' :: MonitoringConfigurationDescription -> Maybe MetricsLevel
metricsLevel} -> Maybe MetricsLevel
metricsLevel) (\s :: MonitoringConfigurationDescription
s@MonitoringConfigurationDescription' {} Maybe MetricsLevel
a -> MonitoringConfigurationDescription
s {$sel:metricsLevel:MonitoringConfigurationDescription' :: Maybe MetricsLevel
metricsLevel = Maybe MetricsLevel
a} :: MonitoringConfigurationDescription)

instance
  Core.FromJSON
    MonitoringConfigurationDescription
  where
  parseJSON :: Value -> Parser MonitoringConfigurationDescription
parseJSON =
    String
-> (Object -> Parser MonitoringConfigurationDescription)
-> Value
-> Parser MonitoringConfigurationDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MonitoringConfigurationDescription"
      ( \Object
x ->
          Maybe LogLevel
-> Maybe ConfigurationType
-> Maybe MetricsLevel
-> MonitoringConfigurationDescription
MonitoringConfigurationDescription'
            (Maybe LogLevel
 -> Maybe ConfigurationType
 -> Maybe MetricsLevel
 -> MonitoringConfigurationDescription)
-> Parser (Maybe LogLevel)
-> Parser
     (Maybe ConfigurationType
      -> Maybe MetricsLevel -> MonitoringConfigurationDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe LogLevel)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LogLevel")
            Parser
  (Maybe ConfigurationType
   -> Maybe MetricsLevel -> MonitoringConfigurationDescription)
-> Parser (Maybe ConfigurationType)
-> Parser
     (Maybe MetricsLevel -> MonitoringConfigurationDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ConfigurationType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ConfigurationType")
            Parser (Maybe MetricsLevel -> MonitoringConfigurationDescription)
-> Parser (Maybe MetricsLevel)
-> Parser MonitoringConfigurationDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MetricsLevel)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MetricsLevel")
      )

instance
  Prelude.Hashable
    MonitoringConfigurationDescription

instance
  Prelude.NFData
    MonitoringConfigurationDescription