{-# 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.ElastiCache.Types.PendingLogDeliveryConfiguration
-- 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.ElastiCache.Types.PendingLogDeliveryConfiguration where

import qualified Amazonka.Core as Core
import Amazonka.ElastiCache.Types.DestinationDetails
import Amazonka.ElastiCache.Types.DestinationType
import Amazonka.ElastiCache.Types.LogFormat
import Amazonka.ElastiCache.Types.LogType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The log delivery configurations being modified
--
-- /See:/ 'newPendingLogDeliveryConfiguration' smart constructor.
data PendingLogDeliveryConfiguration = PendingLogDeliveryConfiguration'
  { -- | Returns the log format, either JSON or TEXT
    PendingLogDeliveryConfiguration -> Maybe LogFormat
logFormat :: Prelude.Maybe LogFormat,
    -- | Configuration details of either a CloudWatch Logs destination or Kinesis
    -- Data Firehose destination.
    PendingLogDeliveryConfiguration -> Maybe DestinationDetails
destinationDetails :: Prelude.Maybe DestinationDetails,
    -- | Refers to <https://redis.io/commands/slowlog slow-log>.
    PendingLogDeliveryConfiguration -> Maybe LogType
logType :: Prelude.Maybe LogType,
    -- | Returns the destination type, either CloudWatch Logs or Kinesis Data
    -- Firehose.
    PendingLogDeliveryConfiguration -> Maybe DestinationType
destinationType :: Prelude.Maybe DestinationType
  }
  deriving (PendingLogDeliveryConfiguration
-> PendingLogDeliveryConfiguration -> Bool
(PendingLogDeliveryConfiguration
 -> PendingLogDeliveryConfiguration -> Bool)
-> (PendingLogDeliveryConfiguration
    -> PendingLogDeliveryConfiguration -> Bool)
-> Eq PendingLogDeliveryConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PendingLogDeliveryConfiguration
-> PendingLogDeliveryConfiguration -> Bool
$c/= :: PendingLogDeliveryConfiguration
-> PendingLogDeliveryConfiguration -> Bool
== :: PendingLogDeliveryConfiguration
-> PendingLogDeliveryConfiguration -> Bool
$c== :: PendingLogDeliveryConfiguration
-> PendingLogDeliveryConfiguration -> Bool
Prelude.Eq, ReadPrec [PendingLogDeliveryConfiguration]
ReadPrec PendingLogDeliveryConfiguration
Int -> ReadS PendingLogDeliveryConfiguration
ReadS [PendingLogDeliveryConfiguration]
(Int -> ReadS PendingLogDeliveryConfiguration)
-> ReadS [PendingLogDeliveryConfiguration]
-> ReadPrec PendingLogDeliveryConfiguration
-> ReadPrec [PendingLogDeliveryConfiguration]
-> Read PendingLogDeliveryConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PendingLogDeliveryConfiguration]
$creadListPrec :: ReadPrec [PendingLogDeliveryConfiguration]
readPrec :: ReadPrec PendingLogDeliveryConfiguration
$creadPrec :: ReadPrec PendingLogDeliveryConfiguration
readList :: ReadS [PendingLogDeliveryConfiguration]
$creadList :: ReadS [PendingLogDeliveryConfiguration]
readsPrec :: Int -> ReadS PendingLogDeliveryConfiguration
$creadsPrec :: Int -> ReadS PendingLogDeliveryConfiguration
Prelude.Read, Int -> PendingLogDeliveryConfiguration -> ShowS
[PendingLogDeliveryConfiguration] -> ShowS
PendingLogDeliveryConfiguration -> String
(Int -> PendingLogDeliveryConfiguration -> ShowS)
-> (PendingLogDeliveryConfiguration -> String)
-> ([PendingLogDeliveryConfiguration] -> ShowS)
-> Show PendingLogDeliveryConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PendingLogDeliveryConfiguration] -> ShowS
$cshowList :: [PendingLogDeliveryConfiguration] -> ShowS
show :: PendingLogDeliveryConfiguration -> String
$cshow :: PendingLogDeliveryConfiguration -> String
showsPrec :: Int -> PendingLogDeliveryConfiguration -> ShowS
$cshowsPrec :: Int -> PendingLogDeliveryConfiguration -> ShowS
Prelude.Show, (forall x.
 PendingLogDeliveryConfiguration
 -> Rep PendingLogDeliveryConfiguration x)
-> (forall x.
    Rep PendingLogDeliveryConfiguration x
    -> PendingLogDeliveryConfiguration)
