{-# 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.LexV2Models.Types.TextLogDestination
-- 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.LexV2Models.Types.TextLogDestination where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LexV2Models.Types.CloudWatchLogGroupLogDestination
import qualified Amazonka.Prelude as Prelude

-- | Defines the Amazon CloudWatch Logs destination log group for
-- conversation text logs.
--
-- /See:/ 'newTextLogDestination' smart constructor.
data TextLogDestination = TextLogDestination'
  { -- | Defines the Amazon CloudWatch Logs log group where text and metadata
    -- logs are delivered.
    TextLogDestination -> CloudWatchLogGroupLogDestination
cloudWatch :: CloudWatchLogGroupLogDestination
  }
  deriving (TextLogDestination -> TextLogDestination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TextLogDestination -> TextLogDestination -> Bool
$c/= :: TextLogDestination -> TextLogDestination -> Bool
== :: TextLogDestination -> TextLogDestination -> Bool
$c== :: TextLogDestination -> TextLogDestination -> Bool
Prelude.Eq, ReadPrec [TextLogDestination]
ReadPrec TextLogDestination
Int -> ReadS TextLogDestination
ReadS [TextLogDestination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TextLogDestination]
$creadListPrec :: ReadPrec [TextLogDestination]
readPrec :: ReadPrec TextLogDestination
$creadPrec :: ReadPrec TextLogDestination
readList :: ReadS [TextLogDestination]
$creadList :: ReadS [TextLogDestination]
readsPrec :: Int -> ReadS TextLogDestination
$creadsPrec :: Int -> ReadS TextLogDestination
Prelude.Read, Int -> TextLogDestination -> ShowS
[TextLogDestination] -> ShowS
TextLogDestination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TextLogDestination] -> ShowS
$cshowList :: [TextLogDestination] -> ShowS
show :: TextLogDestination -> String
$cshow :: TextLogDestination -> String
showsPrec :: Int -> TextLogDestination -> ShowS
$cshowsPrec :: Int -> TextLogDestination -> ShowS
Prelude.Show, forall x. Rep TextLogDestination x -> TextLogDestination
forall x. TextLogDestination -> Rep TextLogDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TextLogDestination x -> TextLogDestination
$cfrom :: forall x. TextLogDestination -> Rep TextLogDestination x
Prelude.Generic)

-- |
-- Create a value of 'TextLogDestination' 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:
--
-- 'cloudWatch', 'textLogDestination_cloudWatch' - Defines the Amazon CloudWatch Logs log group where text and metadata
-- logs are delivered.
newTextLogDestination ::
  -- | 'cloudWatch'
  CloudWatchLogGroupLogDestination ->
  TextLogDestination
newTextLogDestination :: CloudWatchLogGroupLogDestination -> TextLogDestination
newTextLogDestination CloudWatchLogGroupLogDestination
pCloudWatch_ =
  TextLogDestination' {$sel:cloudWatch:TextLogDestination' :: CloudWatchLogGroupLogDestination
cloudWatch = CloudWatchLogGroupLogDestination
pCloudWatch_}

-- | Defines the Amazon CloudWatch Logs log group where text and metadata
-- logs are delivered.
textLogDestination_cloudWatch :: Lens.Lens' TextLogDestination CloudWatchLogGroupLogDestination
textLogDestination_cloudWatch :: Lens' TextLogDestination CloudWatchLogGroupLogDestination
textLogDestination_cloudWatch = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TextLogDestination' {CloudWatchLogGroupLogDestination
cloudWatch :: CloudWatchLogGroupLogDestination
$sel:cloudWatch:TextLogDestination' :: TextLogDestination -> CloudWatchLogGroupLogDestination
cloudWatch} -> CloudWatchLogGroupLogDestination
cloudWatch) (\s :: TextLogDestination
s@TextLogDestination' {} CloudWatchLogGroupLogDestination
a -> TextLogDestination
s {$sel:cloudWatch:TextLogDestination' :: CloudWatchLogGroupLogDestination
cloudWatch = CloudWatchLogGroupLogDestination
a} :: TextLogDestination)

instance Data.FromJSON TextLogDestination where
  parseJSON :: Value -> Parser TextLogDestination
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TextLogDestination"
      ( \Object
x ->
          CloudWatchLogGroupLogDestination -> TextLogDestination
TextLogDestination'
            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
"cloudWatch")
      )

instance Prelude.Hashable TextLogDestination where
  hashWithSalt :: Int -> TextLogDestination -> Int
hashWithSalt Int
_salt TextLogDestination' {CloudWatchLogGroupLogDestination
cloudWatch :: CloudWatchLogGroupLogDestination
$sel:cloudWatch:TextLogDestination' :: TextLogDestination -> CloudWatchLogGroupLogDestination
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` CloudWatchLogGroupLogDestination
cloudWatch

instance Prelude.NFData TextLogDestination where
  rnf :: TextLogDestination -> ()
rnf TextLogDestination' {CloudWatchLogGroupLogDestination
cloudWatch :: CloudWatchLogGroupLogDestination
$sel:cloudWatch:TextLogDestination' :: TextLogDestination -> CloudWatchLogGroupLogDestination
..} = forall a. NFData a => a -> ()
Prelude.rnf CloudWatchLogGroupLogDestination
cloudWatch

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