{-# 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.KinesisAnalyticsV2.Types.S3ContentLocation where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data S3ContentLocation = S3ContentLocation'
{
S3ContentLocation -> Maybe Text
objectVersion :: Prelude.Maybe Prelude.Text,
S3ContentLocation -> Text
bucketARN :: Prelude.Text,
S3ContentLocation -> Text
fileKey :: Prelude.Text
}
deriving (S3ContentLocation -> S3ContentLocation -> Bool
(S3ContentLocation -> S3ContentLocation -> Bool)
-> (S3ContentLocation -> S3ContentLocation -> Bool)
-> Eq S3ContentLocation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3ContentLocation -> S3ContentLocation -> Bool
$c/= :: S3ContentLocation -> S3ContentLocation -> Bool
== :: S3ContentLocation -> S3ContentLocation -> Bool
$c== :: S3ContentLocation -> S3ContentLocation -> Bool
Prelude.Eq, ReadPrec [S3ContentLocation]
ReadPrec S3ContentLocation
Int -> ReadS S3ContentLocation
ReadS [S3ContentLocation]
(Int -> ReadS S3ContentLocation)
-> ReadS [S3ContentLocation]
-> ReadPrec S3ContentLocation
-> ReadPrec [S3ContentLocation]
-> Read S3ContentLocation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3ContentLocation]
$creadListPrec :: ReadPrec [S3ContentLocation]
readPrec :: ReadPrec S3ContentLocation
$creadPrec :: ReadPrec S3ContentLocation
readList :: ReadS [S3ContentLocation]
$creadList :: ReadS [S3ContentLocation]
readsPrec :: Int -> ReadS S3ContentLocation
$creadsPrec :: Int -> ReadS S3ContentLocation
Prelude.Read, Int -> S3ContentLocation -> ShowS
[S3ContentLocation] -> ShowS
S3ContentLocation -> String
(Int -> S3ContentLocation -> ShowS)
-> (S3ContentLocation -> String)
-> ([S3ContentLocation] -> ShowS)
-> Show S3ContentLocation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3ContentLocation] -> ShowS
$cshowList :: [S3ContentLocation] -> ShowS
show :: S3ContentLocation -> String
$cshow :: S3ContentLocation -> String
showsPrec :: Int -> S3ContentLocation -> ShowS
$cshowsPrec :: Int -> S3ContentLocation -> ShowS
Prelude.Show, (forall x. S3ContentLocation -> Rep S3ContentLocation x)
-> (forall x. Rep S3ContentLocation x -> S3ContentLocation)
-> Generic S3ContentLocation
forall x. Rep S3ContentLocation x -> S3ContentLocation
forall x. S3ContentLocation -> Rep S3ContentLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3ContentLocation x -> S3ContentLocation
$cfrom :: forall x. S3ContentLocation -> Rep S3ContentLocation x
Prelude.Generic)
newS3ContentLocation ::
Prelude.Text ->
Prelude.Text ->
S3ContentLocation
newS3ContentLocation :: Text -> Text -> S3ContentLocation
newS3ContentLocation Text
pBucketARN_ Text
pFileKey_ =
S3ContentLocation' :: Maybe Text -> Text -> Text -> S3ContentLocation
S3ContentLocation'
{ $sel:objectVersion:S3ContentLocation' :: Maybe Text
objectVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:bucketARN:S3ContentLocation' :: Text
bucketARN = Text
pBucketARN_,
$sel:fileKey:S3ContentLocation' :: Text
fileKey = Text
pFileKey_
}
s3ContentLocation_objectVersion :: Lens.Lens' S3ContentLocation (Prelude.Maybe Prelude.Text)
s3ContentLocation_objectVersion :: (Maybe Text -> f (Maybe Text))
-> S3ContentLocation -> f S3ContentLocation
s3ContentLocation_objectVersion = (S3ContentLocation -> Maybe Text)
-> (S3ContentLocation -> Maybe Text -> S3ContentLocation)
-> Lens
S3ContentLocation S3ContentLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3ContentLocation' {Maybe Text
objectVersion :: Maybe Text
$sel:objectVersion:S3ContentLocation' :: S3ContentLocation -> Maybe Text
objectVersion} -> Maybe Text
objectVersion) (\s :: S3ContentLocation
s@S3ContentLocation' {} Maybe Text
a -> S3ContentLocation
s {$sel:objectVersion:S3ContentLocation' :: Maybe Text
objectVersion = Maybe Text
a} :: S3ContentLocation)
s3ContentLocation_bucketARN :: Lens.Lens' S3ContentLocation Prelude.Text
s3ContentLocation_bucketARN :: (Text -> f Text) -> S3ContentLocation -> f S3ContentLocation
s3ContentLocation_bucketARN = (S3ContentLocation -> Text)
-> (S3ContentLocation -> Text -> S3ContentLocation)
-> Lens S3ContentLocation S3ContentLocation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3ContentLocation' {Text
bucketARN :: Text
$sel:bucketARN:S3ContentLocation' :: S3ContentLocation -> Text
bucketARN} -> Text
bucketARN) (\s :: S3ContentLocation
s@S3ContentLocation' {} Text
a -> S3ContentLocation
s {$sel:bucketARN:S3ContentLocation' :: Text
bucketARN = Text
a} :: S3ContentLocation)
s3ContentLocation_fileKey :: Lens.Lens' S3ContentLocation Prelude.Text
s3ContentLocation_fileKey :: (Text -> f Text) -> S3ContentLocation -> f S3ContentLocation
s3ContentLocation_fileKey = (S3ContentLocation -> Text)
-> (S3ContentLocation -> Text -> S3ContentLocation)
-> Lens S3ContentLocation S3ContentLocation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3ContentLocation' {Text
fileKey :: Text
$sel:fileKey:S3ContentLocation' :: S3ContentLocation -> Text
fileKey} -> Text
fileKey) (\s :: S3ContentLocation
s@S3ContentLocation' {} Text
a -> S3ContentLocation
s {$sel:fileKey:S3ContentLocation' :: Text
fileKey = Text
a} :: S3ContentLocation)
instance Core.FromJSON S3ContentLocation where
parseJSON :: Value -> Parser S3ContentLocation
parseJSON =
String
-> (Object -> Parser S3ContentLocation)
-> Value
-> Parser S3ContentLocation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"S3ContentLocation"
( \Object
x ->
Maybe Text -> Text -> Text -> S3ContentLocation
S3ContentLocation'
(Maybe Text -> Text -> Text -> S3ContentLocation)
-> Parser (Maybe Text)
-> Parser (Text -> Text -> S3ContentLocation)
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
"ObjectVersion")
Parser (Text -> Text -> S3ContentLocation)
-> Parser Text -> Parser (Text -> S3ContentLocation)
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
"BucketARN")
Parser (Text -> S3ContentLocation)
-> Parser Text -> Parser S3ContentLocation
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
"FileKey")
)
instance Prelude.Hashable S3ContentLocation
instance Prelude.NFData S3ContentLocation
instance Core.ToJSON S3ContentLocation where
toJSON :: S3ContentLocation -> Value
toJSON S3ContentLocation' {Maybe Text
Text
fileKey :: Text
bucketARN :: Text
objectVersion :: Maybe Text
$sel:fileKey:S3ContentLocation' :: S3ContentLocation -> Text
$sel:bucketARN:S3ContentLocation' :: S3ContentLocation -> Text
$sel:objectVersion:S3ContentLocation' :: S3ContentLocation -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ObjectVersion" 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
objectVersion,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"BucketARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
bucketARN),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"FileKey" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
fileKey)
]
)