{-# 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.S3DestinationConfiguration
-- 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.S3DestinationConfiguration 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 S3 location where chat logs will be stored.
--
-- /See:/ 'newS3DestinationConfiguration' smart constructor.
data S3DestinationConfiguration = S3DestinationConfiguration'
  { -- | Name of the Amazon S3 bucket where chat activity will be logged.
    S3DestinationConfiguration -> Text
bucketName :: Prelude.Text
  }
  deriving (S3DestinationConfiguration -> S3DestinationConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3DestinationConfiguration -> S3DestinationConfiguration -> Bool
$c/= :: S3DestinationConfiguration -> S3DestinationConfiguration -> Bool
== :: S3DestinationConfiguration -> S3DestinationConfiguration -> Bool
$c== :: S3DestinationConfiguration -> S3DestinationConfiguration -> Bool
Prelude.Eq, ReadPrec [S3DestinationConfiguration]
ReadPrec S3DestinationConfiguration
Int -> ReadS S3DestinationConfiguration
ReadS [S3DestinationConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3DestinationConfiguration]
$creadListPrec :: ReadPrec [S3DestinationConfiguration]
readPrec :: ReadPrec S3DestinationConfiguration
$creadPrec :: ReadPrec S3DestinationConfiguration
readList :: ReadS [S3DestinationConfiguration]
$creadList :: ReadS [S3DestinationConfiguration]
readsPrec :: Int -> ReadS S3DestinationConfiguration
$creadsPrec :: Int -> ReadS S3DestinationConfiguration
Prelude.Read, Int -> S3DestinationConfiguration -> ShowS
[S3DestinationConfiguration] -> ShowS
S3DestinationConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3DestinationConfiguration] -> ShowS
$cshowList :: [S3DestinationConfiguration] -> ShowS
show :: S3DestinationConfiguration -> String
$cshow :: S3DestinationConfiguration -> String
showsPrec :: Int -> S3DestinationConfiguration -> ShowS
$cshowsPrec :: Int -> S3DestinationConfiguration -> ShowS
Prelude.Show, forall x.
Rep S3DestinationConfiguration x -> S3DestinationConfiguration
forall x.
S3DestinationConfiguration -> Rep S3DestinationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep S3DestinationConfiguration x -> S3DestinationConfiguration
$cfrom :: forall x.
S3DestinationConfiguration -> Rep S3DestinationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'S3DestinationConfiguration' 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:
--
-- 'bucketName', 's3DestinationConfiguration_bucketName' - Name of the Amazon S3 bucket where chat activity will be logged.
newS3DestinationConfiguration ::
  -- | 'bucketName'
  Prelude.Text ->
  S3DestinationConfiguration
newS3DestinationConfiguration :: Text -> S3DestinationConfiguration
newS3DestinationConfiguration Text
pBucketName_ =
  S3DestinationConfiguration'
    { $sel:bucketName:S3DestinationConfiguration' :: Text
bucketName =
        Text
pBucketName_
    }

-- | Name of the Amazon S3 bucket where chat activity will be logged.
s3DestinationConfiguration_bucketName :: Lens.Lens' S3DestinationConfiguration Prelude.Text
s3DestinationConfiguration_bucketName :: Lens' S3DestinationConfiguration Text
s3DestinationConfiguration_bucketName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3DestinationConfiguration' {Text
bucketName :: Text
$sel:bucketName:S3DestinationConfiguration' :: S3DestinationConfiguration -> Text
bucketName} -> Text
bucketName) (\s :: S3DestinationConfiguration
s@S3DestinationConfiguration' {} Text
a -> S3DestinationConfiguration
s {$sel:bucketName:S3DestinationConfiguration' :: Text
bucketName = Text
a} :: S3DestinationConfiguration)

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

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

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

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