{-# 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.CustomerProfiles.Types.S3ExportingConfig
-- 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.CustomerProfiles.Types.S3ExportingConfig 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

-- | Configuration information about the S3 bucket where Identity Resolution
-- Jobs write result files.
--
-- /See:/ 'newS3ExportingConfig' smart constructor.
data S3ExportingConfig = S3ExportingConfig'
  { -- | The S3 key name of the location where Identity Resolution Jobs write
    -- result files.
    S3ExportingConfig -> Maybe Text
s3KeyName :: Prelude.Maybe Prelude.Text,
    -- | The name of the S3 bucket where Identity Resolution Jobs write result
    -- files.
    S3ExportingConfig -> Text
s3BucketName :: Prelude.Text
  }
  deriving (S3ExportingConfig -> S3ExportingConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3ExportingConfig -> S3ExportingConfig -> Bool
$c/= :: S3ExportingConfig -> S3ExportingConfig -> Bool
== :: S3ExportingConfig -> S3ExportingConfig -> Bool
$c== :: S3ExportingConfig -> S3ExportingConfig -> Bool
Prelude.Eq, ReadPrec [S3ExportingConfig]
ReadPrec S3ExportingConfig
Int -> ReadS S3ExportingConfig
ReadS [S3ExportingConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3ExportingConfig]
$creadListPrec :: ReadPrec [S3ExportingConfig]
readPrec :: ReadPrec S3ExportingConfig
$creadPrec :: ReadPrec S3ExportingConfig
readList :: ReadS [S3ExportingConfig]
$creadList :: ReadS [S3ExportingConfig]
readsPrec :: Int -> ReadS S3ExportingConfig
$creadsPrec :: Int -> ReadS S3ExportingConfig
Prelude.Read, Int -> S3ExportingConfig -> ShowS
[S3ExportingConfig] -> ShowS
S3ExportingConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3ExportingConfig] -> ShowS
$cshowList :: [S3ExportingConfig] -> ShowS
show :: S3ExportingConfig -> String
$cshow :: S3ExportingConfig -> String
showsPrec :: Int -> S3ExportingConfig -> ShowS
$cshowsPrec :: Int -> S3ExportingConfig -> ShowS
Prelude.Show, forall x. Rep S3ExportingConfig x -> S3ExportingConfig
forall x. S3ExportingConfig -> Rep S3ExportingConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3ExportingConfig x -> S3ExportingConfig
$cfrom :: forall x. S3ExportingConfig -> Rep S3ExportingConfig x
Prelude.Generic)

-- |
-- Create a value of 'S3ExportingConfig' 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:
--
-- 's3KeyName', 's3ExportingConfig_s3KeyName' - The S3 key name of the location where Identity Resolution Jobs write
-- result files.
--
-- 's3BucketName', 's3ExportingConfig_s3BucketName' - The name of the S3 bucket where Identity Resolution Jobs write result
-- files.
newS3ExportingConfig ::
  -- | 's3BucketName'
  Prelude.Text ->
  S3ExportingConfig
newS3ExportingConfig :: Text -> S3ExportingConfig
newS3ExportingConfig Text
pS3BucketName_ =
  S3ExportingConfig'
    { $sel:s3KeyName:S3ExportingConfig' :: Maybe Text
s3KeyName = forall a. Maybe a
Prelude.Nothing,
      $sel:s3BucketName:S3ExportingConfig' :: Text
s3BucketName = Text
pS3BucketName_
    }

-- | The S3 key name of the location where Identity Resolution Jobs write
-- result files.
s3ExportingConfig_s3KeyName :: Lens.Lens' S3ExportingConfig (Prelude.Maybe Prelude.Text)
s3ExportingConfig_s3KeyName :: Lens' S3ExportingConfig (Maybe Text)
s3ExportingConfig_s3KeyName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3ExportingConfig' {Maybe Text
s3KeyName :: Maybe Text
$sel:s3KeyName:S3ExportingConfig' :: S3ExportingConfig -> Maybe Text
s3KeyName} -> Maybe Text
s3KeyName) (\s :: S3ExportingConfig
s@S3ExportingConfig' {} Maybe Text
a -> S3ExportingConfig
s {$sel:s3KeyName:S3ExportingConfig' :: Maybe Text
s3KeyName = Maybe Text
a} :: S3ExportingConfig)

-- | The name of the S3 bucket where Identity Resolution Jobs write result
-- files.
s3ExportingConfig_s3BucketName :: Lens.Lens' S3ExportingConfig Prelude.Text
s3ExportingConfig_s3BucketName :: Lens' S3ExportingConfig Text
s3ExportingConfig_s3BucketName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3ExportingConfig' {Text
s3BucketName :: Text
$sel:s3BucketName:S3ExportingConfig' :: S3ExportingConfig -> Text
s3BucketName} -> Text
s3BucketName) (\s :: S3ExportingConfig
s@S3ExportingConfig' {} Text
a -> S3ExportingConfig
s {$sel:s3BucketName:S3ExportingConfig' :: Text
s3BucketName = Text
a} :: S3ExportingConfig)

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

instance Prelude.Hashable S3ExportingConfig where
  hashWithSalt :: Int -> S3ExportingConfig -> Int
hashWithSalt Int
_salt S3ExportingConfig' {Maybe Text
Text
s3BucketName :: Text
s3KeyName :: Maybe Text
$sel:s3BucketName:S3ExportingConfig' :: S3ExportingConfig -> Text
$sel:s3KeyName:S3ExportingConfig' :: S3ExportingConfig -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3KeyName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
s3BucketName

instance Prelude.NFData S3ExportingConfig where
  rnf :: S3ExportingConfig -> ()
rnf S3ExportingConfig' {Maybe Text
Text
s3BucketName :: Text
s3KeyName :: Maybe Text
$sel:s3BucketName:S3ExportingConfig' :: S3ExportingConfig -> Text
$sel:s3KeyName:S3ExportingConfig' :: S3ExportingConfig -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3KeyName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
s3BucketName

instance Data.ToJSON S3ExportingConfig where
  toJSON :: S3ExportingConfig -> Value
toJSON S3ExportingConfig' {Maybe Text
Text
s3BucketName :: Text
s3KeyName :: Maybe Text
$sel:s3BucketName:S3ExportingConfig' :: S3ExportingConfig -> Text
$sel:s3KeyName:S3ExportingConfig' :: S3ExportingConfig -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"S3KeyName" 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
s3KeyName,
            forall a. a -> Maybe a
Prelude.Just (Key
"S3BucketName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
s3BucketName)
          ]
      )