{-# 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.IVSChat.Types.CloudWatchLogsDestinationConfiguration
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IVSChat.Types.CloudWatchLogsDestinationConfiguration where

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

-- | Specifies a CloudWatch Logs location where chat logs will be stored.
--
-- /See:/ 'newCloudWatchLogsDestinationConfiguration' smart constructor.
data CloudWatchLogsDestinationConfiguration = CloudWatchLogsDestinationConfiguration'
  { -- | Name of the Amazon Cloudwatch Logs destination where chat activity will
    -- be logged.
    CloudWatchLogsDestinationConfiguration -> Text
logGroupName :: Prelude.Text
  }
  deriving (CloudWatchLogsDestinationConfiguration
-> CloudWatchLogsDestinationConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudWatchLogsDestinationConfiguration
-> CloudWatchLogsDestinationConfiguration -> Bool
$c/= :: CloudWatchLogsDestinationConfiguration
-> CloudWatchLogsDestinationConfiguration -> Bool
== :: CloudWatchLogsDestinationConfiguration
-> CloudWatchLogsDestinationConfiguration -> Bool
$c== :: CloudWatchLogsDestinationConfiguration
-> CloudWatchLogsDestinationConfiguration -> Bool
Prelude.Eq, ReadPrec [CloudWatchLogsDestinationConfiguration]
ReadPrec CloudWatchLogsDestinationConfiguration
Int -> ReadS CloudWatchLogsDestinationConfiguration
ReadS [CloudWatchLogsDestinationConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudWatchLogsDestinationConfiguration]
$creadListPrec :: ReadPrec [CloudWatchLogsDestinationConfiguration]
readPrec :: ReadPrec CloudWatchLogsDestinationConfiguration
$creadPrec :: ReadPrec CloudWatchLogsDestinationConfiguration
readList :: ReadS [CloudWatchLogsDestinationConfiguration]
$creadList :: ReadS [CloudWatchLogsDestinationConfiguration]
readsPrec :: Int -> ReadS CloudWatchLogsDestinationConfiguration
$creadsPrec :: Int -> ReadS CloudWatchLogsDestinationConfiguration
Prelude.Read, Int -> CloudWatchLogsDestinationConfiguration -> ShowS
[CloudWatchLogsDestinationConfiguration] -> ShowS
CloudWatchLogsDestinationConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudWatchLogsDestinationConfiguration] -> ShowS
$cshowList :: [CloudWatchLogsDestinationConfiguration] -> ShowS
show :: CloudWatchLogsDestinationConfiguration -> String
$cshow :: CloudWatchLogsDestinationConfiguration -> String
showsPrec :: Int -> CloudWatchLogsDestinationConfiguration -> ShowS
$cshowsPrec :: Int -> CloudWatchLogsDestinationConfiguration -> ShowS
Prelude.Show, forall x.
Rep CloudWatchLogsDestinationConfiguration x
-> CloudWatchLogsDestinationConfiguration
forall x.
CloudWatchLogsDestinationConfiguration
-> Rep CloudWatchLogsDestinationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CloudWatchLogsDestinationConfiguration x
-> CloudWatchLogsDestinationConfiguration
$cfrom :: forall x.
CloudWatchLogsDestinationConfiguration
-> Rep CloudWatchLogsDestinationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'CloudWatchLogsDestinationConfiguration' 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:
--
-- 'logGroupName', 'cloudWatchLogsDestinationConfiguration_logGroupName' - Name of the Amazon Cloudwatch Logs destination where chat activity will
-- be logged.
newCloudWatchLogsDestinationConfiguration ::
  -- | 'logGroupName'
  Prelude.Text ->
  CloudWatchLogsDestinationConfiguration
newCloudWatchLogsDestinationConfiguration :: Text -> CloudWatchLogsDestinationConfiguration
newCloudWatchLogsDestinationConfiguration
  Text
pLogGroupName_ =
    CloudWatchLogsDestinationConfiguration'
      { $sel:logGroupName:CloudWatchLogsDestinationConfiguration' :: Text
logGroupName =
          Text
pLogGroupName_
      }

-- | Name of the Amazon Cloudwatch Logs destination where chat activity will
-- be logged.
cloudWatchLogsDestinationConfiguration_logGroupName :: Lens.Lens' CloudWatchLogsDestinationConfiguration Prelude.Text
cloudWatchLogsDestinationConfiguration_logGroupName :: Lens' CloudWatchLogsDestinationConfiguration Text
cloudWatchLogsDestinationConfiguration_logGroupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchLogsDestinationConfiguration' {Text
logGroupName :: Text
$sel:logGroupName:CloudWatchLogsDestinationConfiguration' :: CloudWatchLogsDestinationConfiguration -> Text
logGroupName} -> Text
logGroupName) (\s :: CloudWatchLogsDestinationConfiguration
s@CloudWatchLogsDestinationConfiguration' {} Text
a -> CloudWatchLogsDestinationConfiguration
s {$sel:logGroupName:CloudWatchLogsDestinationConfiguration' :: Text
logGroupName = Text
a} :: CloudWatchLogsDestinationConfiguration)

instance
  Data.FromJSON
    CloudWatchLogsDestinationConfiguration
  where
  parseJSON :: Value -> Parser CloudWatchLogsDestinationConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CloudWatchLogsDestinationConfiguration"
      ( \Object
x ->
          Text -> CloudWatchLogsDestinationConfiguration
CloudWatchLogsDestinationConfiguration'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"logGroupName")
      )

instance
  Prelude.Hashable
    CloudWatchLogsDestinationConfiguration
  where
  hashWithSalt :: Int -> CloudWatchLogsDestinationConfiguration -> Int
hashWithSalt
    Int
_salt
    CloudWatchLogsDestinationConfiguration' {Text
logGroupName :: Text
$sel:logGroupName:CloudWatchLogsDestinationConfiguration' :: CloudWatchLogsDestinationConfiguration -> Text
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
logGroupName

instance
  Prelude.NFData
    CloudWatchLogsDestinationConfiguration
  where
  rnf :: CloudWatchLogsDestinationConfiguration -> ()
rnf CloudWatchLogsDestinationConfiguration' {Text
logGroupName :: Text
$sel:logGroupName:CloudWatchLogsDestinationConfiguration' :: CloudWatchLogsDestinationConfiguration -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
logGroupName

instance
  Data.ToJSON
    CloudWatchLogsDestinationConfiguration
  where
  toJSON :: CloudWatchLogsDestinationConfiguration -> Value
toJSON CloudWatchLogsDestinationConfiguration' {Text
logGroupName :: Text
$sel:logGroupName:CloudWatchLogsDestinationConfiguration' :: CloudWatchLogsDestinationConfiguration -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"logGroupName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
logGroupName)]
      )