{-# 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.LogDeliveryConfigurationRequest
-- 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.LogDeliveryConfigurationRequest 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

-- | Specifies the destination, format and type of the logs.
--
-- /See:/ 'newLogDeliveryConfigurationRequest' smart constructor.
data LogDeliveryConfigurationRequest = LogDeliveryConfigurationRequest'
  { -- | Specifies either JSON or TEXT
    LogDeliveryConfigurationRequest -> Maybe LogFormat
logFormat :: Prelude.Maybe LogFormat,
    -- | Specify if log delivery is enabled. Default @true@.
    LogDeliveryConfigurationRequest -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | Configuration details of either a CloudWatch Logs destination or Kinesis
    -- Data Firehose destination.
    LogDeliveryConfigurationRequest -> Maybe DestinationDetails
destinationDetails :: Prelude.Maybe DestinationDetails,
    -- | Refers to <https://redis.io/commands/slowlog slow-log>.
    LogDeliveryConfigurationRequest -> Maybe LogType
logType :: Prelude.Maybe LogType,
    -- | Specify either @cloudwatch-logs@ or @kinesis-firehose@ as the
    -- destination type.
    LogDeliveryConfigurationRequest -> Maybe DestinationType
destinationType :: Prelude.Maybe DestinationType
  }
  deriving (LogDeliveryConfigurationRequest
-> LogDeliveryConfigurationRequest -> Bool
(LogDeliveryConfigurationRequest
 -> LogDeliveryConfigurationRequest -> Bool)
-> (LogDeliveryConfigurationRequest
    -> LogDeliveryConfigurationRequest -> Bool)
-> Eq LogDeliveryConfigurationRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LogDeliveryConfigurationRequest
-> LogDeliveryConfigurationRequest -> Bool
$c/= :: LogDeliveryConfigurationRequest
-> LogDeliveryConfigurationRequest -> Bool
== :: LogDeliveryConfigurationRequest
-> LogDeliveryConfigurationRequest -> Bool
$c== :: LogDeliveryConfigurationRequest
-> LogDeliveryConfigurationRequest -> Bool
Prelude.Eq, ReadPrec [LogDeliveryConfigurationRequest]
ReadPrec LogDeliveryConfigurationRequest
Int -> ReadS LogDeliveryConfigurationRequest
ReadS [LogDeliveryConfigurationRequest]
(Int -> ReadS LogDeliveryConfigurationRequest)
-> ReadS [LogDeliveryConfigurationRequest]
-> ReadPrec LogDeliveryConfigurationRequest
-> ReadPrec [LogDeliveryConfigurationRequest]
-> Read LogDeliveryConfigurationRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LogDeliveryConfigurationRequest]
$creadListPrec :: ReadPrec [LogDeliveryConfigurationRequest]
readPrec :: ReadPrec LogDeliveryConfigurationRequest
$creadPrec :: ReadPrec LogDeliveryConfigurationRequest
readList :: ReadS [LogDeliveryConfigurationRequest]
$creadList :: ReadS [LogDeliveryConfigurationRequest]
readsPrec :: Int -> ReadS LogDeliveryConfigurationRequest
$creadsPrec :: Int -> ReadS LogDeliveryConfigurationRequest
Prelude.Read, Int -> LogDeliveryConfigurationRequest -> ShowS
[LogDeliveryConfigurationRequest] -> ShowS
LogDeliveryConfigurationRequest -> String
(Int -> LogDeliveryConfigurationRequest -> ShowS)
-> (LogDeliveryConfigurationRequest -> String)
-> ([LogDeliveryConfigurationRequest] -> ShowS)
-> Show LogDeliveryConfigurationRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LogDeliveryConfigurationRequest] -> ShowS
$cshowList :: [LogDeliveryConfigurationRequest] -> ShowS
show :: LogDeliveryConfigurationRequest -> String
$cshow :: LogDeliveryConfigurationRequest -> String
showsPrec :: Int -> LogDeliveryConfigurationRequest -> ShowS
$cshowsPrec :: Int -> LogDeliveryConfigurationRequest -> ShowS
Prelude.Show, (forall x.
 LogDeliveryConfigurationRequest
 -> Rep LogDeliveryConfigurationRequest x)
-> (forall x.
    Rep LogDeliveryConfigurationRequest x
    -> LogDeliveryConfigurationRequest)
