{-# 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.S3.Types.Object where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.Internal
import Amazonka.S3.Types.ObjectStorageClass
import Amazonka.S3.Types.Owner
data Object = Object'
{
Object -> Maybe Owner
owner :: Prelude.Maybe Owner,
Object -> ETag
eTag :: ETag,
Object -> Integer
size :: Prelude.Integer,
Object -> ObjectKey
key :: ObjectKey,
Object -> ObjectStorageClass
storageClass :: ObjectStorageClass,
Object -> ISO8601
lastModified :: Core.ISO8601
}
deriving (Object -> Object -> Bool
(Object -> Object -> Bool)
-> (Object -> Object -> Bool) -> Eq Object
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Object -> Object -> Bool
$c/= :: Object -> Object -> Bool
== :: Object -> Object -> Bool
$c== :: Object -> Object -> Bool
Prelude.Eq, ReadPrec [Object]
ReadPrec Object
Int -> ReadS Object
ReadS [Object]
(Int -> ReadS Object)
-> ReadS [Object]
-> ReadPrec Object
-> ReadPrec [Object]
-> Read Object
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Object]
$creadListPrec :: ReadPrec [Object]
readPrec :: ReadPrec Object
$creadPrec :: ReadPrec Object
readList :: ReadS [Object]
$creadList :: ReadS [Object]
readsPrec :: Int -> ReadS Object
$creadsPrec :: Int -> ReadS Object
Prelude.Read, Int -> Object -> ShowS
[Object] -> ShowS
Object -> String
(Int -> Object -> ShowS)
-> (Object -> String) -> ([Object] -> ShowS) -> Show Object
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Object] -> ShowS
$cshowList :: [Object] -> ShowS
show :: Object -> String
$cshow :: Object -> String
showsPrec :: Int -> Object -> ShowS
$cshowsPrec :: Int -> Object -> ShowS
Prelude.Show, (forall x. Object -> Rep Object x)
-> (forall x. Rep Object x -> Object) -> Generic Object
forall x. Rep Object x -> Object
forall x. Object -> Rep Object x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Object x -> Object
$cfrom :: forall x. Object -> Rep Object x
Prelude.Generic)
newObject ::
ETag ->
Prelude.Integer ->
ObjectKey ->
ObjectStorageClass ->
Prelude.UTCTime ->
Object
newObject :: ETag
-> Integer -> ObjectKey -> ObjectStorageClass -> UTCTime -> Object
newObject
ETag
pETag_
Integer
pSize_
ObjectKey
pKey_
ObjectStorageClass
pStorageClass_
UTCTime
pLastModified_ =
Object' :: Maybe Owner
-> ETag
-> Integer
-> ObjectKey
-> ObjectStorageClass
-> ISO8601
-> Object
Object'
{ $sel:owner:Object' :: Maybe Owner
owner = Maybe Owner
forall a. Maybe a
Prelude.Nothing,
$sel:eTag:Object' :: ETag
eTag = ETag
pETag_,
$sel:size:Object' :: Integer
size = Integer
pSize_,
$sel:key:Object' :: ObjectKey
key = ObjectKey
pKey_,
$sel:storageClass:Object' :: ObjectStorageClass
storageClass = ObjectStorageClass
pStorageClass_,
$sel:lastModified:Object' :: ISO8601
lastModified = Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601))
-> UTCTime -> ISO8601
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastModified_
}
object_owner :: Lens.Lens' Object (Prelude.Maybe Owner)
object_owner :: (Maybe Owner -> f (Maybe Owner)) -> Object -> f Object
object_owner = (Object -> Maybe Owner)
-> (Object -> Maybe Owner -> Object)
-> Lens Object Object (Maybe Owner) (Maybe Owner)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Object' {Maybe Owner
owner :: Maybe Owner
$sel:owner:Object' :: Object -> Maybe Owner
owner} -> Maybe Owner
owner) (\s :: Object
s@Object' {} Maybe Owner
a -> Object
s {$sel:owner:Object' :: Maybe Owner
owner = Maybe Owner
a} :: Object)
object_eTag :: Lens.Lens' Object ETag
object_eTag :: (ETag -> f ETag) -> Object -> f Object
object_eTag = (Object -> ETag)
-> (Object -> ETag -> Object) -> Lens Object Object ETag ETag
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Object' {ETag
eTag :: ETag
$sel:eTag:Object' :: Object -> ETag
eTag} -> ETag
eTag) (\s :: Object
s@Object' {} ETag
a -> Object
s {$sel:eTag:Object' :: ETag
eTag = ETag
a} :: Object)
object_size :: Lens.Lens' Object Prelude.Integer
object_size :: (Integer -> f Integer) -> Object -> f Object
object_size = (Object -> Integer)
-> (Object -> Integer -> Object)
-> Lens Object Object Integer Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Object' {Integer
size :: Integer
$sel:size:Object' :: Object -> Integer
size} -> Integer
size) (\s :: Object
s@Object' {} Integer
a -> Object
s {$sel:size:Object' :: Integer
size = Integer
a} :: Object)
object_key :: Lens.Lens' Object ObjectKey
object_key :: (ObjectKey -> f ObjectKey) -> Object -> f Object
object_key = (Object -> ObjectKey)
-> (Object -> ObjectKey -> Object)
-> Lens Object Object ObjectKey ObjectKey
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Object' {ObjectKey
key :: ObjectKey
$sel:key:Object' :: Object -> ObjectKey
key} -> ObjectKey
key) (\s :: Object
s@Object' {} ObjectKey
a -> Object
s {$sel:key:Object' :: ObjectKey
key = ObjectKey
a} :: Object)
object_storageClass :: Lens.Lens' Object ObjectStorageClass
object_storageClass :: (ObjectStorageClass -> f ObjectStorageClass) -> Object -> f Object
object_storageClass = (Object -> ObjectStorageClass)
-> (Object -> ObjectStorageClass -> Object)
-> Lens Object Object ObjectStorageClass ObjectStorageClass
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Object' {ObjectStorageClass
storageClass :: ObjectStorageClass
$sel:storageClass:Object' :: Object -> ObjectStorageClass
storageClass} -> ObjectStorageClass
storageClass) (\s :: Object
s@Object' {} ObjectStorageClass
a -> Object
s {$sel:storageClass:Object' :: ObjectStorageClass
storageClass = ObjectStorageClass
a} :: Object)
object_lastModified :: Lens.Lens' Object Prelude.UTCTime
object_lastModified :: (UTCTime -> f UTCTime) -> Object -> f Object
object_lastModified = (Object -> ISO8601)
-> (Object -> ISO8601 -> Object)
-> Lens Object Object ISO8601 ISO8601
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Object' {ISO8601
lastModified :: ISO8601
$sel:lastModified:Object' :: Object -> ISO8601
lastModified} -> ISO8601
lastModified) (\s :: Object
s@Object' {} ISO8601
a -> Object
s {$sel:lastModified:Object' :: ISO8601
lastModified = ISO8601
a} :: Object) ((ISO8601 -> f ISO8601) -> Object -> f Object)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> Object
-> f Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Core.FromXML Object where
parseXML :: [Node] -> Either String Object
parseXML [Node]
x =
Maybe Owner
-> ETag
-> Integer
-> ObjectKey
-> ObjectStorageClass
-> ISO8601
-> Object
Object'
(Maybe Owner
-> ETag
-> Integer
-> ObjectKey
-> ObjectStorageClass
-> ISO8601
-> Object)
-> Either String (Maybe Owner)
-> Either
String
(ETag
-> Integer -> ObjectKey -> ObjectStorageClass -> ISO8601 -> Object)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Owner)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Owner")
Either
String
(ETag
-> Integer -> ObjectKey -> ObjectStorageClass -> ISO8601 -> Object)
-> Either String ETag
-> Either
String
(Integer -> ObjectKey -> ObjectStorageClass -> ISO8601 -> Object)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ETag
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"ETag")
Either
String
(Integer -> ObjectKey -> ObjectStorageClass -> ISO8601 -> Object)
-> Either String Integer
-> Either
String (ObjectKey -> ObjectStorageClass -> ISO8601 -> Object)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Integer
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Size")
Either
String (ObjectKey -> ObjectStorageClass -> ISO8601 -> Object)
-> Either String ObjectKey
-> Either String (ObjectStorageClass -> ISO8601 -> Object)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ObjectKey
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Key")
Either String (ObjectStorageClass -> ISO8601 -> Object)
-> Either String ObjectStorageClass
-> Either String (ISO8601 -> Object)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ObjectStorageClass
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"StorageClass")
Either String (ISO8601 -> Object)
-> Either String ISO8601 -> Either String Object
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ISO8601
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"LastModified")
instance Prelude.Hashable Object
instance Prelude.NFData Object