{-# 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.S3BucketLogDestination
-- 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.S3BucketLogDestination 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 an Amazon S3 bucket for logging audio conversations
--
-- /See:/ 'newS3BucketLogDestination' smart constructor.
data S3BucketLogDestination = S3BucketLogDestination'
  { -- | The Amazon Resource Name (ARN) of an AWS Key Management Service (KMS)
    -- key for encrypting audio log files stored in an S3 bucket.
    S3BucketLogDestination -> Maybe Text
kmsKeyArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of an Amazon S3 bucket where audio log
    -- files are stored.
    S3BucketLogDestination -> Text
s3BucketArn :: Prelude.Text,
    -- | The S3 prefix to assign to audio log files.
    S3BucketLogDestination -> Text
logPrefix :: Prelude.Text
  }
  deriving (S3BucketLogDestination -> S3BucketLogDestination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3BucketLogDestination -> S3BucketLogDestination -> Bool
$c/= :: S3BucketLogDestination -> S3BucketLogDestination -> Bool
== :: S3BucketLogDestination -> S3BucketLogDestination -> Bool
$c== :: S3BucketLogDestination -> S3BucketLogDestination -> Bool
Prelude.Eq, ReadPrec [S3BucketLogDestination]
ReadPrec S3BucketLogDestination
Int -> ReadS S3BucketLogDestination
ReadS [S3BucketLogDestination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3BucketLogDestination]
$creadListPrec :: ReadPrec [S3BucketLogDestination]
readPrec :: ReadPrec S3BucketLogDestination
$creadPrec :: ReadPrec S3BucketLogDestination
readList :: ReadS [S3BucketLogDestination]
$creadList :: ReadS [S3BucketLogDestination]
readsPrec :: Int -> ReadS S3BucketLogDestination
$creadsPrec :: Int -> ReadS S3BucketLogDestination
Prelude.Read, Int -> S3BucketLogDestination -> ShowS
[S3BucketLogDestination] -> ShowS
S3BucketLogDestination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3BucketLogDestination] -> ShowS
$cshowList :: [S3BucketLogDestination] -> ShowS
show :: S3BucketLogDestination -> String
$cshow :: S3BucketLogDestination -> String
showsPrec :: Int -> S3BucketLogDestination -> ShowS
$cshowsPrec :: Int -> S3BucketLogDestination -> ShowS
Prelude.Show, forall x. Rep S3BucketLogDestination x -> S3BucketLogDestination
forall x. S3BucketLogDestination -> Rep S3BucketLogDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3BucketLogDestination x -> S3BucketLogDestination
$cfrom :: forall x. S3BucketLogDestination -> Rep S3BucketLogDestination x
Prelude.Generic)

-- |
-- Create a value of 'S3BucketLogDestination' 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:
--
-- 'kmsKeyArn', 's3BucketLogDestination_kmsKeyArn' - The Amazon Resource Name (ARN) of an AWS Key Management Service (KMS)
-- key for encrypting audio log files stored in an S3 bucket.
--
-- 's3BucketArn', 's3BucketLogDestination_s3BucketArn' - The Amazon Resource Name (ARN) of an Amazon S3 bucket where audio log
-- files are stored.
--
-- 'logPrefix', 's3BucketLogDestination_logPrefix' - The S3 prefix to assign to audio log files.
newS3BucketLogDestination ::
  -- | 's3BucketArn'
  Prelude.Text ->
  -- | 'logPrefix'
  Prelude.Text ->
  S3BucketLogDestination
newS3BucketLogDestination :: Text -> Text -> S3BucketLogDestination
newS3BucketLogDestination Text
pS3BucketArn_ Text
pLogPrefix_ =
  S3BucketLogDestination'
    { $sel:kmsKeyArn:S3BucketLogDestination' :: Maybe Text
kmsKeyArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:s3BucketArn:S3BucketLogDestination' :: Text
s3BucketArn = Text
pS3BucketArn_,
      $sel:logPrefix:S3BucketLogDestination' :: Text
logPrefix = Text
pLogPrefix_
    }

-- | The Amazon Resource Name (ARN) of an AWS Key Management Service (KMS)
-- key for encrypting audio log files stored in an S3 bucket.
s3BucketLogDestination_kmsKeyArn :: Lens.Lens' S3BucketLogDestination (Prelude.Maybe Prelude.Text)
s3BucketLogDestination_kmsKeyArn :: Lens' S3BucketLogDestination (Maybe Text)
s3BucketLogDestination_kmsKeyArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3BucketLogDestination' {Maybe Text
kmsKeyArn :: Maybe Text
$sel:kmsKeyArn:S3BucketLogDestination' :: S3BucketLogDestination -> Maybe Text
kmsKeyArn} -> Maybe Text
kmsKeyArn) (\s :: S3BucketLogDestination
s@S3BucketLogDestination' {} Maybe Text
a -> S3BucketLogDestination
s {$sel:kmsKeyArn:S3BucketLogDestination' :: Maybe Text
kmsKeyArn = Maybe Text
a} :: S3BucketLogDestination)

