{-# 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.SecretsManager.Types.ReplicationStatusType
-- 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.SecretsManager.Types.ReplicationStatusType where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecretsManager.Types.StatusType

-- | A replication object consisting of a @RegionReplicationStatus@ object
-- and includes a Region, KMSKeyId, status, and status message.
--
-- /See:/ 'newReplicationStatusType' smart constructor.
data ReplicationStatusType = ReplicationStatusType'
  { -- | The status can be @InProgress@, @Failed@, or @InSync@.
    ReplicationStatusType -> Maybe StatusType
status :: Prelude.Maybe StatusType,
    -- | Can be an @ARN@, @Key ID@, or @Alias@.
    ReplicationStatusType -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | Status message such as \"/Secret with this name already exists in this
    -- region/\".
    ReplicationStatusType -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text,
    -- | The Region where replication occurs.
    ReplicationStatusType -> Maybe Text
region :: Prelude.Maybe Prelude.Text,
    -- | The date that you last accessed the secret in the Region.
    ReplicationStatusType -> Maybe POSIX
lastAccessedDate :: Prelude.Maybe Core.POSIX
  }
  deriving (ReplicationStatusType -> ReplicationStatusType -> Bool
(ReplicationStatusType -> ReplicationStatusType -> Bool)
-> (ReplicationStatusType -> ReplicationStatusType -> Bool)
-> Eq ReplicationStatusType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReplicationStatusType -> ReplicationStatusType -> Bool
$c/= :: ReplicationStatusType -> ReplicationStatusType -> Bool
== :: ReplicationStatusType -> ReplicationStatusType -> Bool
$c== :: ReplicationStatusType -> ReplicationStatusType -> Bool
Prelude.Eq, ReadPrec [ReplicationStatusType]
ReadPrec ReplicationStatusType
Int -> ReadS ReplicationStatusType
ReadS [ReplicationStatusType]
(Int -> ReadS ReplicationStatusType)
-> ReadS [ReplicationStatusType]
-> ReadPrec ReplicationStatusType
-> ReadPrec [ReplicationStatusType]
-> Read ReplicationStatusType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReplicationStatusType]
$creadListPrec :: ReadPrec [ReplicationStatusType]
readPrec :: ReadPrec ReplicationStatusType
$creadPrec :: ReadPrec ReplicationStatusType
readList :: ReadS [ReplicationStatusType]
$creadList :: ReadS [ReplicationStatusType]
readsPrec :: Int -> ReadS ReplicationStatusType
$creadsPrec :: Int -> ReadS ReplicationStatusType
Prelude.Read, Int -> ReplicationStatusType -> ShowS
[ReplicationStatusType] -> ShowS
ReplicationStatusType -> String
(Int -> ReplicationStatusType -> ShowS)
-> (ReplicationStatusType -> String)
-> ([ReplicationStatusType] -> ShowS)
-> Show ReplicationStatusType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReplicationStatusType] -> ShowS
$cshowList :: [ReplicationStatusType] -> ShowS
show :: ReplicationStatusType -> String
$cshow :: ReplicationStatusType -> String
showsPrec :: Int -> ReplicationStatusType -> ShowS
$cshowsPrec :: Int -> ReplicationStatusType -> ShowS
Prelude.Show, (forall x. ReplicationStatusType -> Rep ReplicationStatusType x)
-> (forall x. Rep ReplicationStatusType x -> ReplicationStatusType)
-> Generic ReplicationStatusType
forall x. Rep ReplicationStatusType x -> ReplicationStatusType
forall x. ReplicationStatusType -> Rep ReplicationStatusType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReplicationStatusType x -> ReplicationStatusType
$cfrom :: forall x. ReplicationStatusType -> Rep ReplicationStatusType x
Prelude.Generic)