-> Generic PendingLogDeliveryConfiguration
forall x.
Rep PendingLogDeliveryConfiguration x
-> PendingLogDeliveryConfiguration
forall x.
PendingLogDeliveryConfiguration
-> Rep PendingLogDeliveryConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PendingLogDeliveryConfiguration x
-> PendingLogDeliveryConfiguration
$cfrom :: forall x.
PendingLogDeliveryConfiguration
-> Rep PendingLogDeliveryConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'PendingLogDeliveryConfiguration' 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:
--
-- 'logFormat', 'pendingLogDeliveryConfiguration_logFormat' - Returns the log format, either JSON or TEXT
--
-- 'destinationDetails', 'pendingLogDeliveryConfiguration_destinationDetails' - Configuration details of either a CloudWatch Logs destination or Kinesis
-- Data Firehose destination.
--
-- 'logType', 'pendingLogDeliveryConfiguration_logType' - Refers to <https://redis.io/commands/slowlog slow-log>.
--
-- 'destinationType', 'pendingLogDeliveryConfiguration_destinationType' - Returns the destination type, either CloudWatch Logs or Kinesis Data
-- Firehose.
newPendingLogDeliveryConfiguration ::
  PendingLogDeliveryConfiguration
newPendingLogDeliveryConfiguration :: PendingLogDeliveryConfiguration
newPendingLogDeliveryConfiguration =
  PendingLogDeliveryConfiguration' :: Maybe LogFormat
-> Maybe DestinationDetails
-> Maybe LogType
-> Maybe DestinationType
-> PendingLogDeliveryConfiguration
PendingLogDeliveryConfiguration'
    { $sel:logFormat:PendingLogDeliveryConfiguration' :: Maybe LogFormat
logFormat =
        Maybe LogFormat
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationDetails:PendingLogDeliveryConfiguration' :: Maybe DestinationDetails
destinationDetails = Maybe DestinationDetails
forall a. Maybe a
Prelude.Nothing,
      $sel:logType:PendingLogDeliveryConfiguration' :: Maybe LogType
logType = Maybe LogType
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationType:PendingLogDeliveryConfiguration' :: Maybe DestinationType
destinationType = Maybe DestinationType
forall a. Maybe a
Prelude.Nothing
    }

-- | Returns the log format, either JSON or TEXT
pendingLogDeliveryConfiguration_logFormat :: Lens.Lens' PendingLogDeliveryConfiguration (Prelude.Maybe LogFormat)
pendingLogDeliveryConfiguration_logFormat :: (Maybe LogFormat -> f (Maybe LogFormat))
-> PendingLogDeliveryConfiguration
-> f PendingLogDeliveryConfiguration
pendingLogDeliveryConfiguration_logFormat = (PendingLogDeliveryConfiguration -> Maybe LogFormat)
-> (PendingLogDeliveryConfiguration
    -> Maybe LogFormat -> PendingLogDeliveryConfiguration)
-> Lens
     PendingLogDeliveryConfiguration
     PendingLogDeliveryConfiguration
     (Maybe LogFormat)
     (Maybe LogFormat)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PendingLogDeliveryConfiguration' {Maybe LogFormat
logFormat :: Maybe LogFormat
$sel:logFormat:PendingLogDeliveryConfiguration' :: PendingLogDeliveryConfiguration -> Maybe LogFormat
logFormat} -> Maybe LogFormat
logFormat) (\s :: PendingLogDeliveryConfiguration
s@PendingLogDeliveryConfiguration' {} Maybe LogFormat
a -> PendingLogDeliveryConfiguration
s {$sel:logFormat:PendingLogDeliveryConfiguration' :: Maybe LogFormat
logFormat = Maybe LogFormat
a} :: PendingLogDeliveryConfiguration)

-- | Configuration details of either a CloudWatch Logs destination or Kinesis
-- Data Firehose destination.
pendingLogDeliveryConfiguration_destinationDetails :: Lens.Lens' PendingLogDeliveryConfiguration (Prelude.Maybe DestinationDetails)
pendingLogDeliveryConfiguration_destinationDetails :: (Maybe DestinationDetails -> f (Maybe DestinationDetails))
-> PendingLogDeliveryConfiguration
-> f PendingLogDeliveryConfiguration
pendingLogDeliveryConfiguration_destinationDetails = (PendingLogDeliveryConfiguration -> Maybe DestinationDetails)
-> (PendingLogDeliveryConfiguration
    -> Maybe DestinationDetails -> PendingLogDeliveryConfiguration)
-> Lens
     PendingLogDeliveryConfiguration
     PendingLogDeliveryConfiguration
     (Maybe DestinationDetails)
     (Maybe DestinationDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PendingLogDeliveryConfiguration' {Maybe DestinationDetails
destinationDetails :: Maybe DestinationDetails
$sel:destinationDetails:PendingLogDeliveryConfiguration' :: PendingLogDeliveryConfiguration -> Maybe DestinationDetails
destinationDetails} -> Maybe DestinationDetails
destinationDetails) (\s :: PendingLogDeliveryConfiguration
s@PendingLogDeliveryConfiguration' {} Maybe DestinationDetails
a -> PendingLogDeliveryConfiguration
s {$sel:destinationDetails:PendingLogDeliveryConfiguration' :: Maybe DestinationDetails
destinationDetails = Maybe DestinationDetails
a} :: PendingLogDeliveryConfiguration)