-> Generic LogDeliveryConfigurationRequest
forall x.
Rep LogDeliveryConfigurationRequest x
-> LogDeliveryConfigurationRequest
forall x.
LogDeliveryConfigurationRequest
-> Rep LogDeliveryConfigurationRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LogDeliveryConfigurationRequest x
-> LogDeliveryConfigurationRequest
$cfrom :: forall x.
LogDeliveryConfigurationRequest
-> Rep LogDeliveryConfigurationRequest x
Prelude.Generic)

-- |
-- Create a value of 'LogDeliveryConfigurationRequest' 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', 'logDeliveryConfigurationRequest_logFormat' - Specifies either JSON or TEXT
--
-- 'enabled', 'logDeliveryConfigurationRequest_enabled' - Specify if log delivery is enabled. Default @true@.
--
-- 'destinationDetails', 'logDeliveryConfigurationRequest_destinationDetails' - Configuration details of either a CloudWatch Logs destination or Kinesis
-- Data Firehose destination.
--
-- 'logType', 'logDeliveryConfigurationRequest_logType' - Refers to <https://redis.io/commands/slowlog slow-log>.
--
-- 'destinationType', 'logDeliveryConfigurationRequest_destinationType' - Specify either @cloudwatch-logs@ or @kinesis-firehose@ as the
-- destination type.
newLogDeliveryConfigurationRequest ::
  LogDeliveryConfigurationRequest
newLogDeliveryConfigurationRequest :: LogDeliveryConfigurationRequest
newLogDeliveryConfigurationRequest =
  LogDeliveryConfigurationRequest' :: Maybe LogFormat
-> Maybe Bool
-> Maybe DestinationDetails
-> Maybe LogType
-> Maybe DestinationType
-> LogDeliveryConfigurationRequest
LogDeliveryConfigurationRequest'
    { $sel:logFormat:LogDeliveryConfigurationRequest' :: Maybe LogFormat
logFormat =
        Maybe LogFormat
forall a. Maybe a
Prelude.Nothing,
      $sel:enabled:LogDeliveryConfigurationRequest' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationDetails:LogDeliveryConfigurationRequest' :: Maybe DestinationDetails
destinationDetails = Maybe DestinationDetails
forall a. Maybe a
Prelude.Nothing,
      $sel:logType:LogDeliveryConfigurationRequest' :: Maybe LogType
logType = Maybe LogType
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationType:LogDeliveryConfigurationRequest' :: Maybe DestinationType
destinationType = Maybe DestinationType
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies either JSON or TEXT
logDeliveryConfigurationRequest_logFormat :: Lens.Lens' LogDeliveryConfigurationRequest (Prelude.Maybe LogFormat)
logDeliveryConfigurationRequest_logFormat :: (Maybe LogFormat -> f (Maybe LogFormat))
-> LogDeliveryConfigurationRequest
-> f LogDeliveryConfigurationRequest
logDeliveryConfigurationRequest_logFormat = (LogDeliveryConfigurationRequest -> Maybe LogFormat)
-> (LogDeliveryConfigurationRequest
    -> Maybe LogFormat -> LogDeliveryConfigurationRequest)
-> Lens
     LogDeliveryConfigurationRequest
     LogDeliveryConfigurationRequest
     (Maybe LogFormat)
     (Maybe LogFormat)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogDeliveryConfigurationRequest' {Maybe LogFormat
logFormat :: Maybe LogFormat
$sel:logFormat:LogDeliveryConfigurationRequest' :: LogDeliveryConfigurationRequest -> Maybe LogFormat
logFormat} -> Maybe LogFormat
logFormat) (\s :: LogDeliveryConfigurationRequest
s@LogDeliveryConfigurationRequest' {} Maybe LogFormat
a -> LogDeliveryConfigurationRequest
s {$sel:logFormat:LogDeliveryConfigurationRequest' :: Maybe LogFormat
logFormat = Maybe LogFormat
a} :: LogDeliveryConfigurationRequest)

