{-# 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.RDS.Types.CloudwatchLogsExportConfiguration
-- 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.RDS.Types.CloudwatchLogsExportConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The configuration setting for the log types to be enabled for export to
-- CloudWatch Logs for a specific DB instance or DB cluster.
--
-- The @EnableLogTypes@ and @DisableLogTypes@ arrays determine which logs
-- will be exported (or not exported) to CloudWatch Logs. The values within
-- these arrays depend on the DB engine being used.
--
-- For more information about exporting CloudWatch Logs for Amazon RDS DB
-- instances, see
-- <https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.html#USER_LogAccess.Procedural.UploadtoCloudWatch Publishing Database Logs to Amazon CloudWatch Logs>
-- in the /Amazon RDS User Guide/.
--
-- For more information about exporting CloudWatch Logs for Amazon Aurora
-- DB clusters, see
-- <https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_LogAccess.html#USER_LogAccess.Procedural.UploadtoCloudWatch Publishing Database Logs to Amazon CloudWatch Logs>
-- in the /Amazon Aurora User Guide/.
--
-- /See:/ 'newCloudwatchLogsExportConfiguration' smart constructor.
data CloudwatchLogsExportConfiguration = CloudwatchLogsExportConfiguration'
  { -- | The list of log types to disable.
    CloudwatchLogsExportConfiguration -> Maybe [Text]
disableLogTypes :: Prelude.Maybe [Prelude.Text],
    -- | The list of log types to enable.
    CloudwatchLogsExportConfiguration -> Maybe [Text]
enableLogTypes :: Prelude.Maybe [Prelude.Text]
  }
  deriving (CloudwatchLogsExportConfiguration
-> CloudwatchLogsExportConfiguration -> Bool
(CloudwatchLogsExportConfiguration
 -> CloudwatchLogsExportConfiguration -> Bool)
-> (CloudwatchLogsExportConfiguration
    -> CloudwatchLogsExportConfiguration -> Bool)
-> Eq CloudwatchLogsExportConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudwatchLogsExportConfiguration
-> CloudwatchLogsExportConfiguration -> Bool
$c/= :: CloudwatchLogsExportConfiguration
-> CloudwatchLogsExportConfiguration -> Bool
== :: CloudwatchLogsExportConfiguration
-> CloudwatchLogsExportConfiguration -> Bool
$c== :: CloudwatchLogsExportConfiguration
-> CloudwatchLogsExportConfiguration -> Bool
Prelude.Eq, ReadPrec [CloudwatchLogsExportConfiguration]
ReadPrec CloudwatchLogsExportConfiguration
Int -> ReadS CloudwatchLogsExportConfiguration
ReadS [CloudwatchLogsExportConfiguration]
(Int -> ReadS CloudwatchLogsExportConfiguration)
-> ReadS [CloudwatchLogsExportConfiguration]
-> ReadPrec CloudwatchLogsExportConfiguration
-> ReadPrec [CloudwatchLogsExportConfiguration]
-> Read CloudwatchLogsExportConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudwatchLogsExportConfiguration]
$creadListPrec :: ReadPrec [CloudwatchLogsExportConfiguration]
readPrec :: ReadPrec CloudwatchLogsExportConfiguration
$creadPrec :: ReadPrec CloudwatchLogsExportConfiguration
readList :: ReadS [CloudwatchLogsExportConfiguration]
$creadList :: ReadS [CloudwatchLogsExportConfiguration]
readsPrec :: Int -> ReadS CloudwatchLogsExportConfiguration
$creadsPrec :: Int -> ReadS CloudwatchLogsExportConfiguration
Prelude.Read, Int -> CloudwatchLogsExportConfiguration -> ShowS
[CloudwatchLogsExportConfiguration] -> ShowS
CloudwatchLogsExportConfiguration -> String
(Int -> CloudwatchLogsExportConfiguration -> ShowS)
-> (CloudwatchLogsExportConfiguration -> String)
-> ([CloudwatchLogsExportConfiguration] -> ShowS)
-> Show CloudwatchLogsExportConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudwatchLogsExportConfiguration] -> ShowS
$cshowList :: [CloudwatchLogsExportConfiguration] -> ShowS
show :: CloudwatchLogsExportConfiguration -> String
$cshow :: CloudwatchLogsExportConfiguration -> String
showsPrec :: Int -> CloudwatchLogsExportConfiguration -> ShowS
$cshowsPrec :: Int -> CloudwatchLogsExportConfiguration -> ShowS
Prelude.Show, (forall x.
 CloudwatchLogsExportConfiguration
 -> Rep CloudwatchLogsExportConfiguration x)
-> (forall x.
    Rep CloudwatchLogsExportConfiguration x
    -> CloudwatchLogsExportConfiguration)
-> Generic CloudwatchLogsExportConfiguration
forall x.
Rep CloudwatchLogsExportConfiguration x
-> CloudwatchLogsExportConfiguration
forall x.
CloudwatchLogsExportConfiguration
-> Rep CloudwatchLogsExportConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CloudwatchLogsExportConfiguration x
-> CloudwatchLogsExportConfiguration
$cfrom :: forall x.
CloudwatchLogsExportConfiguration
-> Rep CloudwatchLogsExportConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'CloudwatchLogsExportConfiguration' 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:
--
-- 'disableLogTypes', 'cloudwatchLogsExportConfiguration_disableLogTypes' - The list of log types to disable.
--
-- 'enableLogTypes', 'cloudwatchLogsExportConfiguration_enableLogTypes' - The list of log types to enable.
newCloudwatchLogsExportConfiguration ::
  CloudwatchLogsExportConfiguration