-- | Refers to <https://redis.io/commands/slowlog slow-log>.
pendingLogDeliveryConfiguration_logType :: Lens.Lens' PendingLogDeliveryConfiguration (Prelude.Maybe LogType)
pendingLogDeliveryConfiguration_logType :: (Maybe LogType -> f (Maybe LogType))
-> PendingLogDeliveryConfiguration
-> f PendingLogDeliveryConfiguration
pendingLogDeliveryConfiguration_logType = (PendingLogDeliveryConfiguration -> Maybe LogType)
-> (PendingLogDeliveryConfiguration
    -> Maybe LogType -> PendingLogDeliveryConfiguration)
-> Lens
     PendingLogDeliveryConfiguration
     PendingLogDeliveryConfiguration
     (Maybe LogType)
     (Maybe LogType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PendingLogDeliveryConfiguration' {Maybe LogType
logType :: Maybe LogType
$sel:logType:PendingLogDeliveryConfiguration' :: PendingLogDeliveryConfiguration -> Maybe LogType
logType} -> Maybe LogType
logType) (\s :: PendingLogDeliveryConfiguration
s@PendingLogDeliveryConfiguration' {} Maybe LogType
a -> PendingLogDeliveryConfiguration
s {$sel:logType:PendingLogDeliveryConfiguration' :: Maybe LogType
logType = Maybe LogType
a} :: PendingLogDeliveryConfiguration)

-- | Returns the destination type, either CloudWatch Logs or Kinesis Data
-- Firehose.
pendingLogDeliveryConfiguration_destinationType :: Lens.Lens' PendingLogDeliveryConfiguration (Prelude.Maybe DestinationType)
pendingLogDeliveryConfiguration_destinationType :: (Maybe DestinationType -> f (Maybe DestinationType))
-> PendingLogDeliveryConfiguration
-> f PendingLogDeliveryConfiguration
pendingLogDeliveryConfiguration_destinationType = (PendingLogDeliveryConfiguration -> Maybe DestinationType)
-> (PendingLogDeliveryConfiguration
    -> Maybe DestinationType -> PendingLogDeliveryConfiguration)
-> Lens
     PendingLogDeliveryConfiguration
     PendingLogDeliveryConfiguration
     (Maybe DestinationType)
     (Maybe DestinationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PendingLogDeliveryConfiguration' {Maybe DestinationType
destinationType :: Maybe DestinationType
$sel:destinationType:PendingLogDeliveryConfiguration' :: PendingLogDeliveryConfiguration -> Maybe DestinationType
destinationType} -> Maybe DestinationType
destinationType) (\s :: PendingLogDeliveryConfiguration
s@PendingLogDeliveryConfiguration' {} Maybe DestinationType
a -> PendingLogDeliveryConfiguration
s {$sel:destinationType:PendingLogDeliveryConfiguration' :: Maybe DestinationType
destinationType = Maybe DestinationType
a} :: PendingLogDeliveryConfiguration)

instance Core.FromXML PendingLogDeliveryConfiguration where
  parseXML :: [Node] -> Either String PendingLogDeliveryConfiguration
parseXML [Node]
x =
    Maybe LogFormat
-> Maybe DestinationDetails
-> Maybe LogType
-> Maybe DestinationType
-> PendingLogDeliveryConfiguration
PendingLogDeliveryConfiguration'
      (Maybe LogFormat
 -> Maybe DestinationDetails
 -> Maybe LogType
 -> Maybe DestinationType
 -> PendingLogDeliveryConfiguration)
-> Either String (Maybe LogFormat)
-> Either
     String
     (Maybe DestinationDetails
      -> Maybe LogType
      -> Maybe DestinationType
      -> PendingLogDeliveryConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe LogFormat)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"LogFormat")
      Either
  String
  (Maybe DestinationDetails
   -> Maybe LogType
   -> Maybe DestinationType
   -> PendingLogDeliveryConfiguration)
-> Either String (Maybe DestinationDetails)
-> Either
     String
     (Maybe LogType
      -> Maybe DestinationType -> PendingLogDeliveryConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe DestinationDetails)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DestinationDetails")
      Either
  String
  (Maybe LogType
   -> Maybe DestinationType -> PendingLogDeliveryConfiguration)
-> Either String (Maybe LogType)
-> Either
     String (Maybe DestinationType -> PendingLogDeliveryConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe LogType)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"LogType")
      Either
  String (Maybe DestinationType -> PendingLogDeliveryConfiguration)
-> Either String (Maybe DestinationType)
-> Either String PendingLogDeliveryConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe DestinationType)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DestinationType")

instance
  Prelude.Hashable
    PendingLogDeliveryConfiguration

instance
  Prelude.NFData
    PendingLogDeliveryConfiguration