-- | Specify if log delivery is enabled. Default @true@.
logDeliveryConfigurationRequest_enabled :: Lens.Lens' LogDeliveryConfigurationRequest (Prelude.Maybe Prelude.Bool)
logDeliveryConfigurationRequest_enabled :: (Maybe Bool -> f (Maybe Bool))
-> LogDeliveryConfigurationRequest
-> f LogDeliveryConfigurationRequest
logDeliveryConfigurationRequest_enabled = (LogDeliveryConfigurationRequest -> Maybe Bool)
-> (LogDeliveryConfigurationRequest
    -> Maybe Bool -> LogDeliveryConfigurationRequest)
-> Lens
     LogDeliveryConfigurationRequest
     LogDeliveryConfigurationRequest
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogDeliveryConfigurationRequest' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:LogDeliveryConfigurationRequest' :: LogDeliveryConfigurationRequest -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: LogDeliveryConfigurationRequest
s@LogDeliveryConfigurationRequest' {} Maybe Bool
a -> LogDeliveryConfigurationRequest
s {$sel:enabled:LogDeliveryConfigurationRequest' :: Maybe Bool
enabled = Maybe Bool
a} :: LogDeliveryConfigurationRequest)

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

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

-- | Specify either @cloudwatch-logs@ or @kinesis-firehose@ as the
-- destination type.
logDeliveryConfigurationRequest_destinationType :: Lens.Lens' LogDeliveryConfigurationRequest (Prelude.Maybe DestinationType)
logDeliveryConfigurationRequest_destinationType :: (Maybe DestinationType -> f (Maybe DestinationType))
-> LogDeliveryConfigurationRequest
-> f LogDeliveryConfigurationRequest
logDeliveryConfigurationRequest_destinationType = (LogDeliveryConfigurationRequest -> Maybe DestinationType)
-> (LogDeliveryConfigurationRequest
    -> Maybe DestinationType -> LogDeliveryConfigurationRequest)
-> Lens
     LogDeliveryConfigurationRequest
     LogDeliveryConfigurationRequest
     (Maybe DestinationType)
     (Maybe DestinationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogDeliveryConfigurationRequest' {Maybe DestinationType
destinationType :: Maybe DestinationType
$sel:destinationType:LogDeliveryConfigurationRequest' :: LogDeliveryConfigurationRequest -> Maybe DestinationType
destinationType} -> Maybe DestinationType
destinationType) (\s :: LogDeliveryConfigurationRequest
s@LogDeliveryConfigurationRequest' {} Maybe DestinationType
a -> LogDeliveryConfigurationRequest
s {$sel:destinationType:LogDeliveryConfigurationRequest' :: Maybe DestinationType
destinationType = Maybe DestinationType
a} :: LogDeliveryConfigurationRequest)

instance
  Prelude.Hashable
    LogDeliveryConfigurationRequest

instance
  Prelude.NFData
    LogDeliveryConfigurationRequest

instance Core.ToQuery LogDeliveryConfigurationRequest where
  toQuery :: LogDeliveryConfigurationRequest -> QueryString
toQuery LogDeliveryConfigurationRequest' {Maybe Bool
Maybe DestinationType
Maybe DestinationDetails
Maybe LogFormat
Maybe LogType
destinationType :: Maybe DestinationType
logType :: Maybe LogType
destinationDetails :: Maybe DestinationDetails
enabled :: Maybe Bool
logFormat :: Maybe LogFormat
$sel:destinationType:LogDeliveryConfigurationRequest' :: LogDeliveryConfigurationRequest -> Maybe DestinationType
$sel:logType:LogDeliveryConfigurationRequest' :: LogDeliveryConfigurationRequest -> Maybe LogType
$sel:destinationDetails:LogDeliveryConfigurationRequest' :: LogDeliveryConfigurationRequest -> Maybe DestinationDetails
$sel:enabled:LogDeliveryConfigurationRequest' :: LogDeliveryConfigurationRequest -> Maybe Bool
$sel:logFormat:LogDeliveryConfigurationRequest' :: LogDeliveryConfigurationRequest -> Maybe LogFormat
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"LogFormat" ByteString -> Maybe LogFormat -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe LogFormat
logFormat,
        ByteString
"Enabled" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
enabled,
        ByteString
"DestinationDetails" ByteString -> Maybe DestinationDetails -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe DestinationDetails
destinationDetails,
        ByteString
"LogType" ByteString -> Maybe LogType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe LogType
logType,
        ByteString
"DestinationType" ByteString -> Maybe DestinationType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe DestinationType
destinationType
      ]