{-# 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 #-}
module Amazonka.AppFlow.Types.S3SourceProperties where
import Amazonka.AppFlow.Types.S3InputFormatConfig
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data S3SourceProperties = S3SourceProperties'
{ S3SourceProperties -> Maybe S3InputFormatConfig
s3InputFormatConfig :: Prelude.Maybe S3InputFormatConfig,
S3SourceProperties -> Maybe Text
bucketPrefix :: Prelude.Maybe Prelude.Text,
S3SourceProperties -> Text
bucketName :: Prelude.Text
}
deriving (S3SourceProperties -> S3SourceProperties -> Bool
(S3SourceProperties -> S3SourceProperties -> Bool)
-> (S3SourceProperties -> S3SourceProperties -> Bool)
-> Eq S3SourceProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3SourceProperties -> S3SourceProperties -> Bool
$c/= :: S3SourceProperties -> S3SourceProperties -> Bool
== :: S3SourceProperties -> S3SourceProperties -> Bool
$c== :: S3SourceProperties -> S3SourceProperties -> Bool
Prelude.Eq, ReadPrec [S3SourceProperties]
ReadPrec S3SourceProperties
Int -> ReadS S3SourceProperties
ReadS [S3SourceProperties]
(Int -> ReadS S3SourceProperties)
-> ReadS [S3SourceProperties]
-> ReadPrec S3SourceProperties
-> ReadPrec [S3SourceProperties]
-> Read S3SourceProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3SourceProperties]
$creadListPrec :: ReadPrec [S3SourceProperties]
readPrec :: ReadPrec S3SourceProperties
$creadPrec :: ReadPrec S3SourceProperties
readList :: ReadS [S3SourceProperties]
$creadList :: ReadS [S3SourceProperties]
readsPrec :: Int -> ReadS S3SourceProperties
$creadsPrec :: Int -> ReadS S3SourceProperties
Prelude.Read, Int -> S3SourceProperties -> ShowS
[S3SourceProperties] -> ShowS
S3SourceProperties -> String
(Int -> S3SourceProperties -> ShowS)
-> (S3SourceProperties -> String)
-> ([S3SourceProperties] -> ShowS)
-> Show S3SourceProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3SourceProperties] -> ShowS
$cshowList :: [S3SourceProperties] -> ShowS
show :: S3SourceProperties -> String
$cshow :: S3SourceProperties -> String
showsPrec :: Int -> S3SourceProperties -> ShowS
$cshowsPrec :: Int -> S3SourceProperties -> ShowS
Prelude.Show, (forall x. S3SourceProperties -> Rep S3SourceProperties x)
-> (forall x. Rep S3SourceProperties x -> S3SourceProperties)
-> Generic S3SourceProperties
forall x. Rep S3SourceProperties x -> S3SourceProperties
forall x. S3SourceProperties -> Rep S3SourceProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3SourceProperties x -> S3SourceProperties
$cfrom :: forall x. S3SourceProperties -> Rep S3SourceProperties x
Prelude.Generic)
newS3SourceProperties ::
Prelude.Text ->
S3SourceProperties
newS3SourceProperties :: Text -> S3SourceProperties
newS3SourceProperties Text
pBucketName_ =
S3SourceProperties' :: Maybe S3InputFormatConfig
-> Maybe Text -> Text -> S3SourceProperties
S3SourceProperties'
{ $sel:s3InputFormatConfig:S3SourceProperties' :: Maybe S3InputFormatConfig
s3InputFormatConfig =
Maybe S3InputFormatConfig
forall a. Maybe a
Prelude.Nothing,
$sel:bucketPrefix:S3SourceProperties' :: Maybe Text
bucketPrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:bucketName:S3SourceProperties' :: Text
bucketName = Text
pBucketName_
}
s3SourceProperties_s3InputFormatConfig :: Lens.Lens' S3SourceProperties (Prelude.Maybe S3InputFormatConfig)
s3SourceProperties_s3InputFormatConfig :: (Maybe S3InputFormatConfig -> f (Maybe S3InputFormatConfig))
-> S3SourceProperties -> f S3SourceProperties
s3SourceProperties_s3InputFormatConfig = (S3SourceProperties -> Maybe S3InputFormatConfig)
-> (S3SourceProperties
-> Maybe S3InputFormatConfig -> S3SourceProperties)
-> Lens
S3SourceProperties
S3SourceProperties
(Maybe S3InputFormatConfig)
(Maybe S3InputFormatConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3SourceProperties' {Maybe S3InputFormatConfig
s3InputFormatConfig :: Maybe S3InputFormatConfig
$sel:s3InputFormatConfig:S3SourceProperties' :: S3SourceProperties -> Maybe S3InputFormatConfig
s3InputFormatConfig} -> Maybe S3InputFormatConfig
s3InputFormatConfig) (\s :: S3SourceProperties
s@S3SourceProperties' {} Maybe S3InputFormatConfig
a -> S3SourceProperties
s {$sel:s3InputFormatConfig:S3SourceProperties' :: Maybe S3InputFormatConfig
s3InputFormatConfig = Maybe S3InputFormatConfig
a} :: S3SourceProperties)
s3SourceProperties_bucketPrefix :: Lens.Lens' S3SourceProperties (Prelude.Maybe Prelude.Text)
s3SourceProperties_bucketPrefix :: (Maybe Text -> f (Maybe Text))
-> S3SourceProperties -> f S3SourceProperties
s3SourceProperties_bucketPrefix = (S3SourceProperties -> Maybe Text)
-> (S3SourceProperties -> Maybe Text -> S3SourceProperties)
-> Lens
S3SourceProperties S3SourceProperties (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3SourceProperties' {Maybe Text
bucketPrefix :: Maybe Text
$sel:bucketPrefix:S3SourceProperties' :: S3SourceProperties -> Maybe Text
bucketPrefix} -> Maybe Text
bucketPrefix) (\s :: S3SourceProperties
s@S3SourceProperties' {} Maybe Text
a -> S3SourceProperties
s {$sel:bucketPrefix:S3SourceProperties' :: Maybe Text
bucketPrefix = Maybe Text
a} :: S3SourceProperties)
s3SourceProperties_bucketName :: Lens.Lens' S3SourceProperties Prelude.Text
s3SourceProperties_bucketName :: (Text -> f Text) -> S3SourceProperties -> f S3SourceProperties
s3SourceProperties_bucketName = (S3SourceProperties -> Text)
-> (S3SourceProperties -> Text -> S3SourceProperties)
-> Lens S3SourceProperties S3SourceProperties Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3SourceProperties' {Text
bucketName :: Text
$sel:bucketName:S3SourceProperties' :: S3SourceProperties -> Text
bucketName} -> Text
bucketName) (\s :: S3SourceProperties
s@S3SourceProperties' {} Text
a -> S3SourceProperties
s {$sel:bucketName:S3SourceProperties' :: Text
bucketName = Text
a} :: S3SourceProperties)
instance Core.FromJSON S3SourceProperties where
parseJSON :: Value -> Parser S3SourceProperties
parseJSON =
String
-> (Object -> Parser S3SourceProperties)
-> Value
-> Parser S3SourceProperties
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"S3SourceProperties"
( \Object
x ->
Maybe S3InputFormatConfig
-> Maybe Text -> Text -> S3SourceProperties
S3SourceProperties'
(Maybe S3InputFormatConfig
-> Maybe Text -> Text -> S3SourceProperties)
-> Parser (Maybe S3InputFormatConfig)
-> Parser (Maybe Text -> Text -> S3SourceProperties)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe S3InputFormatConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"s3InputFormatConfig")
Parser (Maybe Text -> Text -> S3SourceProperties)
-> Parser (Maybe Text) -> Parser (Text -> S3SourceProperties)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"bucketPrefix")
Parser (Text -> S3SourceProperties)
-> Parser Text -> Parser S3SourceProperties
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"bucketName")
)
instance Prelude.Hashable S3SourceProperties
instance Prelude.NFData S3SourceProperties
instance Core.ToJSON S3SourceProperties where
toJSON :: S3SourceProperties -> Value
toJSON S3SourceProperties' {Maybe Text
Maybe S3InputFormatConfig
Text
bucketName :: Text
bucketPrefix :: Maybe Text
s3InputFormatConfig :: Maybe S3InputFormatConfig
$sel:bucketName:S3SourceProperties' :: S3SourceProperties -> Text
$sel:bucketPrefix:S3SourceProperties' :: S3SourceProperties -> Maybe Text
$sel:s3InputFormatConfig:S3SourceProperties' :: S3SourceProperties -> Maybe S3InputFormatConfig
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"s3InputFormatConfig" Text -> S3InputFormatConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(S3InputFormatConfig -> Pair)
-> Maybe S3InputFormatConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3InputFormatConfig
s3InputFormatConfig,
(Text
"bucketPrefix" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
bucketPrefix,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"bucketName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
bucketName)
]
)