-- | The Amazon Resource Name (ARN) of an Amazon S3 bucket where audio log
-- files are stored.
s3BucketLogDestination_s3BucketArn :: Lens.Lens' S3BucketLogDestination Prelude.Text
s3BucketLogDestination_s3BucketArn :: Lens' S3BucketLogDestination Text
s3BucketLogDestination_s3BucketArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3BucketLogDestination' {Text
s3BucketArn :: Text
$sel:s3BucketArn:S3BucketLogDestination' :: S3BucketLogDestination -> Text
s3BucketArn} -> Text
s3BucketArn) (\s :: S3BucketLogDestination
s@S3BucketLogDestination' {} Text
a -> S3BucketLogDestination
s {$sel:s3BucketArn:S3BucketLogDestination' :: Text
s3BucketArn = Text
a} :: S3BucketLogDestination)

-- | The S3 prefix to assign to audio log files.
s3BucketLogDestination_logPrefix :: Lens.Lens' S3BucketLogDestination Prelude.Text
s3BucketLogDestination_logPrefix :: Lens' S3BucketLogDestination Text
s3BucketLogDestination_logPrefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3BucketLogDestination' {Text
logPrefix :: Text
$sel:logPrefix:S3BucketLogDestination' :: S3BucketLogDestination -> Text
logPrefix} -> Text
logPrefix) (\s :: S3BucketLogDestination
s@S3BucketLogDestination' {} Text
a -> S3BucketLogDestination
s {$sel:logPrefix:S3BucketLogDestination' :: Text
logPrefix = Text
a} :: S3BucketLogDestination)

instance Data.FromJSON S3BucketLogDestination where
  parseJSON :: Value -> Parser S3BucketLogDestination
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"S3BucketLogDestination"
      ( \Object
x ->
          Maybe Text -> Text -> Text -> S3BucketLogDestination
S3BucketLogDestination'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"kmsKeyArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"s3BucketArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"logPrefix")
      )

instance Prelude.Hashable S3BucketLogDestination where
  hashWithSalt :: Int -> S3BucketLogDestination -> Int
hashWithSalt Int
_salt S3BucketLogDestination' {Maybe Text
Text
logPrefix :: Text
s3BucketArn :: Text
kmsKeyArn :: Maybe Text
$sel:logPrefix:S3BucketLogDestination' :: S3BucketLogDestination -> Text
$sel:s3BucketArn:S3BucketLogDestination' :: S3BucketLogDestination -> Text
$sel:kmsKeyArn:S3BucketLogDestination' :: S3BucketLogDestination -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsKeyArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
s3BucketArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
logPrefix

instance Prelude.NFData S3BucketLogDestination where
  rnf :: S3BucketLogDestination -> ()
rnf S3BucketLogDestination' {Maybe Text
Text
logPrefix :: Text
s3BucketArn :: Text
kmsKeyArn :: Maybe Text
$sel:logPrefix:S3BucketLogDestination' :: S3BucketLogDestination -> Text
$sel:s3BucketArn:S3BucketLogDestination' :: S3BucketLogDestination -> Text
$sel:kmsKeyArn:S3BucketLogDestination' :: S3BucketLogDestination -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
kmsKeyArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
s3BucketArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
logPrefix

instance Data.ToJSON S3BucketLogDestination where
  toJSON :: S3BucketLogDestination -> Value
toJSON S3BucketLogDestination' {Maybe Text
Text
logPrefix :: Text
s3BucketArn :: Text
kmsKeyArn :: Maybe Text
$sel:logPrefix:S3BucketLogDestination' :: S3BucketLogDestination -> Text
$sel:s3BucketArn:S3BucketLogDestination' :: S3BucketLogDestination -> Text
$sel:kmsKeyArn:S3BucketLogDestination' :: S3BucketLogDestination -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"kmsKeyArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyArn,
            forall a. a -> Maybe a
Prelude.Just (Key
"s3BucketArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
s3BucketArn),
            forall a. a -> Maybe a
Prelude.Just (Key
"logPrefix" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
logPrefix)
          ]
      )