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