-- |
-- Create a value of 'ReplicationStatusType' 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', 'replicationStatusType_status' - The status can be @InProgress@, @Failed@, or @InSync@.
--
-- 'kmsKeyId', 'replicationStatusType_kmsKeyId' - Can be an @ARN@, @Key ID@, or @Alias@.
--
-- 'statusMessage', 'replicationStatusType_statusMessage' - Status message such as \"/Secret with this name already exists in this
-- region/\".
--
-- 'region', 'replicationStatusType_region' - The Region where replication occurs.
--
-- 'lastAccessedDate', 'replicationStatusType_lastAccessedDate' - The date that you last accessed the secret in the Region.
newReplicationStatusType ::
  ReplicationStatusType
newReplicationStatusType :: ReplicationStatusType
newReplicationStatusType =
  ReplicationStatusType' :: Maybe StatusType
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> ReplicationStatusType
ReplicationStatusType'
    { $sel:status:ReplicationStatusType' :: Maybe StatusType
status = Maybe StatusType
forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyId:ReplicationStatusType' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:ReplicationStatusType' :: Maybe Text
statusMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:region:ReplicationStatusType' :: Maybe Text
region = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastAccessedDate:ReplicationStatusType' :: Maybe POSIX
lastAccessedDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The status can be @InProgress@, @Failed@, or @InSync@.
replicationStatusType_status :: Lens.Lens' ReplicationStatusType (Prelude.Maybe StatusType)
replicationStatusType_status :: (Maybe StatusType -> f (Maybe StatusType))
-> ReplicationStatusType -> f ReplicationStatusType
replicationStatusType_status = (ReplicationStatusType -> Maybe StatusType)
-> (ReplicationStatusType
    -> Maybe StatusType -> ReplicationStatusType)
-> Lens
     ReplicationStatusType
     ReplicationStatusType
     (Maybe StatusType)
     (Maybe StatusType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicationStatusType' {Maybe StatusType
status :: Maybe StatusType
$sel:status:ReplicationStatusType' :: ReplicationStatusType -> Maybe StatusType
status} -> Maybe StatusType
status) (\s :: ReplicationStatusType
s@ReplicationStatusType' {} Maybe StatusType
a -> ReplicationStatusType
s {$sel:status:ReplicationStatusType' :: Maybe StatusType
status = Maybe StatusType
a} :: ReplicationStatusType)

-- | Can be an @ARN@, @Key ID@, or @Alias@.
replicationStatusType_kmsKeyId :: Lens.Lens' ReplicationStatusType (Prelude.Maybe Prelude.Text)
replicationStatusType_kmsKeyId :: (Maybe Text -> f (Maybe Text))
-> ReplicationStatusType -> f ReplicationStatusType
replicationStatusType_kmsKeyId = (ReplicationStatusType -> Maybe Text)
-> (ReplicationStatusType -> Maybe Text -> ReplicationStatusType)
-> Lens
     ReplicationStatusType
     ReplicationStatusType
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicationStatusType' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:ReplicationStatusType' :: ReplicationStatusType -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: ReplicationStatusType
s@ReplicationStatusType' {} Maybe Text
a -> ReplicationStatusType
s {$sel:kmsKeyId:ReplicationStatusType' :: Maybe Text
kmsKeyId = Maybe Text
a} :: ReplicationStatusType)

-- | Status message such as \"/Secret with this name already exists in this
-- region/\".
replicationStatusType_statusMessage :: Lens.Lens' ReplicationStatusType (Prelude.Maybe Prelude.Text)
replicationStatusType_statusMessage :: (Maybe Text -> f (Maybe Text))
-> ReplicationStatusType -> f ReplicationStatusType
replicationStatusType_statusMessage = (ReplicationStatusType -> Maybe Text)
-> (ReplicationStatusType -> Maybe Text -> ReplicationStatusType)
-> Lens
     ReplicationStatusType
     ReplicationStatusType
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicationStatusType' {Maybe Text
statusMessage :: Maybe Text
$sel:statusMessage:ReplicationStatusType' :: ReplicationStatusType -> Maybe Text
statusMessage} -> Maybe Text
statusMessage) (\s :: ReplicationStatusType
s@ReplicationStatusType' {} Maybe Text
a -> ReplicationStatusType
s {$sel:statusMessage:ReplicationStatusType' :: Maybe Text
statusMessage = Maybe Text
a} :: ReplicationStatusType)

