{-# 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.DeleteMarkerReplication
-- 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.DeleteMarkerReplication 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.DeleteMarkerReplicationStatus

-- | Specifies whether Amazon S3 replicates delete markers. If you specify a
-- @Filter@ in your replication configuration, you must also include a
-- @DeleteMarkerReplication@ element. If your @Filter@ includes a @Tag@
-- element, the @DeleteMarkerReplication@ @Status@ must be set to Disabled,
-- because Amazon S3 does not support replicating delete markers for
-- tag-based rules. For an example configuration, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-add-config.html#replication-config-min-rule-config Basic Rule Configuration>.
--
-- For more information about delete marker replication, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/delete-marker-replication.html Basic Rule Configuration>.
--
-- If you are using an earlier version of the replication configuration,
-- Amazon S3 handles replication of delete markers differently. For more
-- information, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-add-config.html#replication-backward-compat-considerations Backward Compatibility>.
--
-- /See:/ 'newDeleteMarkerReplication' smart constructor.
data DeleteMarkerReplication = DeleteMarkerReplication'
  { -- | Indicates whether to replicate delete markers.
    --
    -- Indicates whether to replicate delete markers.
    DeleteMarkerReplication -> Maybe DeleteMarkerReplicationStatus
status :: Prelude.Maybe DeleteMarkerReplicationStatus
  }
  deriving (DeleteMarkerReplication -> DeleteMarkerReplication -> Bool
(DeleteMarkerReplication -> DeleteMarkerReplication -> Bool)
-> (DeleteMarkerReplication -> DeleteMarkerReplication -> Bool)
-> Eq DeleteMarkerReplication
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteMarkerReplication -> DeleteMarkerReplication -> Bool
$c/= :: DeleteMarkerReplication -> DeleteMarkerReplication -> Bool
== :: DeleteMarkerReplication -> DeleteMarkerReplication -> Bool
$c== :: DeleteMarkerReplication -> DeleteMarkerReplication -> Bool
Prelude.Eq, ReadPrec [DeleteMarkerReplication]
ReadPrec DeleteMarkerReplication
Int -> ReadS DeleteMarkerReplication
ReadS [DeleteMarkerReplication]
(Int -> ReadS DeleteMarkerReplication)
-> ReadS [DeleteMarkerReplication]
-> ReadPrec DeleteMarkerReplication
-> ReadPrec [DeleteMarkerReplication]
-> Read DeleteMarkerReplication
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteMarkerReplication]
$creadListPrec :: ReadPrec [DeleteMarkerReplication]
readPrec :: ReadPrec DeleteMarkerReplication
$creadPrec :: ReadPrec DeleteMarkerReplication
readList :: ReadS [DeleteMarkerReplication]
$creadList :: ReadS [DeleteMarkerReplication]
readsPrec :: Int -> ReadS DeleteMarkerReplication
$creadsPrec :: Int -> ReadS DeleteMarkerReplication
Prelude.Read, Int -> DeleteMarkerReplication -> ShowS
[DeleteMarkerReplication] -> ShowS
DeleteMarkerReplication -> String
(Int -> DeleteMarkerReplication -> ShowS)
-> (DeleteMarkerReplication -> String)
-> ([DeleteMarkerReplication] -> ShowS)
-> Show DeleteMarkerReplication
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteMarkerReplication] -> ShowS
$cshowList :: [DeleteMarkerReplication] -> ShowS
show :: DeleteMarkerReplication -> String
$cshow :: DeleteMarkerReplication -> String
showsPrec :: Int -> DeleteMarkerReplication -> ShowS
$cshowsPrec :: Int -> DeleteMarkerReplication -> ShowS
Prelude.Show, (forall x.
 DeleteMarkerReplication -> Rep DeleteMarkerReplication x)
-> (forall x.
    Rep DeleteMarkerReplication x -> DeleteMarkerReplication)
