{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.S3.Types.DeleteMarkerEntry
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.S3.Types.DeleteMarkerEntry 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.Owner

-- | Information about the delete marker.
--
-- /See:/ 'newDeleteMarkerEntry' smart constructor.
data DeleteMarkerEntry = DeleteMarkerEntry'
  { -- | Version ID of an object.
    DeleteMarkerEntry -> Maybe ObjectVersionId
versionId :: Prelude.Maybe ObjectVersionId,
    -- | Specifies whether the object is (true) or is not (false) the latest
    -- version of an object.
    DeleteMarkerEntry -> Maybe Bool
isLatest :: Prelude.Maybe Prelude.Bool,
    -- | The account that created the delete marker.>
    DeleteMarkerEntry -> Maybe Owner
owner :: Prelude.Maybe Owner,
    -- | The object key.
    DeleteMarkerEntry -> Maybe ObjectKey
key :: Prelude.Maybe ObjectKey,
    -- | Date and time the object was last modified.
    DeleteMarkerEntry -> Maybe ISO8601
lastModified :: Prelude.Maybe Core.ISO8601
  }
  deriving (DeleteMarkerEntry -> DeleteMarkerEntry -> Bool
(DeleteMarkerEntry -> DeleteMarkerEntry -> Bool)
-> (DeleteMarkerEntry -> DeleteMarkerEntry -> Bool)
-> Eq DeleteMarkerEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteMarkerEntry -> DeleteMarkerEntry -> Bool
$c/= :: DeleteMarkerEntry -> DeleteMarkerEntry -> Bool
== :: DeleteMarkerEntry -> DeleteMarkerEntry -> Bool
$c== :: DeleteMarkerEntry -> DeleteMarkerEntry -> Bool
Prelude.Eq, ReadPrec [DeleteMarkerEntry]
ReadPrec DeleteMarkerEntry
Int -> ReadS DeleteMarkerEntry
ReadS [DeleteMarkerEntry]
(Int -> ReadS DeleteMarkerEntry)
-> ReadS [DeleteMarkerEntry]
-> ReadPrec DeleteMarkerEntry
-> ReadPrec [DeleteMarkerEntry]
-> Read DeleteMarkerEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteMarkerEntry]
$creadListPrec :: ReadPrec [DeleteMarkerEntry]
readPrec :: ReadPrec DeleteMarkerEntry
$creadPrec :: ReadPrec DeleteMarkerEntry
readList :: ReadS [DeleteMarkerEntry]
$creadList :: ReadS [DeleteMarkerEntry]
readsPrec :: Int -> ReadS DeleteMarkerEntry
$creadsPrec :: Int -> ReadS DeleteMarkerEntry
Prelude.Read, Int -> DeleteMarkerEntry -> ShowS
[DeleteMarkerEntry] -> ShowS
DeleteMarkerEntry -> String
(Int -> DeleteMarkerEntry -> ShowS)
-> (DeleteMarkerEntry -> String)
-> ([DeleteMarkerEntry] -> ShowS)
-> Show DeleteMarkerEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteMarkerEntry] -> ShowS
$cshowList :: [DeleteMarkerEntry] -> ShowS
show :: DeleteMarkerEntry -> String
$cshow :: DeleteMarkerEntry -> String
showsPrec :: Int -> DeleteMarkerEntry -> ShowS
$cshowsPrec :: Int -> DeleteMarkerEntry -> ShowS
Prelude.Show, (forall x. DeleteMarkerEntry -> Rep DeleteMarkerEntry x)
-> (forall x. Rep DeleteMarkerEntry x -> DeleteMarkerEntry)
-> Generic DeleteMarkerEntry
forall x. Rep DeleteMarkerEntry x -> DeleteMarkerEntry
forall x. DeleteMarkerEntry -> Rep DeleteMarkerEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteMarkerEntry x -> DeleteMarkerEntry
$cfrom :: forall x. DeleteMarkerEntry -> Rep DeleteMarkerEntry x
Prelude.Generic)

-- |
-- Create a value of 'DeleteMarkerEntry' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'versionId', 'deleteMarkerEntry_versionId' - Version ID of an object.
--
-- 'isLatest', 'deleteMarkerEntry_isLatest' - Specifies whether the object is (true) or is not (false) the latest
-- version of an object.
--
-- 'owner', 'deleteMarkerEntry_owner' - The account that created the delete marker.>
--
-- 'key', 'deleteMarkerEntry_key' - The object key.
--
-- 'lastModified', 'deleteMarkerEntry_lastModified' - Date and time the object was last modified.
newDeleteMarkerEntry ::
  DeleteMarkerEntry
