{-# 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.EMRContainers.Types.MonitoringConfiguration
-- 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.EMRContainers.Types.MonitoringConfiguration where

import qualified Amazonka.Core as Core
import Amazonka.EMRContainers.Types.CloudWatchMonitoringConfiguration
import Amazonka.EMRContainers.Types.PersistentAppUI
import Amazonka.EMRContainers.Types.S3MonitoringConfiguration
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Configuration setting for monitoring.
--
-- /See:/ 'newMonitoringConfiguration' smart constructor.
data MonitoringConfiguration = MonitoringConfiguration'
  { -- | Monitoring configurations for the persistent application UI.
    MonitoringConfiguration -> Maybe PersistentAppUI
persistentAppUI :: Prelude.Maybe PersistentAppUI,
    -- | Amazon S3 configuration for monitoring log publishing.
    MonitoringConfiguration -> Maybe S3MonitoringConfiguration
s3MonitoringConfiguration :: Prelude.Maybe S3MonitoringConfiguration,
    -- | Monitoring configurations for CloudWatch.
    MonitoringConfiguration -> Maybe CloudWatchMonitoringConfiguration
cloudWatchMonitoringConfiguration :: Prelude.Maybe CloudWatchMonitoringConfiguration
  }
  deriving (MonitoringConfiguration -> MonitoringConfiguration -> Bool
(MonitoringConfiguration -> MonitoringConfiguration -> Bool)
-> (MonitoringConfiguration -> MonitoringConfiguration -> Bool)
-> Eq MonitoringConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MonitoringConfiguration -> MonitoringConfiguration -> Bool
$c/= :: MonitoringConfiguration -> MonitoringConfiguration -> Bool
== :: MonitoringConfiguration -> MonitoringConfiguration -> Bool
$c== :: MonitoringConfiguration -> MonitoringConfiguration -> Bool
Prelude.Eq, ReadPrec [MonitoringConfiguration]
ReadPrec MonitoringConfiguration
Int -> ReadS MonitoringConfiguration
ReadS [MonitoringConfiguration]
(Int -> ReadS MonitoringConfiguration)
-> ReadS [MonitoringConfiguration]
-> ReadPrec MonitoringConfiguration
-> ReadPrec [MonitoringConfiguration]
-> Read MonitoringConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MonitoringConfiguration]
$creadListPrec :: ReadPrec [MonitoringConfiguration]
readPrec :: ReadPrec MonitoringConfiguration
$creadPrec :: ReadPrec MonitoringConfiguration
readList :: ReadS [MonitoringConfiguration]
$creadList :: ReadS [MonitoringConfiguration]
readsPrec :: Int -> ReadS MonitoringConfiguration
$creadsPrec :: Int -> ReadS MonitoringConfiguration
Prelude.Read, Int -> MonitoringConfiguration -> ShowS
[MonitoringConfiguration] -> ShowS
MonitoringConfiguration -> String
(Int -> MonitoringConfiguration -> ShowS)
-> (MonitoringConfiguration -> String)
-> ([MonitoringConfiguration] -> ShowS)
-> Show MonitoringConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MonitoringConfiguration] -> ShowS
$cshowList :: [MonitoringConfiguration] -> ShowS
show :: MonitoringConfiguration -> String
$cshow :: MonitoringConfiguration -> String
showsPrec :: Int -> MonitoringConfiguration -> ShowS
$cshowsPrec :: Int -> MonitoringConfiguration -> ShowS
Prelude.Show, (forall x.
 MonitoringConfiguration -> Rep MonitoringConfiguration x)
-> (forall x.
    Rep MonitoringConfiguration x -> MonitoringConfiguration)
-> Generic MonitoringConfiguration
forall x. Rep MonitoringConfiguration x -> MonitoringConfiguration
forall x. MonitoringConfiguration -> Rep MonitoringConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MonitoringConfiguration x -> MonitoringConfiguration
$cfrom :: forall x. MonitoringConfiguration -> Rep MonitoringConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'MonitoringConfiguration' 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:
--
-- 'persistentAppUI', 'monitoringConfiguration_persistentAppUI' - Monitoring configurations for the persistent application UI.
--
-- 's3MonitoringConfiguration', 'monitoringConfiguration_s3MonitoringConfiguration' - Amazon S3 configuration for monitoring log publishing.
--
-- 'cloudWatchMonitoringConfiguration', 'monitoringConfiguration_cloudWatchMonitoringConfiguration' - Monitoring configurations for CloudWatch.
newMonitoringConfiguration ::
  MonitoringConfiguration
newMonitoringConfiguration :: MonitoringConfiguration
newMonitoringConfiguration =
  MonitoringConfiguration' :: Maybe PersistentAppUI