newCloudwatchLogsExportConfiguration :: CloudwatchLogsExportConfiguration
newCloudwatchLogsExportConfiguration =
  CloudwatchLogsExportConfiguration' :: Maybe [Text] -> Maybe [Text] -> CloudwatchLogsExportConfiguration
CloudwatchLogsExportConfiguration'
    { $sel:disableLogTypes:CloudwatchLogsExportConfiguration' :: Maybe [Text]
disableLogTypes =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:enableLogTypes:CloudwatchLogsExportConfiguration' :: Maybe [Text]
enableLogTypes = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | The list of log types to disable.
cloudwatchLogsExportConfiguration_disableLogTypes :: Lens.Lens' CloudwatchLogsExportConfiguration (Prelude.Maybe [Prelude.Text])
cloudwatchLogsExportConfiguration_disableLogTypes :: (Maybe [Text] -> f (Maybe [Text]))
-> CloudwatchLogsExportConfiguration
-> f CloudwatchLogsExportConfiguration
cloudwatchLogsExportConfiguration_disableLogTypes = (CloudwatchLogsExportConfiguration -> Maybe [Text])
-> (CloudwatchLogsExportConfiguration
    -> Maybe [Text] -> CloudwatchLogsExportConfiguration)
-> Lens
     CloudwatchLogsExportConfiguration
     CloudwatchLogsExportConfiguration
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudwatchLogsExportConfiguration' {Maybe [Text]
disableLogTypes :: Maybe [Text]
$sel:disableLogTypes:CloudwatchLogsExportConfiguration' :: CloudwatchLogsExportConfiguration -> Maybe [Text]
disableLogTypes} -> Maybe [Text]
disableLogTypes) (\s :: CloudwatchLogsExportConfiguration
s@CloudwatchLogsExportConfiguration' {} Maybe [Text]
a -> CloudwatchLogsExportConfiguration
s {$sel:disableLogTypes:CloudwatchLogsExportConfiguration' :: Maybe [Text]
disableLogTypes = Maybe [Text]
a} :: CloudwatchLogsExportConfiguration) ((Maybe [Text] -> f (Maybe [Text]))
 -> CloudwatchLogsExportConfiguration
 -> f CloudwatchLogsExportConfiguration)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CloudwatchLogsExportConfiguration
-> f CloudwatchLogsExportConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The list of log types to enable.
cloudwatchLogsExportConfiguration_enableLogTypes :: Lens.Lens' CloudwatchLogsExportConfiguration (Prelude.Maybe [Prelude.Text])
cloudwatchLogsExportConfiguration_enableLogTypes :: (Maybe [Text] -> f (Maybe [Text]))
-> CloudwatchLogsExportConfiguration
-> f CloudwatchLogsExportConfiguration
cloudwatchLogsExportConfiguration_enableLogTypes = (CloudwatchLogsExportConfiguration -> Maybe [Text])
-> (CloudwatchLogsExportConfiguration
    -> Maybe [Text] -> CloudwatchLogsExportConfiguration)
-> Lens
     CloudwatchLogsExportConfiguration
     CloudwatchLogsExportConfiguration
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudwatchLogsExportConfiguration' {Maybe [Text]
enableLogTypes :: Maybe [Text]
$sel:enableLogTypes:CloudwatchLogsExportConfiguration' :: CloudwatchLogsExportConfiguration -> Maybe [Text]
enableLogTypes} -> Maybe [Text]
enableLogTypes) (\s :: CloudwatchLogsExportConfiguration
s@CloudwatchLogsExportConfiguration' {} Maybe [Text]
a -> CloudwatchLogsExportConfiguration
s {$sel:enableLogTypes:CloudwatchLogsExportConfiguration' :: Maybe [Text]
enableLogTypes = Maybe [Text]
a} :: CloudwatchLogsExportConfiguration) ((Maybe [Text] -> f (Maybe [Text]))
 -> CloudwatchLogsExportConfiguration
 -> f CloudwatchLogsExportConfiguration)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CloudwatchLogsExportConfiguration
-> f CloudwatchLogsExportConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.Hashable
    CloudwatchLogsExportConfiguration

instance
  Prelude.NFData
    CloudwatchLogsExportConfiguration

instance
  Core.ToQuery
    CloudwatchLogsExportConfiguration
  where
  toQuery :: CloudwatchLogsExportConfiguration -> QueryString
toQuery CloudwatchLogsExportConfiguration' {Maybe [Text]
enableLogTypes :: Maybe [Text]
disableLogTypes :: Maybe [Text]
$sel:enableLogTypes:CloudwatchLogsExportConfiguration' :: CloudwatchLogsExportConfiguration -> Maybe [Text]
$sel:disableLogTypes:CloudwatchLogsExportConfiguration' :: CloudwatchLogsExportConfiguration -> Maybe [Text]
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"DisableLogTypes"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member"
                ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
disableLogTypes
            ),
        ByteString
"EnableLogTypes"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member"
                ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
enableLogTypes
            )
      ]