{-# 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.MQ.Types.LogsSummary
-- 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.MQ.Types.LogsSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MQ.Types.PendingLogs
import qualified Amazonka.Prelude as Prelude

-- | The list of information about logs currently enabled and pending to be
-- deployed for the specified broker.
--
-- /See:/ 'newLogsSummary' smart constructor.
data LogsSummary = LogsSummary'
  { -- | The list of information about logs pending to be deployed for the
    -- specified broker.
    LogsSummary -> Maybe PendingLogs
pending :: Prelude.Maybe PendingLogs,
    -- | Enables audit logging. Every user management action made using JMX or
    -- the ActiveMQ Web Console is logged.
    LogsSummary -> Maybe Bool
audit :: Prelude.Maybe Prelude.Bool,
    -- | The location of the CloudWatch Logs log group where audit logs are sent.
    LogsSummary -> Maybe Text
auditLogGroup :: Prelude.Maybe Prelude.Text,
    -- | The location of the CloudWatch Logs log group where general logs are
    -- sent.
    LogsSummary -> Text
generalLogGroup :: Prelude.Text,
    -- | Enables general logging.
    LogsSummary -> Bool
general :: Prelude.Bool
  }
  deriving (LogsSummary -> LogsSummary -> Bool
(LogsSummary -> LogsSummary -> Bool)
-> (LogsSummary -> LogsSummary -> Bool) -> Eq LogsSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LogsSummary -> LogsSummary -> Bool
$c/= :: LogsSummary -> LogsSummary -> Bool
== :: LogsSummary -> LogsSummary -> Bool
$c== :: LogsSummary -> LogsSummary -> Bool
Prelude.Eq, ReadPrec [LogsSummary]
ReadPrec LogsSummary
Int -> ReadS LogsSummary
ReadS [LogsSummary]
(Int -> ReadS LogsSummary)
-> ReadS [LogsSummary]
-> ReadPrec LogsSummary
-> ReadPrec [LogsSummary]
-> Read LogsSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LogsSummary]
$creadListPrec :: ReadPrec [LogsSummary]
readPrec :: ReadPrec LogsSummary
$creadPrec :: ReadPrec LogsSummary
readList :: ReadS [LogsSummary]
$creadList :: ReadS [LogsSummary]
readsPrec :: Int -> ReadS LogsSummary
$creadsPrec :: Int -> ReadS LogsSummary
Prelude.Read, Int -> LogsSummary -> ShowS
[LogsSummary] -> ShowS
LogsSummary -> String
(Int -> LogsSummary -> ShowS)
-> (LogsSummary -> String)
-> ([LogsSummary] -> ShowS)
-> Show LogsSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LogsSummary] -> ShowS
$cshowList :: [LogsSummary] -> ShowS
show :: LogsSummary -> String
$cshow :: LogsSummary -> String
showsPrec :: Int -> LogsSummary -> ShowS
$cshowsPrec :: Int -> LogsSummary -> ShowS
Prelude.Show, (forall x. LogsSummary -> Rep LogsSummary x)
-> (forall x. Rep LogsSummary x -> LogsSummary)
-> Generic LogsSummary
forall x. Rep LogsSummary x -> LogsSummary
forall x. LogsSummary -> Rep LogsSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LogsSummary x -> LogsSummary
$cfrom :: forall x. LogsSummary -> Rep LogsSummary x
Prelude.Generic)

-- |
-- Create a value of 'LogsSummary' 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:
--
-- 'pending', 'logsSummary_pending' - The list of information about logs pending to be deployed for the
-- specified broker.
--
-- 'audit', 'logsSummary_audit' - Enables audit logging. Every user management action made using JMX or
-- the ActiveMQ Web Console is logged.
--
-- 'auditLogGroup', 'logsSummary_auditLogGroup' - The location of the CloudWatch Logs log group where audit logs are sent.
--
-- 'generalLogGroup', 'logsSummary_generalLogGroup' - The location of the CloudWatch Logs log group where general logs are
-- sent.
--
-- 'general', 'logsSummary_general' - Enables general logging.
newLogsSummary ::
  -- | 'generalLogGroup'
  Prelude.Text ->
  -- | 'general'
  Prelude.Bool ->
  LogsSummary
newLogsSummary :: Text -> Bool -> LogsSummary
newLogsSummary Text
pGeneralLogGroup_ Bool
pGeneral_ =
  LogsSummary' :: Maybe PendingLogs
-> Maybe Bool -> Maybe Text -> Text -> Bool -> LogsSummary
LogsSummary'
    { $sel:pending:LogsSummary' :: Maybe PendingLogs
pending = Maybe PendingLogs
forall a. Maybe a
Prelude.Nothing,
      $sel:audit:LogsSummary' :: Maybe Bool
audit = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:auditLogGroup:LogsSummary' :: Maybe Text
auditLogGroup = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:generalLogGroup:LogsSummary' :: Text
generalLogGroup = Text
pGeneralLogGroup_,
      $sel:general:LogsSummary' :: Bool
general = Bool
pGeneral_
    }

-- | The list of information about logs pending to be deployed for the
-- specified broker.
logsSummary_pending :: Lens.Lens' LogsSummary (Prelude.Maybe PendingLogs)
logsSummary_pending :: (Maybe PendingLogs -> f (Maybe PendingLogs))
-> LogsSummary -> f LogsSummary
logsSummary_pending = (LogsSummary -> Maybe PendingLogs)
-> (LogsSummary -> Maybe PendingLogs -> LogsSummary)
-> Lens
     LogsSummary LogsSummary (Maybe PendingLogs) (Maybe PendingLogs)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogsSummary' {Maybe PendingLogs