-> Maybe S3MonitoringConfiguration
-> Maybe CloudWatchMonitoringConfiguration
-> MonitoringConfiguration
MonitoringConfiguration'
    { $sel:persistentAppUI:MonitoringConfiguration' :: Maybe PersistentAppUI
persistentAppUI =
        Maybe PersistentAppUI
forall a. Maybe a
Prelude.Nothing,
      $sel:s3MonitoringConfiguration:MonitoringConfiguration' :: Maybe S3MonitoringConfiguration
s3MonitoringConfiguration = Maybe S3MonitoringConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:cloudWatchMonitoringConfiguration:MonitoringConfiguration' :: Maybe CloudWatchMonitoringConfiguration
cloudWatchMonitoringConfiguration =
        Maybe CloudWatchMonitoringConfiguration
forall a. Maybe a
Prelude.Nothing
    }

-- | Monitoring configurations for the persistent application UI.
monitoringConfiguration_persistentAppUI :: Lens.Lens' MonitoringConfiguration (Prelude.Maybe PersistentAppUI)
monitoringConfiguration_persistentAppUI :: (Maybe PersistentAppUI -> f (Maybe PersistentAppUI))
-> MonitoringConfiguration -> f MonitoringConfiguration
monitoringConfiguration_persistentAppUI = (MonitoringConfiguration -> Maybe PersistentAppUI)
-> (MonitoringConfiguration
    -> Maybe PersistentAppUI -> MonitoringConfiguration)
-> Lens
     MonitoringConfiguration
     MonitoringConfiguration
     (Maybe PersistentAppUI)
     (Maybe PersistentAppUI)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringConfiguration' {Maybe PersistentAppUI
persistentAppUI :: Maybe PersistentAppUI
$sel:persistentAppUI:MonitoringConfiguration' :: MonitoringConfiguration -> Maybe PersistentAppUI
persistentAppUI} -> Maybe PersistentAppUI
persistentAppUI) (\s :: MonitoringConfiguration
s@MonitoringConfiguration' {} Maybe PersistentAppUI
a -> MonitoringConfiguration
s {$sel:persistentAppUI:MonitoringConfiguration' :: Maybe PersistentAppUI
persistentAppUI = Maybe PersistentAppUI
a} :: MonitoringConfiguration)

-- | Amazon S3 configuration for monitoring log publishing.
monitoringConfiguration_s3MonitoringConfiguration :: Lens.Lens' MonitoringConfiguration (Prelude.Maybe S3MonitoringConfiguration)
monitoringConfiguration_s3MonitoringConfiguration :: (Maybe S3MonitoringConfiguration
 -> f (Maybe S3MonitoringConfiguration))
-> MonitoringConfiguration -> f MonitoringConfiguration
monitoringConfiguration_s3MonitoringConfiguration = (MonitoringConfiguration -> Maybe S3MonitoringConfiguration)
-> (MonitoringConfiguration
    -> Maybe S3MonitoringConfiguration -> MonitoringConfiguration)
-> Lens
     MonitoringConfiguration
     MonitoringConfiguration
     (Maybe S3MonitoringConfiguration)
     (Maybe S3MonitoringConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringConfiguration' {Maybe S3MonitoringConfiguration
s3MonitoringConfiguration :: Maybe S3MonitoringConfiguration
$sel:s3MonitoringConfiguration:MonitoringConfiguration' :: MonitoringConfiguration -> Maybe S3MonitoringConfiguration
s3MonitoringConfiguration} -> Maybe S3MonitoringConfiguration
s3MonitoringConfiguration) (\s :: MonitoringConfiguration
s@MonitoringConfiguration' {} Maybe S3MonitoringConfiguration
a -> MonitoringConfiguration
s {$sel:s3MonitoringConfiguration:MonitoringConfiguration' :: Maybe S3MonitoringConfiguration
s3MonitoringConfiguration = Maybe S3MonitoringConfiguration
a} :: MonitoringConfiguration)

-- | Monitoring configurations for CloudWatch.
monitoringConfiguration_cloudWatchMonitoringConfiguration :: Lens.Lens' MonitoringConfiguration (Prelude.Maybe CloudWatchMonitoringConfiguration)
monitoringConfiguration_cloudWatchMonitoringConfiguration :: (Maybe CloudWatchMonitoringConfiguration
 -> f (Maybe CloudWatchMonitoringConfiguration))
-> MonitoringConfiguration -> f MonitoringConfiguration
monitoringConfiguration_cloudWatchMonitoringConfiguration = (MonitoringConfiguration
 -> Maybe CloudWatchMonitoringConfiguration)
