{-# 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.Transfer.Types.S3InputFileLocation where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data S3InputFileLocation = S3InputFileLocation'
{
S3InputFileLocation -> Maybe Text
bucket :: Prelude.Maybe Prelude.Text,
S3InputFileLocation -> Maybe Text
key :: Prelude.Maybe Prelude.Text
}
deriving (S3InputFileLocation -> S3InputFileLocation -> Bool
(S3InputFileLocation -> S3InputFileLocation -> Bool)
-> (S3InputFileLocation -> S3InputFileLocation -> Bool)
-> Eq S3InputFileLocation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3InputFileLocation -> S3InputFileLocation -> Bool
$c/= :: S3InputFileLocation -> S3InputFileLocation -> Bool
== :: S3InputFileLocation -> S3InputFileLocation -> Bool
$c== :: S3InputFileLocation -> S3InputFileLocation -> Bool
Prelude.Eq, ReadPrec [S3InputFileLocation]
ReadPrec S3InputFileLocation
Int -> ReadS S3InputFileLocation
ReadS [S3InputFileLocation]
(Int -> ReadS S3InputFileLocation)
-> ReadS [S3InputFileLocation]
-> ReadPrec S3InputFileLocation
-> ReadPrec [S3InputFileLocation]
-> Read S3InputFileLocation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3InputFileLocation]
$creadListPrec :: ReadPrec [S3InputFileLocation]
readPrec :: ReadPrec S3InputFileLocation
$creadPrec :: ReadPrec S3InputFileLocation
readList :: ReadS [S3InputFileLocation]
$creadList :: ReadS [S3InputFileLocation]
readsPrec :: Int -> ReadS S3InputFileLocation
$creadsPrec :: Int -> ReadS S3InputFileLocation
Prelude.Read, Int -> S3InputFileLocation -> ShowS
[S3InputFileLocation] -> ShowS
S3InputFileLocation -> String
(Int -> S3InputFileLocation -> ShowS)
-> (S3InputFileLocation -> String)
-> ([S3InputFileLocation] -> ShowS)
-> Show S3InputFileLocation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3InputFileLocation] -> ShowS
$cshowList :: [S3InputFileLocation] -> ShowS
show :: S3InputFileLocation -> String
$cshow :: S3InputFileLocation -> String
showsPrec :: Int -> S3InputFileLocation -> ShowS
$cshowsPrec :: Int -> S3InputFileLocation -> ShowS
Prelude.Show, (forall x. S3InputFileLocation -> Rep S3InputFileLocation x)
-> (forall x. Rep S3InputFileLocation x -> S3InputFileLocation)
-> Generic S3InputFileLocation
forall x. Rep S3InputFileLocation x -> S3InputFileLocation
forall x. S3InputFileLocation -> Rep S3InputFileLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3InputFileLocation x -> S3InputFileLocation
$cfrom :: forall x. S3InputFileLocation -> Rep S3InputFileLocation x
Prelude.Generic)
newS3InputFileLocation ::
S3InputFileLocation
newS3InputFileLocation :: S3InputFileLocation
newS3InputFileLocation =
S3InputFileLocation' :: Maybe Text -> Maybe Text -> S3InputFileLocation
S3InputFileLocation'
{ $sel:bucket:S3InputFileLocation' :: Maybe Text
bucket = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:key:S3InputFileLocation' :: Maybe Text
key = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
s3InputFileLocation_bucket :: Lens.Lens' S3InputFileLocation (Prelude.Maybe Prelude.Text)
s3InputFileLocation_bucket :: (Maybe Text -> f (Maybe Text))
-> S3InputFileLocation -> f S3InputFileLocation
s3InputFileLocation_bucket = (S3InputFileLocation -> Maybe Text)
-> (S3InputFileLocation -> Maybe Text -> S3InputFileLocation)
-> Lens
S3InputFileLocation S3InputFileLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3InputFileLocation' {Maybe Text
bucket :: Maybe Text
$sel:bucket:S3InputFileLocation' :: S3InputFileLocation -> Maybe Text
bucket} -> Maybe Text
bucket) (\s :: S3InputFileLocation
s@S3InputFileLocation' {} Maybe Text
a -> S3InputFileLocation
s {$sel:bucket:S3InputFileLocation' :: Maybe Text
bucket = Maybe Text
a} :: S3InputFileLocation)
s3InputFileLocation_key :: Lens.Lens' S3InputFileLocation (Prelude.Maybe Prelude.Text)
s3InputFileLocation_key :: (Maybe Text -> f (Maybe Text))
-> S3InputFileLocation -> f S3InputFileLocation
s3InputFileLocation_key = (S3InputFileLocation -> Maybe Text)
-> (S3InputFileLocation -> Maybe Text -> S3InputFileLocation)
-> Lens
S3InputFileLocation S3InputFileLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3InputFileLocation' {Maybe Text
key :: Maybe Text
$sel:key:S3InputFileLocation' :: S3InputFileLocation -> Maybe Text
key} -> Maybe Text
key) (\s :: S3InputFileLocation
s@S3InputFileLocation' {} Maybe Text
a -> S3InputFileLocation
s {$sel:key:S3InputFileLocation' :: Maybe Text
key = Maybe Text
a} :: S3InputFileLocation)
instance Core.FromJSON S3InputFileLocation where
parseJSON :: Value -> Parser S3InputFileLocation
parseJSON =
String
-> (Object -> Parser S3InputFileLocation)
-> Value
-> Parser S3InputFileLocation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"S3InputFileLocation"
( \Object
x ->
Maybe Text -> Maybe Text -> S3InputFileLocation
S3InputFileLocation'
(Maybe Text -> Maybe Text -> S3InputFileLocation)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> S3InputFileLocation)
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
"Bucket") Parser (Maybe Text -> S3InputFileLocation)
-> Parser (Maybe Text) -> Parser S3InputFileLocation
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
"Key")
)
instance Prelude.Hashable S3InputFileLocation
instance Prelude.NFData S3InputFileLocation
instance Core.ToJSON S3InputFileLocation where
toJSON :: S3InputFileLocation -> Value
toJSON S3InputFileLocation' {Maybe Text
key :: Maybe Text
bucket :: Maybe Text
$sel:key:S3InputFileLocation' :: S3InputFileLocation -> Maybe Text
$sel:bucket:S3InputFileLocation' :: S3InputFileLocation -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Bucket" 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
bucket,
(Text
"Key" 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
key
]
)