{-# 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.AudioLogDestination
-- 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.AudioLogDestination 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.S3BucketLogDestination
import qualified Amazonka.Prelude as Prelude

-- | The location of audio log files collected when conversation logging is
-- enabled for a bot.
--
-- /See:/ 'newAudioLogDestination' smart constructor.
data AudioLogDestination = AudioLogDestination'
  { -- | The Amazon S3 bucket where the audio log files are stored. The IAM role
    -- specified in the @roleArn@ parameter of the
    -- <https://docs.aws.amazon.com/lexv2/latest/dg/API_CreateBot.html CreateBot>
    -- operation must have permission to write to this bucket.
    AudioLogDestination -> S3BucketLogDestination
s3Bucket :: S3BucketLogDestination
  }
  deriving (AudioLogDestination -> AudioLogDestination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AudioLogDestination -> AudioLogDestination -> Bool
$c/= :: AudioLogDestination -> AudioLogDestination -> Bool
== :: AudioLogDestination -> AudioLogDestination -> Bool
$c== :: AudioLogDestination -> AudioLogDestination -> Bool
Prelude.Eq, ReadPrec [AudioLogDestination]
ReadPrec AudioLogDestination
Int -> ReadS AudioLogDestination
ReadS [AudioLogDestination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AudioLogDestination]
$creadListPrec :: ReadPrec [AudioLogDestination]
readPrec :: ReadPrec AudioLogDestination
$creadPrec :: ReadPrec AudioLogDestination
readList :: ReadS [AudioLogDestination]
$creadList :: ReadS [AudioLogDestination]
readsPrec :: Int -> ReadS AudioLogDestination
$creadsPrec :: Int -> ReadS AudioLogDestination
Prelude.Read, Int -> AudioLogDestination -> ShowS
[AudioLogDestination] -> ShowS
AudioLogDestination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AudioLogDestination] -> ShowS
$cshowList :: [AudioLogDestination] -> ShowS
show :: AudioLogDestination -> String
$cshow :: AudioLogDestination -> String
showsPrec :: Int -> AudioLogDestination -> ShowS
$cshowsPrec :: Int -> AudioLogDestination -> ShowS
Prelude.Show, forall x. Rep AudioLogDestination x -> AudioLogDestination
forall x. AudioLogDestination -> Rep AudioLogDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AudioLogDestination x -> AudioLogDestination
$cfrom :: forall x. AudioLogDestination -> Rep AudioLogDestination x
Prelude.Generic)

-- |
-- Create a value of 'AudioLogDestination' 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:
--
-- 's3Bucket', 'audioLogDestination_s3Bucket' - The Amazon S3 bucket where the audio log files are stored. The IAM role
-- specified in the @roleArn@ parameter of the
-- <https://docs.aws.amazon.com/lexv2/latest/dg/API_CreateBot.html CreateBot>
-- operation must have permission to write to this bucket.
newAudioLogDestination ::
  -- | 's3Bucket'
  S3BucketLogDestination ->
  AudioLogDestination
newAudioLogDestination :: S3BucketLogDestination -> AudioLogDestination
newAudioLogDestination S3BucketLogDestination
pS3Bucket_ =
  AudioLogDestination' {$sel:s3Bucket:AudioLogDestination' :: S3BucketLogDestination
s3Bucket = S3BucketLogDestination
pS3Bucket_}

-- | The Amazon S3 bucket where the audio log files are stored. The IAM role
-- specified in the @roleArn@ parameter of the
-- <https://docs.aws.amazon.com/lexv2/latest/dg/API_CreateBot.html CreateBot>
-- operation must have permission to write to this bucket.
audioLogDestination_s3Bucket :: Lens.Lens' AudioLogDestination S3BucketLogDestination
audioLogDestination_s3Bucket :: Lens' AudioLogDestination S3BucketLogDestination
audioLogDestination_s3Bucket = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioLogDestination' {S3BucketLogDestination
s3Bucket :: S3BucketLogDestination
$sel:s3Bucket:AudioLogDestination' :: AudioLogDestination -> S3BucketLogDestination
s3Bucket} -> S3BucketLogDestination
s3Bucket) (\s :: AudioLogDestination
s@AudioLogDestination' {} S3BucketLogDestination
a -> AudioLogDestination
s {$sel:s3Bucket:AudioLogDestination' :: S3BucketLogDestination
s3Bucket = S3BucketLogDestination
a} :: AudioLogDestination)

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

instance Prelude.Hashable AudioLogDestination where
  hashWithSalt :: Int -> AudioLogDestination -> Int
hashWithSalt Int
_salt AudioLogDestination' {S3BucketLogDestination
s3Bucket :: S3BucketLogDestination
$sel:s3Bucket:AudioLogDestination' :: AudioLogDestination -> S3BucketLogDestination
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` S3BucketLogDestination
s3Bucket

instance Prelude.NFData AudioLogDestination where
  rnf :: AudioLogDestination -> ()
rnf AudioLogDestination' {S3BucketLogDestination
s3Bucket :: S3BucketLogDestination
$sel:s3Bucket:AudioLogDestination' :: AudioLogDestination -> S3BucketLogDestination
..} = forall a. NFData a => a -> ()
Prelude.rnf S3BucketLogDestination
s3Bucket

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