-> (MonitoringConfiguration
    -> Maybe CloudWatchMonitoringConfiguration
    -> MonitoringConfiguration)
-> Lens
     MonitoringConfiguration
     MonitoringConfiguration
     (Maybe CloudWatchMonitoringConfiguration)
     (Maybe CloudWatchMonitoringConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringConfiguration' {Maybe CloudWatchMonitoringConfiguration
cloudWatchMonitoringConfiguration :: Maybe CloudWatchMonitoringConfiguration
$sel:cloudWatchMonitoringConfiguration:MonitoringConfiguration' :: MonitoringConfiguration -> Maybe CloudWatchMonitoringConfiguration
cloudWatchMonitoringConfiguration} -> Maybe CloudWatchMonitoringConfiguration
cloudWatchMonitoringConfiguration) (\s :: MonitoringConfiguration
s@MonitoringConfiguration' {} Maybe CloudWatchMonitoringConfiguration
a -> MonitoringConfiguration
s {$sel:cloudWatchMonitoringConfiguration:MonitoringConfiguration' :: Maybe CloudWatchMonitoringConfiguration
cloudWatchMonitoringConfiguration = Maybe CloudWatchMonitoringConfiguration
a} :: MonitoringConfiguration)

instance Core.FromJSON MonitoringConfiguration where
  parseJSON :: Value -> Parser MonitoringConfiguration
parseJSON =
    String
-> (Object -> Parser MonitoringConfiguration)
-> Value
-> Parser MonitoringConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MonitoringConfiguration"
      ( \Object
x ->
          Maybe PersistentAppUI
-> Maybe S3MonitoringConfiguration
-> Maybe CloudWatchMonitoringConfiguration
-> MonitoringConfiguration
MonitoringConfiguration'
            (Maybe PersistentAppUI
 -> Maybe S3MonitoringConfiguration
 -> Maybe CloudWatchMonitoringConfiguration
 -> MonitoringConfiguration)
-> Parser (Maybe PersistentAppUI)
-> Parser
     (Maybe S3MonitoringConfiguration
      -> Maybe CloudWatchMonitoringConfiguration
      -> MonitoringConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe PersistentAppUI)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"persistentAppUI")
            Parser
  (Maybe S3MonitoringConfiguration
   -> Maybe CloudWatchMonitoringConfiguration
   -> MonitoringConfiguration)
-> Parser (Maybe S3MonitoringConfiguration)
-> Parser
     (Maybe CloudWatchMonitoringConfiguration
      -> MonitoringConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe S3MonitoringConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"s3MonitoringConfiguration")
            Parser
  (Maybe CloudWatchMonitoringConfiguration
   -> MonitoringConfiguration)
-> Parser (Maybe CloudWatchMonitoringConfiguration)
-> Parser MonitoringConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CloudWatchMonitoringConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"cloudWatchMonitoringConfiguration")
      )

instance Prelude.Hashable MonitoringConfiguration

instance Prelude.NFData MonitoringConfiguration

instance Core.ToJSON MonitoringConfiguration where
  toJSON :: MonitoringConfiguration -> Value
toJSON MonitoringConfiguration' {Maybe CloudWatchMonitoringConfiguration
Maybe PersistentAppUI
Maybe S3MonitoringConfiguration
cloudWatchMonitoringConfiguration :: Maybe CloudWatchMonitoringConfiguration
s3MonitoringConfiguration :: Maybe S3MonitoringConfiguration
persistentAppUI :: Maybe PersistentAppUI
$sel:cloudWatchMonitoringConfiguration:MonitoringConfiguration' :: MonitoringConfiguration -> Maybe CloudWatchMonitoringConfiguration
$sel:s3MonitoringConfiguration:MonitoringConfiguration' :: MonitoringConfiguration -> Maybe S3MonitoringConfiguration
$sel:persistentAppUI:MonitoringConfiguration' :: MonitoringConfiguration -> Maybe PersistentAppUI
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"persistentAppUI" Text -> PersistentAppUI -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (PersistentAppUI -> Pair) -> Maybe PersistentAppUI -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PersistentAppUI
persistentAppUI,
            (Text
"s3MonitoringConfiguration" Text -> S3MonitoringConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (S3MonitoringConfiguration -> Pair)
-> Maybe S3MonitoringConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3MonitoringConfiguration
s3MonitoringConfiguration,
            (Text
"cloudWatchMonitoringConfiguration" Text -> CloudWatchMonitoringConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CloudWatchMonitoringConfiguration -> Pair)
-> Maybe CloudWatchMonitoringConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CloudWatchMonitoringConfiguration
cloudWatchMonitoringConfiguration
          ]
      )