{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SecretsManager.Types.ReplicationStatusType where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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'
  { -- | Can be an @ARN@, @Key ID@, or @Alias@.
    ReplicationStatusType -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | The date that the secret was last accessed in the Region. This field is
    -- omitted if the secret has never been retrieved in the Region.
    ReplicationStatusType -> Maybe POSIX
lastAccessedDate :: Prelude.Maybe Data.POSIX,
    -- | The Region where replication occurs.
    ReplicationStatusType -> Maybe Text
region :: Prelude.Maybe Prelude.Text,
    -- | The status can be @InProgress@, @Failed@, or @InSync@.
    ReplicationStatusType -> Maybe StatusType
status :: Prelude.Maybe StatusType,
    -- | Status message such as \"/Secret with this name already exists in this
    -- region/\".
    ReplicationStatusType -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (ReplicationStatusType -> ReplicationStatusType -> Bool
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]
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
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. 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:
--
-- 'kmsKeyId', 'replicationStatusType_kmsKeyId' - Can be an @ARN@, @Key ID@, or @Alias@.
--
-- 'lastAccessedDate', 'replicationStatusType_lastAccessedDate' - The date that the secret was last accessed in the Region. This field is
-- omitted if the secret has never been retrieved in the Region.
--
-- 'region', 'replicationStatusType_region' - The Region where replication occurs.
--
-- 'status', 'replicationStatusType_status' - The status can be @InProgress@, @Failed@, or @InSync@.
--
-- 'statusMessage', 'replicationStatusType_statusMessage' - Status message such as \"/Secret with this name already exists in this
-- region/\".
newReplicationStatusType ::
  ReplicationStatusType
newReplicationStatusType :: ReplicationStatusType
newReplicationStatusType =
  ReplicationStatusType'
    { $sel:kmsKeyId:ReplicationStatusType' :: Maybe Text
kmsKeyId = forall a. Maybe a
Prelude.Nothing,
      $sel:lastAccessedDate:ReplicationStatusType' :: Maybe POSIX
lastAccessedDate = forall a. Maybe a
Prelude.Nothing,
      $sel:region:ReplicationStatusType' :: Maybe Text
region = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ReplicationStatusType' :: Maybe StatusType
status = forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:ReplicationStatusType' :: Maybe Text
statusMessage = forall a. Maybe a
Prelude.Nothing
    }

-- | Can be an @ARN@, @Key ID@, or @Alias@.
replicationStatusType_kmsKeyId :: Lens.Lens' ReplicationStatusType (Prelude.Maybe Prelude.Text)
replicationStatusType_kmsKeyId :: Lens' ReplicationStatusType (Maybe Text)
replicationStatusType_kmsKeyId = 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)

-- | The date that the secret was last accessed in the Region. This field is
-- omitted if the secret has never been retrieved in the Region.
replicationStatusType_lastAccessedDate :: Lens.Lens' ReplicationStatusType (Prelude.Maybe Prelude.UTCTime)
replicationStatusType_lastAccessedDate :: Lens' ReplicationStatusType (Maybe UTCTime)
replicationStatusType_lastAccessedDate = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The Region where replication occurs.
replicationStatusType_region :: Lens.Lens' ReplicationStatusType (Prelude.Maybe Prelude.Text)
replicationStatusType_region :: Lens' ReplicationStatusType (Maybe Text)
replicationStatusType_region = 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 status can be @InProgress@, @Failed@, or @InSync@.
replicationStatusType_status :: Lens.Lens' ReplicationStatusType (Prelude.Maybe StatusType)
replicationStatusType_status :: Lens' ReplicationStatusType (Maybe StatusType)
replicationStatusType_status = 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)

-- | Status message such as \"/Secret with this name already exists in this
-- region/\".
replicationStatusType_statusMessage :: Lens.Lens' ReplicationStatusType (Prelude.Maybe Prelude.Text)
replicationStatusType_statusMessage :: Lens' ReplicationStatusType (Maybe Text)
replicationStatusType_statusMessage = 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)

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

instance Prelude.Hashable ReplicationStatusType where
  hashWithSalt :: Int -> ReplicationStatusType -> Int
hashWithSalt Int
_salt ReplicationStatusType' {Maybe Text
Maybe POSIX
Maybe StatusType
statusMessage :: Maybe Text
status :: Maybe StatusType
region :: Maybe Text
lastAccessedDate :: Maybe POSIX
kmsKeyId :: Maybe Text
$sel:statusMessage:ReplicationStatusType' :: ReplicationStatusType -> Maybe Text
$sel:status:ReplicationStatusType' :: ReplicationStatusType -> Maybe StatusType
$sel:region:ReplicationStatusType' :: ReplicationStatusType -> Maybe Text
$sel:lastAccessedDate:ReplicationStatusType' :: ReplicationStatusType -> Maybe POSIX
$sel:kmsKeyId:ReplicationStatusType' :: ReplicationStatusType -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsKeyId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastAccessedDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
region
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StatusType
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
statusMessage

instance Prelude.NFData ReplicationStatusType where
  rnf :: ReplicationStatusType -> ()
rnf ReplicationStatusType' {Maybe Text
Maybe POSIX
Maybe StatusType
statusMessage :: Maybe Text
status :: Maybe StatusType
region :: Maybe Text
lastAccessedDate :: Maybe POSIX
kmsKeyId :: Maybe Text
$sel:statusMessage:ReplicationStatusType' :: ReplicationStatusType -> Maybe Text
$sel:status:ReplicationStatusType' :: ReplicationStatusType -> Maybe StatusType
$sel:region:ReplicationStatusType' :: ReplicationStatusType -> Maybe Text
$sel:lastAccessedDate:ReplicationStatusType' :: ReplicationStatusType -> Maybe POSIX
$sel:kmsKeyId:ReplicationStatusType' :: ReplicationStatusType -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
kmsKeyId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastAccessedDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
region
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe StatusType
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
statusMessage