{-# 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.ReplicationTimeValue
-- 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.ReplicationTimeValue where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.Internal

-- | A container specifying the time value for S3 Replication Time Control
-- (S3 RTC) and replication metrics @EventThreshold@.
--
-- /See:/ 'newReplicationTimeValue' smart constructor.
data ReplicationTimeValue = ReplicationTimeValue'
  { -- | Contains an integer specifying time in minutes.
    --
    -- Valid value: 15
    ReplicationTimeValue -> Maybe Int
minutes :: Prelude.Maybe Prelude.Int
  }
  deriving (ReplicationTimeValue -> ReplicationTimeValue -> Bool
(ReplicationTimeValue -> ReplicationTimeValue -> Bool)
-> (ReplicationTimeValue -> ReplicationTimeValue -> Bool)
-> Eq ReplicationTimeValue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReplicationTimeValue -> ReplicationTimeValue -> Bool
$c/= :: ReplicationTimeValue -> ReplicationTimeValue -> Bool
== :: ReplicationTimeValue -> ReplicationTimeValue -> Bool
$c== :: ReplicationTimeValue -> ReplicationTimeValue -> Bool
Prelude.Eq, ReadPrec [ReplicationTimeValue]
ReadPrec ReplicationTimeValue
Int -> ReadS ReplicationTimeValue
ReadS [ReplicationTimeValue]
(Int -> ReadS ReplicationTimeValue)
-> ReadS [ReplicationTimeValue]
-> ReadPrec ReplicationTimeValue
-> ReadPrec [ReplicationTimeValue]
-> Read ReplicationTimeValue
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReplicationTimeValue]
$creadListPrec :: ReadPrec [ReplicationTimeValue]
readPrec :: ReadPrec ReplicationTimeValue
$creadPrec :: ReadPrec ReplicationTimeValue
readList :: ReadS [ReplicationTimeValue]
$creadList :: ReadS [ReplicationTimeValue]
readsPrec :: Int -> ReadS ReplicationTimeValue
$creadsPrec :: Int -> ReadS ReplicationTimeValue
Prelude.Read, Int -> ReplicationTimeValue -> ShowS
[ReplicationTimeValue] -> ShowS
ReplicationTimeValue -> String
(Int -> ReplicationTimeValue -> ShowS)
-> (ReplicationTimeValue -> String)
-> ([ReplicationTimeValue] -> ShowS)
-> Show ReplicationTimeValue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReplicationTimeValue] -> ShowS
$cshowList :: [ReplicationTimeValue] -> ShowS
show :: ReplicationTimeValue -> String
$cshow :: ReplicationTimeValue -> String
showsPrec :: Int -> ReplicationTimeValue -> ShowS
$cshowsPrec :: Int -> ReplicationTimeValue -> ShowS
Prelude.Show, (forall x. ReplicationTimeValue -> Rep ReplicationTimeValue x)
-> (forall x. Rep ReplicationTimeValue x -> ReplicationTimeValue)
-> Generic ReplicationTimeValue
forall x. Rep ReplicationTimeValue x -> ReplicationTimeValue
forall x. ReplicationTimeValue -> Rep ReplicationTimeValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReplicationTimeValue x -> ReplicationTimeValue
$cfrom :: forall x. ReplicationTimeValue -> Rep ReplicationTimeValue x
Prelude.Generic)

-- |
-- Create a value of 'ReplicationTimeValue' 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:
--
-- 'minutes', 'replicationTimeValue_minutes' - Contains an integer specifying time in minutes.
--
-- Valid value: 15
newReplicationTimeValue ::
  ReplicationTimeValue
newReplicationTimeValue :: ReplicationTimeValue
newReplicationTimeValue =
  ReplicationTimeValue' :: Maybe Int -> ReplicationTimeValue
ReplicationTimeValue' {$sel:minutes:ReplicationTimeValue' :: Maybe Int
minutes = Maybe Int
forall a. Maybe a
Prelude.Nothing}

-- | Contains an integer specifying time in minutes.
--
-- Valid value: 15
replicationTimeValue_minutes :: Lens.Lens' ReplicationTimeValue (Prelude.Maybe Prelude.Int)
replicationTimeValue_minutes :: (Maybe Int -> f (Maybe Int))
-> ReplicationTimeValue -> f ReplicationTimeValue
replicationTimeValue_minutes = (ReplicationTimeValue -> Maybe Int)
-> (ReplicationTimeValue -> Maybe Int -> ReplicationTimeValue)
-> Lens
     ReplicationTimeValue ReplicationTimeValue (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicationTimeValue' {Maybe Int
minutes :: Maybe Int
$sel:minutes:ReplicationTimeValue' :: ReplicationTimeValue -> Maybe Int
minutes} -> Maybe Int
minutes) (\s :: ReplicationTimeValue
s@ReplicationTimeValue' {} Maybe Int
a -> ReplicationTimeValue
s {$sel:minutes:ReplicationTimeValue' :: Maybe Int
minutes = Maybe Int
a} :: ReplicationTimeValue)

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

instance Prelude.Hashable ReplicationTimeValue

instance Prelude.NFData ReplicationTimeValue

instance Core.ToXML ReplicationTimeValue where
  toXML :: ReplicationTimeValue -> XML
toXML ReplicationTimeValue' {Maybe Int
minutes :: Maybe Int
$sel:minutes:ReplicationTimeValue' :: ReplicationTimeValue -> Maybe Int
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat [Name
"Minutes" Name -> Maybe Int -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Int
minutes]