{-# 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.ReplicaModifications
-- 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.ReplicaModifications 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.ReplicaModificationsStatus

-- | A filter that you can specify for selection for modifications on
-- replicas. Amazon S3 doesn\'t replicate replica modifications by default.
-- In the latest version of replication configuration (when @Filter@ is
-- specified), you can specify this element and set the status to @Enabled@
-- to replicate modifications on replicas.
--
-- If you don\'t specify the @Filter@ element, Amazon S3 assumes that the
-- replication configuration is the earlier version, V1. In the earlier
-- version, this element is not allowed.
--
-- /See:/ 'newReplicaModifications' smart constructor.
data ReplicaModifications = ReplicaModifications'
  { -- | Specifies whether Amazon S3 replicates modifications on replicas.
    ReplicaModifications -> ReplicaModificationsStatus
status :: ReplicaModificationsStatus
  }
  deriving (ReplicaModifications -> ReplicaModifications -> Bool
(ReplicaModifications -> ReplicaModifications -> Bool)
-> (ReplicaModifications -> ReplicaModifications -> Bool)
-> Eq ReplicaModifications
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReplicaModifications -> ReplicaModifications -> Bool
$c/= :: ReplicaModifications -> ReplicaModifications -> Bool
== :: ReplicaModifications -> ReplicaModifications -> Bool
$c== :: ReplicaModifications -> ReplicaModifications -> Bool
Prelude.Eq, ReadPrec [ReplicaModifications]
ReadPrec ReplicaModifications
Int -> ReadS ReplicaModifications
ReadS [ReplicaModifications]
(Int -> ReadS ReplicaModifications)
-> ReadS [ReplicaModifications]
-> ReadPrec ReplicaModifications
-> ReadPrec [ReplicaModifications]
-> Read ReplicaModifications
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReplicaModifications]
$creadListPrec :: ReadPrec [ReplicaModifications]
readPrec :: ReadPrec ReplicaModifications
$creadPrec :: ReadPrec ReplicaModifications
readList :: ReadS [ReplicaModifications]
$creadList :: ReadS [ReplicaModifications]
readsPrec :: Int -> ReadS ReplicaModifications
$creadsPrec :: Int -> ReadS ReplicaModifications
Prelude.Read, Int -> ReplicaModifications -> ShowS
[ReplicaModifications] -> ShowS
ReplicaModifications -> String
(Int -> ReplicaModifications -> ShowS)
-> (ReplicaModifications -> String)
-> ([ReplicaModifications] -> ShowS)
-> Show ReplicaModifications
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReplicaModifications] -> ShowS
$cshowList :: [ReplicaModifications] -> ShowS
show :: ReplicaModifications -> String
$cshow :: ReplicaModifications -> String
showsPrec :: Int -> ReplicaModifications -> ShowS
$cshowsPrec :: Int -> ReplicaModifications -> ShowS
Prelude.Show, (forall x. ReplicaModifications -> Rep ReplicaModifications x)
-> (forall x. Rep ReplicaModifications x -> ReplicaModifications)
-> Generic ReplicaModifications
forall x. Rep ReplicaModifications x -> ReplicaModifications
forall x. ReplicaModifications -> Rep ReplicaModifications x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReplicaModifications x -> ReplicaModifications
$cfrom :: forall x. ReplicaModifications -> Rep ReplicaModifications x
Prelude.Generic)

-- |
-- Create a value of 'ReplicaModifications' 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', 'replicaModifications_status' - Specifies whether Amazon S3 replicates modifications on replicas.
newReplicaModifications ::
  -- | 'status'
  ReplicaModificationsStatus ->
  ReplicaModifications
newReplicaModifications :: ReplicaModificationsStatus -> ReplicaModifications
newReplicaModifications ReplicaModificationsStatus
pStatus_ =
  ReplicaModifications' :: ReplicaModificationsStatus -> ReplicaModifications
ReplicaModifications' {$sel:status:ReplicaModifications' :: ReplicaModificationsStatus
status = ReplicaModificationsStatus
pStatus_}

-- | Specifies whether Amazon S3 replicates modifications on replicas.
replicaModifications_status :: Lens.Lens' ReplicaModifications ReplicaModificationsStatus
replicaModifications_status :: (ReplicaModificationsStatus -> f ReplicaModificationsStatus)
-> ReplicaModifications -> f ReplicaModifications
replicaModifications_status = (ReplicaModifications -> ReplicaModificationsStatus)
-> (ReplicaModifications
    -> ReplicaModificationsStatus -> ReplicaModifications)
-> Lens
     ReplicaModifications
     ReplicaModifications
     ReplicaModificationsStatus
     ReplicaModificationsStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicaModifications' {ReplicaModificationsStatus
status :: ReplicaModificationsStatus
$sel:status:ReplicaModifications' :: ReplicaModifications -> ReplicaModificationsStatus
status} -> ReplicaModificationsStatus
status) (\s :: ReplicaModifications
s@ReplicaModifications' {} ReplicaModificationsStatus
a -> ReplicaModifications
s {$sel:status:ReplicaModifications' :: ReplicaModificationsStatus
status = ReplicaModificationsStatus
a} :: ReplicaModifications)

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

instance Prelude.Hashable ReplicaModifications

instance Prelude.NFData ReplicaModifications

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