{-# 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.ExportingConfig
-- 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.ExportingConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.CustomerProfiles.Types.S3ExportingConfig
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Configuration information about the S3 bucket where Identity Resolution
-- Jobs writes result files.
--
-- You need to give Customer Profiles service principal write permission to
-- your S3 bucket. Otherwise, you\'ll get an exception in the API response.
-- For an example policy, see
-- <https://docs.aws.amazon.com/connect/latest/adminguide/cross-service-confused-deputy-prevention.html#customer-profiles-cross-service Amazon Connect Customer Profiles cross-service confused deputy prevention>.
--
-- /See:/ 'newExportingConfig' smart constructor.
data ExportingConfig = ExportingConfig'
  { -- | The S3 location where Identity Resolution Jobs write result files.
    ExportingConfig -> Maybe S3ExportingConfig
s3Exporting :: Prelude.Maybe S3ExportingConfig
  }
  deriving (ExportingConfig -> ExportingConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportingConfig -> ExportingConfig -> Bool
$c/= :: ExportingConfig -> ExportingConfig -> Bool
== :: ExportingConfig -> ExportingConfig -> Bool
$c== :: ExportingConfig -> ExportingConfig -> Bool
Prelude.Eq, ReadPrec [ExportingConfig]
ReadPrec ExportingConfig
Int -> ReadS ExportingConfig
ReadS [ExportingConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExportingConfig]
$creadListPrec :: ReadPrec [ExportingConfig]
readPrec :: ReadPrec ExportingConfig
$creadPrec :: ReadPrec ExportingConfig
readList :: ReadS [ExportingConfig]
$creadList :: ReadS [ExportingConfig]
readsPrec :: Int -> ReadS ExportingConfig
$creadsPrec :: Int -> ReadS ExportingConfig
Prelude.Read, Int -> ExportingConfig -> ShowS
[ExportingConfig] -> ShowS
ExportingConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExportingConfig] -> ShowS
$cshowList :: [ExportingConfig] -> ShowS
show :: ExportingConfig -> String
$cshow :: ExportingConfig -> String
showsPrec :: Int -> ExportingConfig -> ShowS
$cshowsPrec :: Int -> ExportingConfig -> ShowS
Prelude.Show, forall x. Rep ExportingConfig x -> ExportingConfig
forall x. ExportingConfig -> Rep ExportingConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExportingConfig x -> ExportingConfig
$cfrom :: forall x. ExportingConfig -> Rep ExportingConfig x
Prelude.Generic)

-- |
-- Create a value of 'ExportingConfig' 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:
--
-- 's3Exporting', 'exportingConfig_s3Exporting' - The S3 location where Identity Resolution Jobs write result files.
newExportingConfig ::
  ExportingConfig
newExportingConfig :: ExportingConfig
newExportingConfig =
  ExportingConfig' {$sel:s3Exporting:ExportingConfig' :: Maybe S3ExportingConfig
s3Exporting = forall a. Maybe a
Prelude.Nothing}

-- | The S3 location where Identity Resolution Jobs write result files.
exportingConfig_s3Exporting :: Lens.Lens' ExportingConfig (Prelude.Maybe S3ExportingConfig)
exportingConfig_s3Exporting :: Lens' ExportingConfig (Maybe S3ExportingConfig)
exportingConfig_s3Exporting = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportingConfig' {Maybe S3ExportingConfig
s3Exporting :: Maybe S3ExportingConfig
$sel:s3Exporting:ExportingConfig' :: ExportingConfig -> Maybe S3ExportingConfig
s3Exporting} -> Maybe S3ExportingConfig
s3Exporting) (\s :: ExportingConfig
s@ExportingConfig' {} Maybe S3ExportingConfig
a -> ExportingConfig
s {$sel:s3Exporting:ExportingConfig' :: Maybe S3ExportingConfig
s3Exporting = Maybe S3ExportingConfig
a} :: ExportingConfig)

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

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

instance Prelude.NFData ExportingConfig where
  rnf :: ExportingConfig -> ()
rnf ExportingConfig' {Maybe S3ExportingConfig
s3Exporting :: Maybe S3ExportingConfig
$sel:s3Exporting:ExportingConfig' :: ExportingConfig -> Maybe S3ExportingConfig
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe S3ExportingConfig
s3Exporting

instance Data.ToJSON ExportingConfig where
  toJSON :: ExportingConfig -> Value
toJSON ExportingConfig' {Maybe S3ExportingConfig
s3Exporting :: Maybe S3ExportingConfig
$sel:s3Exporting:ExportingConfig' :: ExportingConfig -> Maybe S3ExportingConfig
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"S3Exporting" 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 S3ExportingConfig
s3Exporting]
      )