-- | The Region where replication occurs.
replicationStatusType_region :: Lens.Lens' ReplicationStatusType (Prelude.Maybe Prelude.Text)
replicationStatusType_region :: (Maybe Text -> f (Maybe Text))
-> ReplicationStatusType -> f ReplicationStatusType
replicationStatusType_region = (ReplicationStatusType -> Maybe Text)
-> (ReplicationStatusType -> Maybe Text -> ReplicationStatusType)
-> Lens
     ReplicationStatusType
     ReplicationStatusType
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicationStatusType' {Maybe Text
region :: Maybe Text
$sel:region:ReplicationStatusType' :: ReplicationStatusType -> Maybe Text
region} -> Maybe Text
region) (\s :: ReplicationStatusType
s@ReplicationStatusType' {} Maybe Text
a -> ReplicationStatusType
s {$sel:region:ReplicationStatusType' :: Maybe Text
region = Maybe Text
a} :: ReplicationStatusType)

-- | The date that you last accessed the secret in the Region.
replicationStatusType_lastAccessedDate :: Lens.Lens' ReplicationStatusType (Prelude.Maybe Prelude.UTCTime)
replicationStatusType_lastAccessedDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ReplicationStatusType -> f ReplicationStatusType
replicationStatusType_lastAccessedDate = (ReplicationStatusType -> Maybe POSIX)
-> (ReplicationStatusType -> Maybe POSIX -> ReplicationStatusType)
-> Lens
     ReplicationStatusType
     ReplicationStatusType
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicationStatusType' {Maybe POSIX
lastAccessedDate :: Maybe POSIX
$sel:lastAccessedDate:ReplicationStatusType' :: ReplicationStatusType -> Maybe POSIX
lastAccessedDate} -> Maybe POSIX
lastAccessedDate) (\s :: ReplicationStatusType
s@ReplicationStatusType' {} Maybe POSIX
a -> ReplicationStatusType
s {$sel:lastAccessedDate:ReplicationStatusType' :: Maybe POSIX
lastAccessedDate = Maybe POSIX
a} :: ReplicationStatusType) ((Maybe POSIX -> f (Maybe POSIX))
 -> ReplicationStatusType -> f ReplicationStatusType)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ReplicationStatusType
-> f ReplicationStatusType
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON ReplicationStatusType where
  parseJSON :: Value -> Parser ReplicationStatusType
parseJSON =
    String
-> (Object -> Parser ReplicationStatusType)
-> Value
-> Parser ReplicationStatusType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ReplicationStatusType"
      ( \Object
x ->
          Maybe StatusType
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> ReplicationStatusType
ReplicationStatusType'
            (Maybe StatusType
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> ReplicationStatusType)
-> Parser (Maybe StatusType)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> ReplicationStatusType)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe StatusType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> ReplicationStatusType)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe POSIX -> ReplicationStatusType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"KmsKeyId")
            Parser
  (Maybe Text -> Maybe Text -> Maybe POSIX -> ReplicationStatusType)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe POSIX -> ReplicationStatusType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StatusMessage")
            Parser (Maybe Text -> Maybe POSIX -> ReplicationStatusType)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> ReplicationStatusType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Region")
            Parser (Maybe POSIX -> ReplicationStatusType)
-> Parser (Maybe POSIX) -> Parser ReplicationStatusType
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastAccessedDate")
      )

instance Prelude.Hashable ReplicationStatusType

instance Prelude.NFData ReplicationStatusType