{-# 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.ExistingObjectReplication
-- 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.ExistingObjectReplication 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.ExistingObjectReplicationStatus

-- | Optional configuration to replicate existing source bucket objects. For
-- more information, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-what-is-isnot-replicated.html#existing-object-replication Replicating Existing Objects>
-- in the /Amazon S3 User Guide/.
--
-- /See:/ 'newExistingObjectReplication' smart constructor.
data ExistingObjectReplication = ExistingObjectReplication'
  { ExistingObjectReplication -> ExistingObjectReplicationStatus
status :: ExistingObjectReplicationStatus
  }
  deriving (ExistingObjectReplication -> ExistingObjectReplication -> Bool
(ExistingObjectReplication -> ExistingObjectReplication -> Bool)
-> (ExistingObjectReplication -> ExistingObjectReplication -> Bool)
-> Eq ExistingObjectReplication
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExistingObjectReplication -> ExistingObjectReplication -> Bool
$c/= :: ExistingObjectReplication -> ExistingObjectReplication -> Bool
== :: ExistingObjectReplication -> ExistingObjectReplication -> Bool
$c== :: ExistingObjectReplication -> ExistingObjectReplication -> Bool
Prelude.Eq, ReadPrec [ExistingObjectReplication]
ReadPrec ExistingObjectReplication
Int -> ReadS ExistingObjectReplication
ReadS [ExistingObjectReplication]
(Int -> ReadS ExistingObjectReplication)
-> ReadS [ExistingObjectReplication]
-> ReadPrec ExistingObjectReplication
-> ReadPrec [ExistingObjectReplication]
-> Read ExistingObjectReplication
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExistingObjectReplication]
$creadListPrec :: ReadPrec [ExistingObjectReplication]
readPrec :: ReadPrec ExistingObjectReplication
$creadPrec :: ReadPrec ExistingObjectReplication
readList :: ReadS [ExistingObjectReplication]
$creadList :: ReadS [ExistingObjectReplication]
readsPrec :: Int -> ReadS ExistingObjectReplication
$creadsPrec :: Int -> ReadS ExistingObjectReplication
Prelude.Read, Int -> ExistingObjectReplication -> ShowS
[ExistingObjectReplication] -> ShowS
ExistingObjectReplication -> String
(Int -> ExistingObjectReplication -> ShowS)
-> (ExistingObjectReplication -> String)
-> ([ExistingObjectReplication] -> ShowS)
-> Show ExistingObjectReplication
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExistingObjectReplication] -> ShowS
$cshowList :: [ExistingObjectReplication] -> ShowS
show :: ExistingObjectReplication -> String
$cshow :: ExistingObjectReplication -> String
showsPrec :: Int -> ExistingObjectReplication -> ShowS
$cshowsPrec :: Int -> ExistingObjectReplication -> ShowS
Prelude.Show, (forall x.
 ExistingObjectReplication -> Rep ExistingObjectReplication x)
-> (forall x.
    Rep ExistingObjectReplication x -> ExistingObjectReplication)
-> Generic ExistingObjectReplication
forall x.
Rep ExistingObjectReplication x -> ExistingObjectReplication
forall x.
ExistingObjectReplication -> Rep ExistingObjectReplication x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ExistingObjectReplication x -> ExistingObjectReplication
$cfrom :: forall x.
ExistingObjectReplication -> Rep ExistingObjectReplication x
Prelude.Generic)

-- |
-- Create a value of 'ExistingObjectReplication' 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', 'existingObjectReplication_status' -
newExistingObjectReplication ::
  -- | 'status'
  ExistingObjectReplicationStatus ->
  ExistingObjectReplication
newExistingObjectReplication :: ExistingObjectReplicationStatus -> ExistingObjectReplication
newExistingObjectReplication ExistingObjectReplicationStatus
pStatus_ =
  ExistingObjectReplication' :: ExistingObjectReplicationStatus -> ExistingObjectReplication
ExistingObjectReplication' {$sel:status:ExistingObjectReplication' :: ExistingObjectReplicationStatus
status = ExistingObjectReplicationStatus
pStatus_}

-- |
existingObjectReplication_status :: Lens.Lens' ExistingObjectReplication ExistingObjectReplicationStatus
existingObjectReplication_status :: (ExistingObjectReplicationStatus
 -> f ExistingObjectReplicationStatus)
-> ExistingObjectReplication -> f ExistingObjectReplication
existingObjectReplication_status = (ExistingObjectReplication -> ExistingObjectReplicationStatus)
-> (ExistingObjectReplication
    -> ExistingObjectReplicationStatus -> ExistingObjectReplication)
-> Lens
     ExistingObjectReplication
     ExistingObjectReplication
     ExistingObjectReplicationStatus
     ExistingObjectReplicationStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExistingObjectReplication' {ExistingObjectReplicationStatus
status :: ExistingObjectReplicationStatus
$sel:status:ExistingObjectReplication' :: ExistingObjectReplication -> ExistingObjectReplicationStatus
status} -> ExistingObjectReplicationStatus
status) (\s :: ExistingObjectReplication
s@ExistingObjectReplication' {} ExistingObjectReplicationStatus
a -> ExistingObjectReplication
s {$sel:status:ExistingObjectReplication' :: ExistingObjectReplicationStatus
status = ExistingObjectReplicationStatus
a} :: ExistingObjectReplication)

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

instance Prelude.Hashable ExistingObjectReplication

instance Prelude.NFData ExistingObjectReplication

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