-> Generic DeleteMarkerReplication
forall x. Rep DeleteMarkerReplication x -> DeleteMarkerReplication
forall x. DeleteMarkerReplication -> Rep DeleteMarkerReplication x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteMarkerReplication x -> DeleteMarkerReplication
$cfrom :: forall x. DeleteMarkerReplication -> Rep DeleteMarkerReplication x
Prelude.Generic)

-- |
-- Create a value of 'DeleteMarkerReplication' 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:
--
-- 'status', 'deleteMarkerReplication_status' - Indicates whether to replicate delete markers.
--
-- Indicates whether to replicate delete markers.
newDeleteMarkerReplication ::
  DeleteMarkerReplication
newDeleteMarkerReplication :: DeleteMarkerReplication
newDeleteMarkerReplication =
  DeleteMarkerReplication' :: Maybe DeleteMarkerReplicationStatus -> DeleteMarkerReplication
DeleteMarkerReplication' {$sel:status:DeleteMarkerReplication' :: Maybe DeleteMarkerReplicationStatus
status = Maybe DeleteMarkerReplicationStatus
forall a. Maybe a
Prelude.Nothing}

-- | Indicates whether to replicate delete markers.
--
-- Indicates whether to replicate delete markers.
deleteMarkerReplication_status :: Lens.Lens' DeleteMarkerReplication (Prelude.Maybe DeleteMarkerReplicationStatus)
deleteMarkerReplication_status :: (Maybe DeleteMarkerReplicationStatus
 -> f (Maybe DeleteMarkerReplicationStatus))
-> DeleteMarkerReplication -> f DeleteMarkerReplication
deleteMarkerReplication_status = (DeleteMarkerReplication -> Maybe DeleteMarkerReplicationStatus)
-> (DeleteMarkerReplication
    -> Maybe DeleteMarkerReplicationStatus -> DeleteMarkerReplication)
-> Lens
     DeleteMarkerReplication
     DeleteMarkerReplication
     (Maybe DeleteMarkerReplicationStatus)
     (Maybe DeleteMarkerReplicationStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMarkerReplication' {Maybe DeleteMarkerReplicationStatus
status :: Maybe DeleteMarkerReplicationStatus
$sel:status:DeleteMarkerReplication' :: DeleteMarkerReplication -> Maybe DeleteMarkerReplicationStatus
status} -> Maybe DeleteMarkerReplicationStatus
status) (\s :: DeleteMarkerReplication
s@DeleteMarkerReplication' {} Maybe DeleteMarkerReplicationStatus
a -> DeleteMarkerReplication
s {$sel:status:DeleteMarkerReplication' :: Maybe DeleteMarkerReplicationStatus
status = Maybe DeleteMarkerReplicationStatus
a} :: DeleteMarkerReplication)

instance Core.FromXML DeleteMarkerReplication where
  parseXML :: [Node] -> Either String DeleteMarkerReplication
parseXML [Node]
x =
    Maybe DeleteMarkerReplicationStatus -> DeleteMarkerReplication
DeleteMarkerReplication'
      (Maybe DeleteMarkerReplicationStatus -> DeleteMarkerReplication)
-> Either String (Maybe DeleteMarkerReplicationStatus)
-> Either String DeleteMarkerReplication
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node]
-> Text -> Either String (Maybe DeleteMarkerReplicationStatus)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Status")

instance Prelude.Hashable DeleteMarkerReplication

instance Prelude.NFData DeleteMarkerReplication

instance Core.ToXML DeleteMarkerReplication where
  toXML :: DeleteMarkerReplication -> XML
toXML DeleteMarkerReplication' {Maybe DeleteMarkerReplicationStatus
status :: Maybe DeleteMarkerReplicationStatus
$sel:status:DeleteMarkerReplication' :: DeleteMarkerReplication -> Maybe DeleteMarkerReplicationStatus
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat [Name
"Status" Name -> Maybe DeleteMarkerReplicationStatus -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe DeleteMarkerReplicationStatus
status]