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