newDeleteMarkerEntry :: DeleteMarkerEntry
newDeleteMarkerEntry =
  DeleteMarkerEntry' :: Maybe ObjectVersionId
-> Maybe Bool
-> Maybe Owner
-> Maybe ObjectKey
-> Maybe ISO8601
-> DeleteMarkerEntry
DeleteMarkerEntry'
    { $sel:versionId:DeleteMarkerEntry' :: Maybe ObjectVersionId
versionId = Maybe ObjectVersionId
forall a. Maybe a
Prelude.Nothing,
      $sel:isLatest:DeleteMarkerEntry' :: Maybe Bool
isLatest = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:owner:DeleteMarkerEntry' :: Maybe Owner
owner = Maybe Owner
forall a. Maybe a
Prelude.Nothing,
      $sel:key:DeleteMarkerEntry' :: Maybe ObjectKey
key = Maybe ObjectKey
forall a. Maybe a
Prelude.Nothing,
      $sel:lastModified:DeleteMarkerEntry' :: Maybe ISO8601
lastModified = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing
    }

-- | Version ID of an object.
deleteMarkerEntry_versionId :: Lens.Lens' DeleteMarkerEntry (Prelude.Maybe ObjectVersionId)
deleteMarkerEntry_versionId :: (Maybe ObjectVersionId -> f (Maybe ObjectVersionId))
-> DeleteMarkerEntry -> f DeleteMarkerEntry
deleteMarkerEntry_versionId = (DeleteMarkerEntry -> Maybe ObjectVersionId)
-> (DeleteMarkerEntry
    -> Maybe ObjectVersionId -> DeleteMarkerEntry)
-> Lens
     DeleteMarkerEntry
     DeleteMarkerEntry
     (Maybe ObjectVersionId)
     (Maybe ObjectVersionId)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMarkerEntry' {Maybe ObjectVersionId
versionId :: Maybe ObjectVersionId
$sel:versionId:DeleteMarkerEntry' :: DeleteMarkerEntry -> Maybe ObjectVersionId
versionId} -> Maybe ObjectVersionId
versionId) (\s :: DeleteMarkerEntry
s@DeleteMarkerEntry' {} Maybe ObjectVersionId
a -> DeleteMarkerEntry
s {$sel:versionId:DeleteMarkerEntry' :: Maybe ObjectVersionId
versionId = Maybe ObjectVersionId
a} :: DeleteMarkerEntry)

-- | Specifies whether the object is (true) or is not (false) the latest
-- version of an object.
deleteMarkerEntry_isLatest :: Lens.Lens' DeleteMarkerEntry (Prelude.Maybe Prelude.Bool)
deleteMarkerEntry_isLatest :: (Maybe Bool -> f (Maybe Bool))
-> DeleteMarkerEntry -> f DeleteMarkerEntry
deleteMarkerEntry_isLatest = (DeleteMarkerEntry -> Maybe Bool)
-> (DeleteMarkerEntry -> Maybe Bool -> DeleteMarkerEntry)
-> Lens
     DeleteMarkerEntry DeleteMarkerEntry (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMarkerEntry' {Maybe Bool
isLatest :: Maybe Bool
$sel:isLatest:DeleteMarkerEntry' :: DeleteMarkerEntry -> Maybe Bool
isLatest} -> Maybe Bool
isLatest) (\s :: DeleteMarkerEntry
s@DeleteMarkerEntry' {} Maybe Bool
a -> DeleteMarkerEntry
s {$sel:isLatest:DeleteMarkerEntry' :: Maybe Bool
isLatest = Maybe Bool
a} :: DeleteMarkerEntry)

-- | The account that created the delete marker.>
deleteMarkerEntry_owner :: Lens.Lens' DeleteMarkerEntry (Prelude.Maybe Owner)
deleteMarkerEntry_owner :: (Maybe Owner -> f (Maybe Owner))
-> DeleteMarkerEntry -> f DeleteMarkerEntry
deleteMarkerEntry_owner = (DeleteMarkerEntry -> Maybe Owner)
-> (DeleteMarkerEntry -> Maybe Owner -> DeleteMarkerEntry)
-> Lens
     DeleteMarkerEntry DeleteMarkerEntry (Maybe Owner) (Maybe Owner)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMarkerEntry' {Maybe Owner
