{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Kafka.Types.Prometheus where

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

-- | Prometheus settings.
--
-- /See:/ 'newPrometheus' smart constructor.
data Prometheus = Prometheus'
  { -- | Indicates whether you want to turn on or turn off the JMX Exporter.
    Prometheus -> Maybe JmxExporter
jmxExporter :: Prelude.Maybe JmxExporter,
    -- | Indicates whether you want to turn on or turn off the Node Exporter.
    Prometheus -> Maybe NodeExporter
nodeExporter :: Prelude.Maybe NodeExporter
  }
  deriving (Prometheus -> Prometheus -> Bool
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]
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
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. 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 turn on or turn off the JMX Exporter.
--
-- 'nodeExporter', 'prometheus_nodeExporter' - Indicates whether you want to turn on or turn off the Node Exporter.
newPrometheus ::
  Prometheus
newPrometheus :: Prometheus
newPrometheus =
  Prometheus'
    { $sel:jmxExporter:Prometheus' :: Maybe JmxExporter
jmxExporter = forall a. Maybe a
Prelude.Nothing,
      $sel:nodeExporter:Prometheus' :: Maybe NodeExporter
nodeExporter = forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates whether you want to turn on or turn off the JMX Exporter.
prometheus_jmxExporter :: Lens.Lens' Prometheus (Prelude.Maybe JmxExporter)
prometheus_jmxExporter :: Lens' Prometheus (Maybe JmxExporter)
prometheus_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 turn on or turn off the Node Exporter.
prometheus_nodeExporter :: Lens.Lens' Prometheus (Prelude.Maybe NodeExporter)
prometheus_nodeExporter :: Lens' Prometheus (Maybe NodeExporter)
prometheus_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 Data.FromJSON Prometheus where
  parseJSON :: Value -> Parser Prometheus
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Prometheus"
      ( \Object
x ->
          Maybe JmxExporter -> Maybe NodeExporter -> Prometheus
Prometheus'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"jmxExporter")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"nodeExporter")
      )

instance Prelude.Hashable Prometheus where
  hashWithSalt :: Int -> Prometheus -> Int
hashWithSalt Int
_salt Prometheus' {Maybe JmxExporter
Maybe NodeExporter
nodeExporter :: Maybe NodeExporter
jmxExporter :: Maybe JmxExporter
$sel:nodeExporter:Prometheus' :: Prometheus -> Maybe NodeExporter
$sel:jmxExporter:Prometheus' :: Prometheus -> Maybe JmxExporter
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe JmxExporter
jmxExporter
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NodeExporter
nodeExporter

instance Prelude.NFData Prometheus where
  rnf :: Prometheus -> ()
rnf Prometheus' {Maybe JmxExporter
Maybe NodeExporter
nodeExporter :: Maybe NodeExporter
jmxExporter :: Maybe JmxExporter
$sel:nodeExporter:Prometheus' :: Prometheus -> Maybe NodeExporter
$sel:jmxExporter:Prometheus' :: Prometheus -> Maybe JmxExporter
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe JmxExporter
jmxExporter
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe NodeExporter
nodeExporter