{-# 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.AppFlow.Types.S3InputFormatConfig
-- 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.AppFlow.Types.S3InputFormatConfig where

import Amazonka.AppFlow.Types.S3InputFileType
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

-- | When you use Amazon S3 as the source, the configuration format that you
-- provide the flow input data.
--
-- /See:/ 'newS3InputFormatConfig' smart constructor.
data S3InputFormatConfig = S3InputFormatConfig'
  { -- | The file type that Amazon AppFlow gets from your Amazon S3 bucket.
    S3InputFormatConfig -> Maybe S3InputFileType
s3InputFileType :: Prelude.Maybe S3InputFileType
  }
  deriving (S3InputFormatConfig -> S3InputFormatConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3InputFormatConfig -> S3InputFormatConfig -> Bool
$c/= :: S3InputFormatConfig -> S3InputFormatConfig -> Bool
== :: S3InputFormatConfig -> S3InputFormatConfig -> Bool
$c== :: S3InputFormatConfig -> S3InputFormatConfig -> Bool
Prelude.Eq, ReadPrec [S3InputFormatConfig]
ReadPrec S3InputFormatConfig
Int -> ReadS S3InputFormatConfig
ReadS [S3InputFormatConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3InputFormatConfig]
$creadListPrec :: ReadPrec [S3InputFormatConfig]
readPrec :: ReadPrec S3InputFormatConfig
$creadPrec :: ReadPrec S3InputFormatConfig
readList :: ReadS [S3InputFormatConfig]
$creadList :: ReadS [S3InputFormatConfig]
readsPrec :: Int -> ReadS S3InputFormatConfig
$creadsPrec :: Int -> ReadS S3InputFormatConfig
Prelude.Read, Int -> S3InputFormatConfig -> ShowS
[S3InputFormatConfig] -> ShowS
S3InputFormatConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3InputFormatConfig] -> ShowS
$cshowList :: [S3InputFormatConfig] -> ShowS
show :: S3InputFormatConfig -> String
$cshow :: S3InputFormatConfig -> String
showsPrec :: Int -> S3InputFormatConfig -> ShowS
$cshowsPrec :: Int -> S3InputFormatConfig -> ShowS
Prelude.Show, forall x. Rep S3InputFormatConfig x -> S3InputFormatConfig
forall x. S3InputFormatConfig -> Rep S3InputFormatConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3InputFormatConfig x -> S3InputFormatConfig
$cfrom :: forall x. S3InputFormatConfig -> Rep S3InputFormatConfig x
Prelude.Generic)

-- |
-- Create a value of 'S3InputFormatConfig' 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:
--
-- 's3InputFileType', 's3InputFormatConfig_s3InputFileType' - The file type that Amazon AppFlow gets from your Amazon S3 bucket.
newS3InputFormatConfig ::
  S3InputFormatConfig
newS3InputFormatConfig :: S3InputFormatConfig
newS3InputFormatConfig =
  S3InputFormatConfig'
    { $sel:s3InputFileType:S3InputFormatConfig' :: Maybe S3InputFileType
s3InputFileType =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The file type that Amazon AppFlow gets from your Amazon S3 bucket.
s3InputFormatConfig_s3InputFileType :: Lens.Lens' S3InputFormatConfig (Prelude.Maybe S3InputFileType)
s3InputFormatConfig_s3InputFileType :: Lens' S3InputFormatConfig (Maybe S3InputFileType)
s3InputFormatConfig_s3InputFileType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3InputFormatConfig' {Maybe S3InputFileType
s3InputFileType :: Maybe S3InputFileType
$sel:s3InputFileType:S3InputFormatConfig' :: S3InputFormatConfig -> Maybe S3InputFileType
s3InputFileType} -> Maybe S3InputFileType
s3InputFileType) (\s :: S3InputFormatConfig
s@S3InputFormatConfig' {} Maybe S3InputFileType
a -> S3InputFormatConfig
s {$sel:s3InputFileType:S3InputFormatConfig' :: Maybe S3InputFileType
s3InputFileType = Maybe S3InputFileType
a} :: S3InputFormatConfig)

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

instance Prelude.Hashable S3InputFormatConfig where
  hashWithSalt :: Int -> S3InputFormatConfig -> Int
hashWithSalt Int
_salt S3InputFormatConfig' {Maybe S3InputFileType
s3InputFileType :: Maybe S3InputFileType
$sel:s3InputFileType:S3InputFormatConfig' :: S3InputFormatConfig -> Maybe S3InputFileType
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3InputFileType
s3InputFileType

instance Prelude.NFData S3InputFormatConfig where
  rnf :: S3InputFormatConfig -> ()
rnf S3InputFormatConfig' {Maybe S3InputFileType
s3InputFileType :: Maybe S3InputFileType
$sel:s3InputFileType:S3InputFormatConfig' :: S3InputFormatConfig -> Maybe S3InputFileType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe S3InputFileType
s3InputFileType

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