{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- 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.Lens as Lens
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
(S3InputFormatConfig -> S3InputFormatConfig -> Bool)
-> (S3InputFormatConfig -> S3InputFormatConfig -> Bool)
-> Eq S3InputFormatConfig
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]
(Int -> ReadS S3InputFormatConfig)
-> ReadS [S3InputFormatConfig]
-> ReadPrec S3InputFormatConfig
-> ReadPrec [S3InputFormatConfig]
-> Read 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
(Int -> S3InputFormatConfig -> ShowS)
-> (S3InputFormatConfig -> String)
-> ([S3InputFormatConfig] -> ShowS)
-> Show S3InputFormatConfig
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. S3InputFormatConfig -> Rep S3InputFormatConfig x)
-> (forall x. Rep S3InputFormatConfig x -> S3InputFormatConfig)
-> Generic S3InputFormatConfig
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' :: Maybe S3InputFileType -> S3InputFormatConfig
S3InputFormatConfig'
    { $sel:s3InputFileType:S3InputFormatConfig' :: Maybe S3InputFileType
s3InputFileType =
        Maybe 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 :: (Maybe S3InputFileType -> f (Maybe S3InputFileType))
-> S3InputFormatConfig -> f S3InputFormatConfig
s3InputFormatConfig_s3InputFileType = (S3InputFormatConfig -> Maybe S3InputFileType)
-> (S3InputFormatConfig
    -> Maybe S3InputFileType -> S3InputFormatConfig)
-> Lens
     S3InputFormatConfig
     S3InputFormatConfig
     (Maybe S3InputFileType)
     (Maybe 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 Core.FromJSON S3InputFormatConfig where
  parseJSON :: Value -> Parser S3InputFormatConfig
parseJSON =
    String
-> (Object -> Parser S3InputFormatConfig)
-> Value
-> Parser S3InputFormatConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"S3InputFormatConfig"
      ( \Object
x ->
          Maybe S3InputFileType -> S3InputFormatConfig
S3InputFormatConfig'
            (Maybe S3InputFileType -> S3InputFormatConfig)
-> Parser (Maybe S3InputFileType) -> Parser S3InputFormatConfig
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe S3InputFileType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"s3InputFileType")
      )

instance Prelude.Hashable S3InputFormatConfig

instance Prelude.NFData S3InputFormatConfig

instance Core.ToJSON S3InputFormatConfig where
  toJSON :: S3InputFormatConfig -> Value
toJSON S3InputFormatConfig' {Maybe S3InputFileType
s3InputFileType :: Maybe S3InputFileType
$sel:s3InputFileType:S3InputFormatConfig' :: S3InputFormatConfig -> Maybe S3InputFileType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"s3InputFileType" Text -> S3InputFileType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (S3InputFileType -> Pair) -> Maybe S3InputFileType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3InputFileType
s3InputFileType
          ]
      )