{-# 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.Kafka.Types.Prometheus
-- 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.Kafka.Types.Prometheus where

import qualified Amazonka.Core as Core
import Amazonka.Kafka.Types.JmxExporter
import Amazonka.Kafka.Types.NodeExporter
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Prometheus settings.
--
-- /See:/ 'newPrometheus' smart constructor.
data Prometheus = Prometheus'
  { -- | Indicates whether you want to enable or disable the JMX Exporter.
    Prometheus -> Maybe JmxExporter
jmxExporter :: Prelude.Maybe JmxExporter,
    -- | Indicates whether you want to enable or disable the Node Exporter.
    Prometheus -> Maybe NodeExporter
nodeExporter :: Prelude.Maybe NodeExporter
  }
  deriving (Prometheus -> Prometheus -> Bool
(Prometheus -> Prometheus -> Bool)
-> (Prometheus -> Prometheus -> Bool) -> Eq Prometheus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Prometheus -> Prometheus -> Bool
$c/= :: Prometheus -> Prometheus -> Bool
== :: Prometheus -> Prometheus -> Bool
$c== :: Prometheus -> Prometheus -> Bool
Prelude.Eq, ReadPrec [Prometheus]
ReadPrec Prometheus
Int -> ReadS Prometheus
ReadS [Prometheus]
(Int -> ReadS Prometheus)
-> ReadS [Prometheus]
-> ReadPrec Prometheus
-> ReadPrec [Prometheus]
-> Read Prometheus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Prometheus]
$creadListPrec :: ReadPrec [Prometheus]
readPrec :: ReadPrec Prometheus
$creadPrec :: ReadPrec Prometheus
readList :: ReadS [Prometheus]
$creadList :: ReadS [Prometheus]
readsPrec :: Int -> ReadS Prometheus
$creadsPrec :: Int -> ReadS Prometheus
Prelude.Read, Int -> Prometheus -> ShowS
[Prometheus] -> ShowS
Prometheus -> String
(Int -> Prometheus -> ShowS)
-> (Prometheus -> String)
-> ([Prometheus] -> ShowS)
-> Show Prometheus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Prometheus] -> ShowS
$cshowList :: [Prometheus] -> ShowS
show :: Prometheus -> String
$cshow :: Prometheus -> String
showsPrec :: Int -> Prometheus -> ShowS
$cshowsPrec :: Int -> Prometheus -> ShowS
Prelude.Show, (forall x. Prometheus -> Rep Prometheus x)
-> (forall x. Rep Prometheus x -> Prometheus) -> Generic Prometheus
forall x. Rep Prometheus x -> Prometheus
forall x. Prometheus -> Rep Prometheus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Prometheus x -> Prometheus
$cfrom :: forall x. Prometheus -> Rep Prometheus x
Prelude.Generic)

-- |
-- Create a value of 'Prometheus' 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:
--
-- 'jmxExporter', 'prometheus_jmxExporter' - Indicates whether you want to enable or disable the JMX Exporter.
--
-- 'nodeExporter', 'prometheus_nodeExporter' - Indicates whether you want to enable or disable the Node Exporter.
newPrometheus ::
  Prometheus
newPrometheus :: Prometheus
newPrometheus =
  Prometheus' :: Maybe JmxExporter -> Maybe NodeExporter -> Prometheus
Prometheus'
    { $sel:jmxExporter:Prometheus' :: Maybe JmxExporter
jmxExporter = Maybe JmxExporter
forall a. Maybe a
Prelude.Nothing,
      $sel:nodeExporter:Prometheus' :: Maybe NodeExporter
nodeExporter = Maybe NodeExporter
forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates whether you want to enable or disable the JMX Exporter.
prometheus_jmxExporter :: Lens.Lens' Prometheus (Prelude.Maybe JmxExporter)
prometheus_jmxExporter :: (Maybe JmxExporter -> f (Maybe JmxExporter))
-> Prometheus -> f Prometheus
prometheus_jmxExporter = (Prometheus -> Maybe JmxExporter)
-> (Prometheus -> Maybe JmxExporter -> Prometheus)
-> Lens
     Prometheus Prometheus (Maybe JmxExporter) (Maybe JmxExporter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Prometheus' {Maybe JmxExporter
jmxExporter :: Maybe JmxExporter
$sel:jmxExporter:Prometheus' :: Prometheus -> Maybe JmxExporter
jmxExporter} -> Maybe JmxExporter
jmxExporter) (\s :: Prometheus
s@Prometheus' {} Maybe JmxExporter
a -> Prometheus
s {$sel:jmxExporter:Prometheus' :: Maybe JmxExporter
jmxExporter = Maybe JmxExporter
a} :: Prometheus)

-- | Indicates whether you want to enable or disable the Node Exporter.
prometheus_nodeExporter :: Lens.Lens' Prometheus (Prelude.Maybe NodeExporter)
prometheus_nodeExporter :: (Maybe NodeExporter -> f (Maybe NodeExporter))
-> Prometheus -> f Prometheus
prometheus_nodeExporter = (Prometheus -> Maybe NodeExporter)
-> (Prometheus -> Maybe NodeExporter -> Prometheus)
-> Lens
     Prometheus Prometheus (Maybe NodeExporter) (Maybe NodeExporter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Prometheus' {Maybe NodeExporter
nodeExporter :: Maybe NodeExporter
$sel:nodeExporter:Prometheus' :: Prometheus -> Maybe NodeExporter
nodeExporter} -> Maybe NodeExporter
nodeExporter) (\s :: Prometheus
s@Prometheus' {} Maybe NodeExporter
a -> Prometheus
s {$sel:nodeExporter:Prometheus' :: Maybe NodeExporter
nodeExporter = Maybe NodeExporter
a} :: Prometheus)

instance Core.FromJSON Prometheus where
  parseJSON :: Value -> Parser Prometheus
parseJSON =
    String
-> (Object -> Parser Prometheus) -> Value -> Parser Prometheus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Prometheus"
      ( \Object
x ->
          Maybe JmxExporter -> Maybe NodeExporter -> Prometheus
Prometheus'
            (Maybe JmxExporter -> Maybe NodeExporter -> Prometheus)
-> Parser (Maybe JmxExporter)
-> Parser (Maybe NodeExporter -> Prometheus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe JmxExporter)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"jmxExporter")
            Parser (Maybe NodeExporter -> Prometheus)
-> Parser (Maybe NodeExporter) -> Parser Prometheus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe NodeExporter)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"nodeExporter")
      )

instance Prelude.Hashable Prometheus

instance Prelude.NFData Prometheus