owner :: Maybe Owner
$sel:owner:DeleteMarkerEntry' :: DeleteMarkerEntry -> Maybe Owner
owner} -> Maybe Owner
owner) (\s :: DeleteMarkerEntry
s@DeleteMarkerEntry' {} Maybe Owner
a -> DeleteMarkerEntry
s {$sel:owner:DeleteMarkerEntry' :: Maybe Owner
owner = Maybe Owner
a} :: DeleteMarkerEntry)

-- | The object key.
deleteMarkerEntry_key :: Lens.Lens' DeleteMarkerEntry (Prelude.Maybe ObjectKey)
deleteMarkerEntry_key :: (Maybe ObjectKey -> f (Maybe ObjectKey))
-> DeleteMarkerEntry -> f DeleteMarkerEntry
deleteMarkerEntry_key = (DeleteMarkerEntry -> Maybe ObjectKey)
-> (DeleteMarkerEntry -> Maybe ObjectKey -> DeleteMarkerEntry)
-> Lens
     DeleteMarkerEntry
     DeleteMarkerEntry
     (Maybe ObjectKey)
     (Maybe ObjectKey)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMarkerEntry' {Maybe ObjectKey
key :: Maybe ObjectKey
$sel:key:DeleteMarkerEntry' :: DeleteMarkerEntry -> Maybe ObjectKey
key} -> Maybe ObjectKey
key) (\s :: DeleteMarkerEntry
s@DeleteMarkerEntry' {} Maybe ObjectKey
a -> DeleteMarkerEntry
s {$sel:key:DeleteMarkerEntry' :: Maybe ObjectKey
key = Maybe ObjectKey
a} :: DeleteMarkerEntry)

-- | Date and time the object was last modified.
deleteMarkerEntry_lastModified :: Lens.Lens' DeleteMarkerEntry (Prelude.Maybe Prelude.UTCTime)
deleteMarkerEntry_lastModified :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DeleteMarkerEntry -> f DeleteMarkerEntry
deleteMarkerEntry_lastModified = (DeleteMarkerEntry -> Maybe ISO8601)
-> (DeleteMarkerEntry -> Maybe ISO8601 -> DeleteMarkerEntry)
-> Lens
     DeleteMarkerEntry DeleteMarkerEntry (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMarkerEntry' {Maybe ISO8601
lastModified :: Maybe ISO8601
$sel:lastModified:DeleteMarkerEntry' :: DeleteMarkerEntry -> Maybe ISO8601
lastModified} -> Maybe ISO8601
lastModified) (\s :: DeleteMarkerEntry
s@DeleteMarkerEntry' {} Maybe ISO8601
a -> DeleteMarkerEntry
s {$sel:lastModified:DeleteMarkerEntry' :: Maybe ISO8601
lastModified = Maybe ISO8601
a} :: DeleteMarkerEntry) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> DeleteMarkerEntry -> f DeleteMarkerEntry)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DeleteMarkerEntry
-> f DeleteMarkerEntry
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 DeleteMarkerEntry where
  parseXML :: [Node] -> Either String DeleteMarkerEntry
parseXML [Node]
x =
    Maybe ObjectVersionId
-> Maybe Bool
-> Maybe Owner
-> Maybe ObjectKey
-> Maybe ISO8601
-> DeleteMarkerEntry
DeleteMarkerEntry'
      (Maybe ObjectVersionId
 -> Maybe Bool
 -> Maybe Owner
 -> Maybe ObjectKey
 -> Maybe ISO8601
 -> DeleteMarkerEntry)
-> Either String (Maybe ObjectVersionId)
-> Either
     String
     (Maybe Bool
      -> Maybe Owner
      -> Maybe ObjectKey
      -> Maybe ISO8601
      -> DeleteMarkerEntry)
forall (f :: * -> *) a b. Functor 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 Bool
   -> Maybe Owner
   -> Maybe ObjectKey
   -> Maybe ISO8601
   -> DeleteMarkerEntry)
-> Either String (Maybe Bool)
-> Either
     String
     (Maybe Owner
      -> Maybe ObjectKey -> Maybe ISO8601 -> DeleteMarkerEntry)
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 ISO8601 -> DeleteMarkerEntry)
-> Either String (Maybe Owner)
-> Either
     String (Maybe ObjectKey -> Maybe ISO8601 -> DeleteMarkerEntry)
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 ISO8601 -> DeleteMarkerEntry)
-> Either String (Maybe ObjectKey)
-> Either String (Maybe ISO8601 -> DeleteMarkerEntry)
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 ISO8601 -> DeleteMarkerEntry)
-> Either String (Maybe ISO8601) -> Either String DeleteMarkerEntry
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 DeleteMarkerEntry

instance Prelude.NFData DeleteMarkerEntry