{-# 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.CloudWatchLogsDestinationDetails
-- 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.CloudWatchLogsDestinationDetails where

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

-- | The configuration details of the CloudWatch Logs destination.
--
-- /See:/ 'newCloudWatchLogsDestinationDetails' smart constructor.
data CloudWatchLogsDestinationDetails = CloudWatchLogsDestinationDetails'
  { -- | The name of the CloudWatch Logs log group.
    CloudWatchLogsDestinationDetails -> Maybe Text
logGroup :: Prelude.Maybe Prelude.Text
  }
  deriving (CloudWatchLogsDestinationDetails
-> CloudWatchLogsDestinationDetails -> Bool
(CloudWatchLogsDestinationDetails
 -> CloudWatchLogsDestinationDetails -> Bool)
-> (CloudWatchLogsDestinationDetails
    -> CloudWatchLogsDestinationDetails -> Bool)
-> Eq CloudWatchLogsDestinationDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudWatchLogsDestinationDetails
-> CloudWatchLogsDestinationDetails -> Bool
$c/= :: CloudWatchLogsDestinationDetails
-> CloudWatchLogsDestinationDetails -> Bool
== :: CloudWatchLogsDestinationDetails
-> CloudWatchLogsDestinationDetails -> Bool
$c== :: CloudWatchLogsDestinationDetails
-> CloudWatchLogsDestinationDetails -> Bool
Prelude.Eq, ReadPrec [CloudWatchLogsDestinationDetails]
ReadPrec CloudWatchLogsDestinationDetails
Int -> ReadS CloudWatchLogsDestinationDetails
ReadS [CloudWatchLogsDestinationDetails]
(Int -> ReadS CloudWatchLogsDestinationDetails)
-> ReadS [CloudWatchLogsDestinationDetails]
-> ReadPrec CloudWatchLogsDestinationDetails
-> ReadPrec [CloudWatchLogsDestinationDetails]
-> Read CloudWatchLogsDestinationDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudWatchLogsDestinationDetails]
$creadListPrec :: ReadPrec [CloudWatchLogsDestinationDetails]
readPrec :: ReadPrec CloudWatchLogsDestinationDetails
$creadPrec :: ReadPrec CloudWatchLogsDestinationDetails
readList :: ReadS [CloudWatchLogsDestinationDetails]
$creadList :: ReadS [CloudWatchLogsDestinationDetails]
readsPrec :: Int -> ReadS CloudWatchLogsDestinationDetails
$creadsPrec :: Int -> ReadS CloudWatchLogsDestinationDetails
Prelude.Read, Int -> CloudWatchLogsDestinationDetails -> ShowS
[CloudWatchLogsDestinationDetails] -> ShowS
CloudWatchLogsDestinationDetails -> String
(Int -> CloudWatchLogsDestinationDetails -> ShowS)
-> (CloudWatchLogsDestinationDetails -> String)
-> ([CloudWatchLogsDestinationDetails] -> ShowS)
-> Show CloudWatchLogsDestinationDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudWatchLogsDestinationDetails] -> ShowS
$cshowList :: [CloudWatchLogsDestinationDetails] -> ShowS
show :: CloudWatchLogsDestinationDetails -> String
$cshow :: CloudWatchLogsDestinationDetails -> String
showsPrec :: Int -> CloudWatchLogsDestinationDetails -> ShowS
$cshowsPrec :: Int -> CloudWatchLogsDestinationDetails -> ShowS
Prelude.Show, (forall x.
 CloudWatchLogsDestinationDetails
 -> Rep CloudWatchLogsDestinationDetails x)
-> (forall x.
    Rep CloudWatchLogsDestinationDetails x
    -> CloudWatchLogsDestinationDetails)
-> Generic CloudWatchLogsDestinationDetails
forall x.
Rep CloudWatchLogsDestinationDetails x
-> CloudWatchLogsDestinationDetails
forall x.
CloudWatchLogsDestinationDetails
-> Rep CloudWatchLogsDestinationDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CloudWatchLogsDestinationDetails x
-> CloudWatchLogsDestinationDetails
$cfrom :: forall x.
CloudWatchLogsDestinationDetails
-> Rep CloudWatchLogsDestinationDetails x
Prelude.Generic)

-- |
-- Create a value of 'CloudWatchLogsDestinationDetails' 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:
--
-- 'logGroup', 'cloudWatchLogsDestinationDetails_logGroup' - The name of the CloudWatch Logs log group.
newCloudWatchLogsDestinationDetails ::
  CloudWatchLogsDestinationDetails
newCloudWatchLogsDestinationDetails :: CloudWatchLogsDestinationDetails
newCloudWatchLogsDestinationDetails =
  CloudWatchLogsDestinationDetails' :: Maybe Text -> CloudWatchLogsDestinationDetails
CloudWatchLogsDestinationDetails'
    { $sel:logGroup:CloudWatchLogsDestinationDetails' :: Maybe Text
logGroup =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the CloudWatch Logs log group.
cloudWatchLogsDestinationDetails_logGroup :: Lens.Lens' CloudWatchLogsDestinationDetails (Prelude.Maybe Prelude.Text)
cloudWatchLogsDestinationDetails_logGroup :: (Maybe Text -> f (Maybe Text))
-> CloudWatchLogsDestinationDetails
-> f CloudWatchLogsDestinationDetails
cloudWatchLogsDestinationDetails_logGroup = (CloudWatchLogsDestinationDetails -> Maybe Text)
-> (CloudWatchLogsDestinationDetails
    -> Maybe Text -> CloudWatchLogsDestinationDetails)
-> Lens
     CloudWatchLogsDestinationDetails
     CloudWatchLogsDestinationDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchLogsDestinationDetails' {Maybe Text
logGroup :: Maybe Text
$sel:logGroup:CloudWatchLogsDestinationDetails' :: CloudWatchLogsDestinationDetails -> Maybe Text
logGroup} -> Maybe Text
logGroup) (\s :: CloudWatchLogsDestinationDetails
s@CloudWatchLogsDestinationDetails' {} Maybe Text
a -> CloudWatchLogsDestinationDetails
s {$sel:logGroup:CloudWatchLogsDestinationDetails' :: Maybe Text
logGroup = Maybe Text
a} :: CloudWatchLogsDestinationDetails)

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

instance
  Prelude.Hashable
    CloudWatchLogsDestinationDetails

instance
  Prelude.NFData
    CloudWatchLogsDestinationDetails

instance
  Core.ToQuery
    CloudWatchLogsDestinationDetails
  where
  toQuery :: CloudWatchLogsDestinationDetails -> QueryString
toQuery CloudWatchLogsDestinationDetails' {Maybe Text
logGroup :: Maybe Text
$sel:logGroup:CloudWatchLogsDestinationDetails' :: CloudWatchLogsDestinationDetails -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"LogGroup" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
logGroup]