{-# 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.ObjectVersion 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.ObjectVersionStorageClass
import Amazonka.S3.Types.Owner
data ObjectVersion = ObjectVersion'
{
ObjectVersion -> Maybe ETag
eTag :: Prelude.Maybe ETag,
ObjectVersion -> Maybe ObjectVersionId
versionId :: Prelude.Maybe ObjectVersionId,
ObjectVersion -> Maybe Integer
size :: Prelude.Maybe Prelude.Integer,
ObjectVersion -> Maybe Bool
isLatest :: Prelude.Maybe Prelude.Bool,
ObjectVersion -> Maybe Owner
owner :: Prelude.Maybe Owner,
ObjectVersion -> Maybe ObjectKey
key :: Prelude.Maybe ObjectKey,
ObjectVersion -> Maybe ObjectVersionStorageClass
storageClass :: Prelude.Maybe ObjectVersionStorageClass,
ObjectVersion -> Maybe ISO8601
lastModified :: Prelude.Maybe Core.ISO8601
}
deriving (ObjectVersion -> ObjectVersion -> Bool
(ObjectVersion -> ObjectVersion -> Bool)
-> (ObjectVersion -> ObjectVersion -> Bool) -> Eq ObjectVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ObjectVersion -> ObjectVersion -> Bool
$c/= :: ObjectVersion -> ObjectVersion -> Bool
== :: ObjectVersion -> ObjectVersion -> Bool
$c== :: ObjectVersion -> ObjectVersion -> Bool
Prelude.Eq, ReadPrec [ObjectVersion]
ReadPrec ObjectVersion
Int -> ReadS ObjectVersion
ReadS [ObjectVersion]
(Int -> ReadS ObjectVersion)
-> ReadS [ObjectVersion]
-> ReadPrec ObjectVersion
-> ReadPrec [ObjectVersion]
-> Read ObjectVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ObjectVersion]
$creadListPrec :: ReadPrec [ObjectVersion]
readPrec :: ReadPrec ObjectVersion
$creadPrec :: ReadPrec ObjectVersion
readList :: ReadS [ObjectVersion]
$creadList :: ReadS [ObjectVersion]
readsPrec :: Int -> ReadS ObjectVersion
$creadsPrec :: Int -> ReadS ObjectVersion
Prelude.Read, Int -> ObjectVersion -> ShowS
[ObjectVersion] -> ShowS
ObjectVersion -> String
(Int -> ObjectVersion -> ShowS)
-> (ObjectVersion -> String)
-> ([ObjectVersion] -> ShowS)
-> Show ObjectVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ObjectVersion] -> ShowS
$cshowList :: [ObjectVersion] -> ShowS
show :: ObjectVersion -> String
$cshow :: ObjectVersion -> String
showsPrec :: Int -> ObjectVersion -> ShowS
$cshowsPrec :: Int -> ObjectVersion -> ShowS
Prelude.Show, (forall x. ObjectVersion -> Rep ObjectVersion x)
-> (forall x. Rep ObjectVersion x -> ObjectVersion)
-> Generic ObjectVersion
forall x. Rep ObjectVersion x -> ObjectVersion
forall x. ObjectVersion -> Rep ObjectVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ObjectVersion x -> ObjectVersion
$cfrom :: forall x. ObjectVersion -> Rep ObjectVersion x
Prelude.Generic)
newObjectVersion ::
ObjectVersion
newObjectVersion :: ObjectVersion
newObjectVersion =
ObjectVersion' :: Maybe ETag
-> Maybe ObjectVersionId
-> Maybe Integer
-> Maybe Bool
-> Maybe Owner
-> Maybe ObjectKey
-> Maybe ObjectVersionStorageClass
-> Maybe ISO8601
-> ObjectVersion
ObjectVersion'
{ $sel:eTag:ObjectVersion' :: Maybe ETag
eTag = Maybe ETag
forall a. Maybe a
Prelude.Nothing,
$sel:versionId:ObjectVersion' :: Maybe ObjectVersionId
versionId = Maybe ObjectVersionId
forall a. Maybe a
Prelude.Nothing,
$sel:size:ObjectVersion' :: Maybe Integer
size = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:isLatest:ObjectVersion' :: Maybe Bool
isLatest = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:owner:ObjectVersion' :: Maybe Owner
owner = Maybe Owner
forall a. Maybe a
Prelude.Nothing,
$sel:key:ObjectVersion' :: Maybe ObjectKey
key = Maybe ObjectKey
forall a. Maybe a
Prelude.Nothing,
$sel:storageClass:ObjectVersion' :: Maybe ObjectVersionStorageClass
storageClass = Maybe ObjectVersionStorageClass
forall a. Maybe a
Prelude.Nothing,
$sel:lastModified:ObjectVersion' :: Maybe ISO8601
lastModified = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing
}
objectVersion_eTag :: Lens.Lens' ObjectVersion (Prelude.Maybe ETag)
objectVersion_eTag :: (Maybe ETag -> f (Maybe ETag)) -> ObjectVersion -> f ObjectVersion
objectVersion_eTag = (ObjectVersion -> Maybe ETag)
-> (ObjectVersion -> Maybe ETag -> ObjectVersion)
-> Lens ObjectVersion ObjectVersion (Maybe ETag) (Maybe ETag)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ObjectVersion' {Maybe ETag
eTag :: Maybe ETag
$sel:eTag:ObjectVersion' :: ObjectVersion -> Maybe ETag
eTag} -> Maybe ETag
eTag) (\s :: ObjectVersion
s@ObjectVersion' {} Maybe ETag
a -> ObjectVersion
s {$sel:eTag:ObjectVersion' :: Maybe ETag
eTag = Maybe ETag
a} :: ObjectVersion)
objectVersion_versionId :: Lens.Lens' ObjectVersion (Prelude.Maybe ObjectVersionId)
objectVersion_versionId :: (Maybe ObjectVersionId -> f (Maybe ObjectVersionId))
-> ObjectVersion -> f ObjectVersion
objectVersion_versionId = (ObjectVersion -> Maybe ObjectVersionId)
-> (ObjectVersion -> Maybe ObjectVersionId -> ObjectVersion)
-> Lens
ObjectVersion
ObjectVersion
(Maybe ObjectVersionId)
(Maybe ObjectVersionId)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ObjectVersion' {Maybe ObjectVersionId
versionId :: Maybe ObjectVersionId
$sel:versionId:ObjectVersion' :: ObjectVersion -> Maybe ObjectVersionId
versionId} -> Maybe ObjectVersionId
versionId) (\s :: ObjectVersion
s@ObjectVersion' {} Maybe ObjectVersionId
a -> ObjectVersion
s {$sel:versionId:ObjectVersion' :: Maybe ObjectVersionId
versionId = Maybe ObjectVersionId
a} :: ObjectVersion)
objectVersion_size :: Lens.Lens' ObjectVersion (Prelude.Maybe Prelude.Integer)
objectVersion_size :: (Maybe Integer -> f (Maybe Integer))
-> ObjectVersion -> f ObjectVersion
objectVersion_size = (ObjectVersion -> Maybe Integer)
-> (ObjectVersion -> Maybe Integer -> ObjectVersion)
-> Lens ObjectVersion ObjectVersion (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ObjectVersion' {Maybe Integer
size :: Maybe Integer
$sel:size:ObjectVersion' :: ObjectVersion -> Maybe Integer
size} -> Maybe Integer
size) (\s :: ObjectVersion
s@ObjectVersion' {} Maybe Integer
a -> ObjectVersion
s {$sel:size:ObjectVersion' :: Maybe Integer
size = Maybe Integer
a} :: ObjectVersion)
objectVersion_isLatest :: Lens.Lens' ObjectVersion (Prelude.Maybe Prelude.Bool)
objectVersion_isLatest :: (Maybe Bool -> f (Maybe Bool)) -> ObjectVersion -> f ObjectVersion
objectVersion_isLatest = (ObjectVersion -> Maybe Bool)
-> (ObjectVersion -> Maybe Bool -> ObjectVersion)
-> Lens ObjectVersion ObjectVersion (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ObjectVersion' {Maybe Bool
isLatest :: Maybe Bool
$sel:isLatest:ObjectVersion' :: ObjectVersion -> Maybe Bool
isLatest} -> Maybe Bool
isLatest) (\s :: ObjectVersion
s@ObjectVersion' {} Maybe Bool
a -> ObjectVersion
s {$sel:isLatest:ObjectVersion' :: Maybe Bool
isLatest = Maybe Bool
a} :: ObjectVersion)
objectVersion_owner :: Lens.Lens' ObjectVersion (Prelude.Maybe Owner)
objectVersion_owner :: (Maybe Owner -> f (Maybe Owner))
-> ObjectVersion -> f ObjectVersion
objectVersion_owner = (ObjectVersion -> Maybe Owner)
-> (ObjectVersion -> Maybe Owner -> ObjectVersion)
-> Lens ObjectVersion ObjectVersion (Maybe Owner) (Maybe Owner)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ObjectVersion' {Maybe Owner
owner :: Maybe Owner
$sel:owner:ObjectVersion' :: ObjectVersion -> Maybe Owner
owner} -> Maybe Owner
owner) (\s :: ObjectVersion
s@ObjectVersion' {} Maybe Owner
a -> ObjectVersion
s {$sel:owner:ObjectVersion' :: Maybe Owner
owner = Maybe Owner
a} :: ObjectVersion)
objectVersion_key :: Lens.Lens' ObjectVersion (Prelude.Maybe ObjectKey)
objectVersion_key :: (Maybe ObjectKey -> f (Maybe ObjectKey))
-> ObjectVersion -> f ObjectVersion
objectVersion_key = (ObjectVersion -> Maybe ObjectKey)
-> (ObjectVersion -> Maybe ObjectKey -> ObjectVersion)
-> Lens
ObjectVersion ObjectVersion (Maybe ObjectKey) (Maybe ObjectKey)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ObjectVersion' {Maybe ObjectKey
key :: Maybe ObjectKey
$sel:key:ObjectVersion' :: ObjectVersion -> Maybe ObjectKey
key} -> Maybe ObjectKey
key) (\s :: ObjectVersion
s@ObjectVersion' {} Maybe ObjectKey
a -> ObjectVersion
s {$sel:key:ObjectVersion' :: Maybe ObjectKey
key = Maybe ObjectKey
a} :: ObjectVersion)
objectVersion_storageClass :: Lens.Lens' ObjectVersion (Prelude.Maybe ObjectVersionStorageClass)
objectVersion_storageClass :: (Maybe ObjectVersionStorageClass
-> f (Maybe ObjectVersionStorageClass))
-> ObjectVersion -> f ObjectVersion
objectVersion_storageClass = (ObjectVersion -> Maybe ObjectVersionStorageClass)
-> (ObjectVersion
-> Maybe ObjectVersionStorageClass -> ObjectVersion)
-> Lens
ObjectVersion
ObjectVersion
(Maybe ObjectVersionStorageClass)
(Maybe ObjectVersionStorageClass)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ObjectVersion' {Maybe ObjectVersionStorageClass
storageClass :: Maybe ObjectVersionStorageClass
$sel:storageClass:ObjectVersion' :: ObjectVersion -> Maybe ObjectVersionStorageClass
storageClass} -> Maybe ObjectVersionStorageClass
storageClass) (\s :: ObjectVersion
s@ObjectVersion' {} Maybe ObjectVersionStorageClass
a -> ObjectVersion
s {$sel:storageClass:ObjectVersion' :: Maybe ObjectVersionStorageClass
storageClass = Maybe ObjectVersionStorageClass
a} :: ObjectVersion)
objectVersion_lastModified :: Lens.Lens' ObjectVersion (Prelude.Maybe Prelude.UTCTime)
objectVersion_lastModified :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ObjectVersion -> f ObjectVersion
objectVersion_lastModified = (ObjectVersion -> Maybe ISO8601)
-> (ObjectVersion -> Maybe ISO8601 -> ObjectVersion)
-> Lens ObjectVersion ObjectVersion (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ObjectVersion' {Maybe ISO8601
lastModified :: Maybe ISO8601
$sel:lastModified:ObjectVersion' :: ObjectVersion -> Maybe ISO8601
lastModified} -> Maybe ISO8601
lastModified) (\s :: ObjectVersion
s@ObjectVersion' {} Maybe ISO8601
a -> ObjectVersion
s {$sel:lastModified:ObjectVersion' :: Maybe ISO8601
lastModified = Maybe ISO8601
a} :: ObjectVersion) ((Maybe ISO8601 -> f (Maybe ISO8601))
-> ObjectVersion -> f ObjectVersion)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ObjectVersion
-> f ObjectVersion
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
(Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Core.FromXML ObjectVersion where
parseXML :: [Node] -> Either String ObjectVersion
parseXML [Node]
x =
Maybe ETag
-> Maybe ObjectVersionId
-> Maybe Integer
-> Maybe Bool
-> Maybe Owner
-> Maybe ObjectKey
-> Maybe ObjectVersionStorageClass
-> Maybe ISO8601
-> ObjectVersion
ObjectVersion'
(Maybe ETag
-> Maybe ObjectVersionId
-> Maybe Integer
-> Maybe Bool
-> Maybe Owner
-> Maybe ObjectKey
-> Maybe ObjectVersionStorageClass
-> Maybe ISO8601
-> ObjectVersion)
-> Either String (Maybe ETag)
-> Either
String
(Maybe ObjectVersionId
-> Maybe Integer
-> Maybe Bool
-> Maybe Owner
-> Maybe ObjectKey
-> Maybe ObjectVersionStorageClass
-> Maybe ISO8601
-> ObjectVersion)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ETag)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ETag")
Either
String
(Maybe ObjectVersionId
-> Maybe Integer
-> Maybe Bool
-> Maybe Owner
-> Maybe ObjectKey
-> Maybe ObjectVersionStorageClass
-> Maybe ISO8601
-> ObjectVersion)
-> Either String (Maybe ObjectVersionId)
-> Either
String
(Maybe Integer
-> Maybe Bool
-> Maybe Owner
-> Maybe ObjectKey
-> Maybe ObjectVersionStorageClass
-> Maybe ISO8601
-> ObjectVersion)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ObjectVersionId)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"VersionId")
Either
String
(Maybe Integer
-> Maybe Bool
-> Maybe Owner
-> Maybe ObjectKey
-> Maybe ObjectVersionStorageClass
-> Maybe ISO8601
-> ObjectVersion)
-> Either String (Maybe Integer)
-> Either
String
(Maybe Bool
-> Maybe Owner
-> Maybe ObjectKey
-> Maybe ObjectVersionStorageClass
-> Maybe ISO8601
-> ObjectVersion)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Integer)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Size")
Either
String
(Maybe Bool
-> Maybe Owner
-> Maybe ObjectKey
-> Maybe ObjectVersionStorageClass
-> Maybe ISO8601
-> ObjectVersion)
-> Either String (Maybe Bool)
-> Either
String
(Maybe Owner
-> Maybe ObjectKey
-> Maybe ObjectVersionStorageClass
-> Maybe ISO8601
-> ObjectVersion)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"IsLatest")
Either
String
(Maybe Owner
-> Maybe ObjectKey
-> Maybe ObjectVersionStorageClass
-> Maybe ISO8601
-> ObjectVersion)
-> Either String (Maybe Owner)
-> Either
String
(Maybe ObjectKey
-> Maybe ObjectVersionStorageClass
-> Maybe ISO8601
-> ObjectVersion)
forall (f :: * -> *) a b. Applicative f => 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
(Maybe ObjectKey
-> Maybe ObjectVersionStorageClass
-> Maybe ISO8601
-> ObjectVersion)
-> Either String (Maybe ObjectKey)
-> Either
String
(Maybe ObjectVersionStorageClass -> Maybe ISO8601 -> ObjectVersion)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ObjectKey)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Key")
Either
String
(Maybe ObjectVersionStorageClass -> Maybe ISO8601 -> ObjectVersion)
-> Either String (Maybe ObjectVersionStorageClass)
-> Either String (Maybe ISO8601 -> ObjectVersion)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ObjectVersionStorageClass)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"StorageClass")
Either String (Maybe ISO8601 -> ObjectVersion)
-> Either String (Maybe ISO8601) -> Either String ObjectVersion
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"LastModified")
instance Prelude.Hashable ObjectVersion
instance Prelude.NFData ObjectVersion