pending :: Maybe PendingLogs
$sel:pending:LogsSummary' :: LogsSummary -> Maybe PendingLogs
pending} -> Maybe PendingLogs
pending) (\s :: LogsSummary
s@LogsSummary' {} Maybe PendingLogs
a -> LogsSummary
s {$sel:pending:LogsSummary' :: Maybe PendingLogs
pending = Maybe PendingLogs
a} :: LogsSummary)

-- | Enables audit logging. Every user management action made using JMX or
-- the ActiveMQ Web Console is logged.
logsSummary_audit :: Lens.Lens' LogsSummary (Prelude.Maybe Prelude.Bool)
logsSummary_audit :: (Maybe Bool -> f (Maybe Bool)) -> LogsSummary -> f LogsSummary
logsSummary_audit = (LogsSummary -> Maybe Bool)
-> (LogsSummary -> Maybe Bool -> LogsSummary)
-> Lens LogsSummary LogsSummary (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogsSummary' {Maybe Bool
audit :: Maybe Bool
$sel:audit:LogsSummary' :: LogsSummary -> Maybe Bool
audit} -> Maybe Bool
audit) (\s :: LogsSummary
s@LogsSummary' {} Maybe Bool
a -> LogsSummary
s {$sel:audit:LogsSummary' :: Maybe Bool
audit = Maybe Bool
a} :: LogsSummary)

-- | The location of the CloudWatch Logs log group where audit logs are sent.
logsSummary_auditLogGroup :: Lens.Lens' LogsSummary (Prelude.Maybe Prelude.Text)
logsSummary_auditLogGroup :: (Maybe Text -> f (Maybe Text)) -> LogsSummary -> f LogsSummary
logsSummary_auditLogGroup = (LogsSummary -> Maybe Text)
-> (LogsSummary -> Maybe Text -> LogsSummary)
-> Lens LogsSummary LogsSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogsSummary' {Maybe Text
auditLogGroup :: Maybe Text
$sel:auditLogGroup:LogsSummary' :: LogsSummary -> Maybe Text
auditLogGroup} -> Maybe Text
auditLogGroup) (\s :: LogsSummary
s@LogsSummary' {} Maybe Text
a -> LogsSummary
s {$sel:auditLogGroup:LogsSummary' :: Maybe Text
auditLogGroup = Maybe Text
a} :: LogsSummary)

-- | The location of the CloudWatch Logs log group where general logs are
-- sent.
logsSummary_generalLogGroup :: Lens.Lens' LogsSummary Prelude.Text
logsSummary_generalLogGroup :: (Text -> f Text) -> LogsSummary -> f LogsSummary
logsSummary_generalLogGroup = (LogsSummary -> Text)
-> (LogsSummary -> Text -> LogsSummary)
-> Lens LogsSummary LogsSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogsSummary' {Text
generalLogGroup :: Text
$sel:generalLogGroup:LogsSummary' :: LogsSummary -> Text
generalLogGroup} -> Text
generalLogGroup) (\s :: LogsSummary
s@LogsSummary' {} Text
a -> LogsSummary
s {$sel:generalLogGroup:LogsSummary' :: Text
generalLogGroup = Text
a} :: LogsSummary)

-- | Enables general logging.
logsSummary_general :: Lens.Lens' LogsSummary Prelude.Bool
logsSummary_general :: (Bool -> f Bool) -> LogsSummary -> f LogsSummary
logsSummary_general = (LogsSummary -> Bool)
-> (LogsSummary -> Bool -> LogsSummary)
-> Lens LogsSummary LogsSummary Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogsSummary' {Bool
general :: Bool
$sel:general:LogsSummary' :: LogsSummary -> Bool
general} -> Bool
general) (\s :: LogsSummary
s@LogsSummary' {} Bool
a -> LogsSummary
s {$sel:general:LogsSummary' :: Bool
general = Bool
a} :: LogsSummary)

instance Core.FromJSON LogsSummary where
  parseJSON :: Value -> Parser LogsSummary
parseJSON =
    String
-> (Object -> Parser LogsSummary) -> Value -> Parser LogsSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LogsSummary"
      ( \Object
x ->
          Maybe PendingLogs
-> Maybe Bool -> Maybe Text -> Text -> Bool -> LogsSummary
LogsSummary'
            (Maybe PendingLogs
 -> Maybe Bool -> Maybe Text -> Text -> Bool -> LogsSummary)
-> Parser (Maybe PendingLogs)
-> Parser (Maybe Bool -> Maybe Text -> Text -> Bool -> LogsSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe PendingLogs)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"pending")
            Parser (Maybe Bool -> Maybe Text -> Text -> Bool -> LogsSummary)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> Text -> Bool -> LogsSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"audit")
            Parser (Maybe Text -> Text -> Bool -> LogsSummary)
-> Parser (Maybe Text) -> Parser (Text -> Bool -> LogsSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"auditLogGroup")
            Parser (Text -> Bool -> LogsSummary)
-> Parser Text -> Parser (Bool -> LogsSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"generalLogGroup")
            Parser (Bool -> LogsSummary) -> Parser Bool -> Parser LogsSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"general")
      )

instance Prelude.Hashable LogsSummary

instance Prelude.NFData LogsSummary