{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.ReplicateSecretToRegions
-- 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)
--
-- Converts an existing secret to a multi-Region secret and begins
-- replication the secret to a list of new regions.
module Amazonka.SecretsManager.ReplicateSecretToRegions
  ( -- * Creating a Request
    ReplicateSecretToRegions (..),
    newReplicateSecretToRegions,

    -- * Request Lenses
    replicateSecretToRegions_forceOverwriteReplicaSecret,
    replicateSecretToRegions_secretId,
    replicateSecretToRegions_addReplicaRegions,

    -- * Destructuring the Response
    ReplicateSecretToRegionsResponse (..),
    newReplicateSecretToRegionsResponse,

    -- * Response Lenses
    replicateSecretToRegionsResponse_arn,
    replicateSecretToRegionsResponse_replicationStatus,
    replicateSecretToRegionsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SecretsManager.Types

-- | /See:/ 'newReplicateSecretToRegions' smart constructor.
data ReplicateSecretToRegions = ReplicateSecretToRegions'
  { -- | (Optional) If set, Secrets Manager replication overwrites a secret with
    -- the same name in the destination region.
    ReplicateSecretToRegions -> Maybe Bool
forceOverwriteReplicaSecret :: Prelude.Maybe Prelude.Bool,
    -- | Use the @Secret Id@ to replicate a secret to regions.
    ReplicateSecretToRegions -> Text
secretId :: Prelude.Text,
    -- | Add Regions to replicate the secret.
    ReplicateSecretToRegions -> NonEmpty ReplicaRegionType
addReplicaRegions :: Prelude.NonEmpty ReplicaRegionType
  }
  deriving (ReplicateSecretToRegions -> ReplicateSecretToRegions -> Bool
(ReplicateSecretToRegions -> ReplicateSecretToRegions -> Bool)
-> (ReplicateSecretToRegions -> ReplicateSecretToRegions -> Bool)
-> Eq ReplicateSecretToRegions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReplicateSecretToRegions -> ReplicateSecretToRegions -> Bool
$c/= :: ReplicateSecretToRegions -> ReplicateSecretToRegions -> Bool
== :: ReplicateSecretToRegions -> ReplicateSecretToRegions -> Bool
$c== :: ReplicateSecretToRegions -> ReplicateSecretToRegions -> Bool
Prelude.Eq, ReadPrec [ReplicateSecretToRegions]
ReadPrec ReplicateSecretToRegions
Int -> ReadS ReplicateSecretToRegions
ReadS [ReplicateSecretToRegions]
(Int -> ReadS ReplicateSecretToRegions)
-> ReadS [ReplicateSecretToRegions]
-> ReadPrec ReplicateSecretToRegions
-> ReadPrec [ReplicateSecretToRegions]
-> Read ReplicateSecretToRegions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReplicateSecretToRegions]
$creadListPrec :: ReadPrec [ReplicateSecretToRegions]
readPrec :: ReadPrec ReplicateSecretToRegions
$creadPrec :: ReadPrec ReplicateSecretToRegions
readList :: ReadS [ReplicateSecretToRegions]
$creadList :: ReadS [ReplicateSecretToRegions]
readsPrec :: Int -> ReadS ReplicateSecretToRegions
$creadsPrec :: Int -> ReadS ReplicateSecretToRegions
Prelude.Read, Int -> ReplicateSecretToRegions -> ShowS
[ReplicateSecretToRegions] -> ShowS
ReplicateSecretToRegions -> String
(Int -> ReplicateSecretToRegions -> ShowS)
-> (ReplicateSecretToRegions -> String)
-> ([ReplicateSecretToRegions] -> ShowS)
-> Show ReplicateSecretToRegions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReplicateSecretToRegions] -> ShowS
$cshowList :: [ReplicateSecretToRegions] -> ShowS
show :: ReplicateSecretToRegions -> String
$cshow :: ReplicateSecretToRegions -> String
showsPrec :: Int -> ReplicateSecretToRegions -> ShowS
$cshowsPrec :: Int -> ReplicateSecretToRegions -> ShowS
Prelude.Show, (forall x.
 ReplicateSecretToRegions -> Rep ReplicateSecretToRegions x)
-> (forall x.
    Rep ReplicateSecretToRegions x -> ReplicateSecretToRegions)
-> Generic ReplicateSecretToRegions
forall x.
Rep ReplicateSecretToRegions x -> ReplicateSecretToRegions
forall x.
ReplicateSecretToRegions -> Rep ReplicateSecretToRegions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ReplicateSecretToRegions x -> ReplicateSecretToRegions
$cfrom :: forall x.
ReplicateSecretToRegions -> Rep ReplicateSecretToRegions x
Prelude.Generic)

-- |
-- Create a value of 'ReplicateSecretToRegions' 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:
--
-- 'forceOverwriteReplicaSecret', 'replicateSecretToRegions_forceOverwriteReplicaSecret' - (Optional) If set, Secrets Manager replication overwrites a secret with
-- the same name in the destination region.
--
-- 'secretId', 'replicateSecretToRegions_secretId' - Use the @Secret Id@ to replicate a secret to regions.
--
-- 'addReplicaRegions', 'replicateSecretToRegions_addReplicaRegions' - Add Regions to replicate the secret.
newReplicateSecretToRegions ::
  -- | 'secretId'
  Prelude.Text ->
  -- | 'addReplicaRegions'
  Prelude.NonEmpty ReplicaRegionType ->
  ReplicateSecretToRegions
newReplicateSecretToRegions :: Text -> NonEmpty ReplicaRegionType -> ReplicateSecretToRegions
newReplicateSecretToRegions
  Text
pSecretId_
  NonEmpty ReplicaRegionType
pAddReplicaRegions_ =
    ReplicateSecretToRegions' :: Maybe Bool
-> Text -> NonEmpty ReplicaRegionType -> ReplicateSecretToRegions
ReplicateSecretToRegions'
      { $sel:forceOverwriteReplicaSecret:ReplicateSecretToRegions' :: Maybe Bool
forceOverwriteReplicaSecret =
          Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:secretId:ReplicateSecretToRegions' :: Text
secretId = Text
pSecretId_,
        $sel:addReplicaRegions:ReplicateSecretToRegions' :: NonEmpty ReplicaRegionType
addReplicaRegions =
          Tagged
  (NonEmpty ReplicaRegionType)
  (Identity (NonEmpty ReplicaRegionType))
-> Tagged
     (NonEmpty ReplicaRegionType)
     (Identity (NonEmpty ReplicaRegionType))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
   (NonEmpty ReplicaRegionType)
   (Identity (NonEmpty ReplicaRegionType))
 -> Tagged
      (NonEmpty ReplicaRegionType)
      (Identity (NonEmpty ReplicaRegionType)))
-> NonEmpty ReplicaRegionType -> NonEmpty ReplicaRegionType
forall t b. AReview t b -> b -> t
Lens.# NonEmpty ReplicaRegionType
pAddReplicaRegions_
      }

-- | (Optional) If set, Secrets Manager replication overwrites a secret with
-- the same name in the destination region.
replicateSecretToRegions_forceOverwriteReplicaSecret :: Lens.Lens' ReplicateSecretToRegions (Prelude.Maybe Prelude.Bool)
replicateSecretToRegions_forceOverwriteReplicaSecret :: (Maybe Bool -> f (Maybe Bool))
-> ReplicateSecretToRegions -> f ReplicateSecretToRegions
replicateSecretToRegions_forceOverwriteReplicaSecret = (ReplicateSecretToRegions -> Maybe Bool)
-> (ReplicateSecretToRegions
    -> Maybe Bool -> ReplicateSecretToRegions)
-> Lens
     ReplicateSecretToRegions
     ReplicateSecretToRegions
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicateSecretToRegions' {Maybe Bool
forceOverwriteReplicaSecret :: Maybe Bool
$sel:forceOverwriteReplicaSecret:ReplicateSecretToRegions' :: ReplicateSecretToRegions -> Maybe Bool
forceOverwriteReplicaSecret} -> Maybe Bool
forceOverwriteReplicaSecret) (\s :: ReplicateSecretToRegions
s@ReplicateSecretToRegions' {} Maybe Bool
a -> ReplicateSecretToRegions
s {$sel:forceOverwriteReplicaSecret:ReplicateSecretToRegions' :: Maybe Bool
forceOverwriteReplicaSecret = Maybe Bool
a} :: ReplicateSecretToRegions)

-- | Use the @Secret Id@ to replicate a secret to regions.
replicateSecretToRegions_secretId :: Lens.Lens' ReplicateSecretToRegions Prelude.Text
replicateSecretToRegions_secretId :: (Text -> f Text)
-> ReplicateSecretToRegions -> f ReplicateSecretToRegions
replicateSecretToRegions_secretId = (ReplicateSecretToRegions -> Text)
-> (ReplicateSecretToRegions -> Text -> ReplicateSecretToRegions)
-> Lens ReplicateSecretToRegions ReplicateSecretToRegions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicateSecretToRegions' {Text
secretId :: Text
$sel:secretId:ReplicateSecretToRegions' :: ReplicateSecretToRegions -> Text
secretId} -> Text
secretId) (\s :: ReplicateSecretToRegions
s@ReplicateSecretToRegions' {} Text
a -> ReplicateSecretToRegions
s {$sel:secretId:ReplicateSecretToRegions' :: Text
secretId = Text
a} :: ReplicateSecretToRegions)

-- | Add Regions to replicate the secret.
replicateSecretToRegions_addReplicaRegions :: Lens.Lens' ReplicateSecretToRegions (Prelude.NonEmpty ReplicaRegionType)
replicateSecretToRegions_addReplicaRegions :: (NonEmpty ReplicaRegionType -> f (NonEmpty ReplicaRegionType))
-> ReplicateSecretToRegions -> f ReplicateSecretToRegions
replicateSecretToRegions_addReplicaRegions = (ReplicateSecretToRegions -> NonEmpty ReplicaRegionType)
-> (ReplicateSecretToRegions
    -> NonEmpty ReplicaRegionType -> ReplicateSecretToRegions)
-> Lens
     ReplicateSecretToRegions
     ReplicateSecretToRegions
     (NonEmpty ReplicaRegionType)
     (NonEmpty ReplicaRegionType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicateSecretToRegions' {NonEmpty ReplicaRegionType
addReplicaRegions :: NonEmpty ReplicaRegionType
$sel:addReplicaRegions:ReplicateSecretToRegions' :: ReplicateSecretToRegions -> NonEmpty ReplicaRegionType
addReplicaRegions} -> NonEmpty ReplicaRegionType
addReplicaRegions) (\s :: ReplicateSecretToRegions
s@ReplicateSecretToRegions' {} NonEmpty ReplicaRegionType
a -> ReplicateSecretToRegions
s {$sel:addReplicaRegions:ReplicateSecretToRegions' :: NonEmpty ReplicaRegionType
addReplicaRegions = NonEmpty ReplicaRegionType
a} :: ReplicateSecretToRegions) ((NonEmpty ReplicaRegionType -> f (NonEmpty ReplicaRegionType))
 -> ReplicateSecretToRegions -> f ReplicateSecretToRegions)
-> ((NonEmpty ReplicaRegionType -> f (NonEmpty ReplicaRegionType))
    -> NonEmpty ReplicaRegionType -> f (NonEmpty ReplicaRegionType))
-> (NonEmpty ReplicaRegionType -> f (NonEmpty ReplicaRegionType))
-> ReplicateSecretToRegions
-> f ReplicateSecretToRegions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty ReplicaRegionType -> f (NonEmpty ReplicaRegionType))
-> NonEmpty ReplicaRegionType -> f (NonEmpty ReplicaRegionType)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest ReplicateSecretToRegions where
  type
    AWSResponse ReplicateSecretToRegions =
      ReplicateSecretToRegionsResponse
  request :: ReplicateSecretToRegions -> Request ReplicateSecretToRegions
request = Service
-> ReplicateSecretToRegions -> Request ReplicateSecretToRegions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ReplicateSecretToRegions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ReplicateSecretToRegions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ReplicateSecretToRegions))
-> Logger
-> Service
-> Proxy ReplicateSecretToRegions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ReplicateSecretToRegions)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [ReplicationStatusType]
-> Int
-> ReplicateSecretToRegionsResponse
ReplicateSecretToRegionsResponse'
            (Maybe Text
 -> Maybe [ReplicationStatusType]
 -> Int
 -> ReplicateSecretToRegionsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [ReplicationStatusType]
      -> Int -> ReplicateSecretToRegionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ARN")
            Either
  String
  (Maybe [ReplicationStatusType]
   -> Int -> ReplicateSecretToRegionsResponse)
-> Either String (Maybe [ReplicationStatusType])
-> Either String (Int -> ReplicateSecretToRegionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [ReplicationStatusType]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ReplicationStatus"
                            Either String (Maybe (Maybe [ReplicationStatusType]))
-> Maybe [ReplicationStatusType]
-> Either String (Maybe [ReplicationStatusType])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ReplicationStatusType]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> ReplicateSecretToRegionsResponse)
-> Either String Int
-> Either String ReplicateSecretToRegionsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ReplicateSecretToRegions

instance Prelude.NFData ReplicateSecretToRegions

instance Core.ToHeaders ReplicateSecretToRegions where
  toHeaders :: ReplicateSecretToRegions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ReplicateSecretToRegions -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"secretsmanager.ReplicateSecretToRegions" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON ReplicateSecretToRegions where
  toJSON :: ReplicateSecretToRegions -> Value
toJSON ReplicateSecretToRegions' {Maybe Bool
NonEmpty ReplicaRegionType
Text
addReplicaRegions :: NonEmpty ReplicaRegionType
secretId :: Text
forceOverwriteReplicaSecret :: Maybe Bool
$sel:addReplicaRegions:ReplicateSecretToRegions' :: ReplicateSecretToRegions -> NonEmpty ReplicaRegionType
$sel:secretId:ReplicateSecretToRegions' :: ReplicateSecretToRegions -> Text
$sel:forceOverwriteReplicaSecret:ReplicateSecretToRegions' :: ReplicateSecretToRegions -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ForceOverwriteReplicaSecret" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
forceOverwriteReplicaSecret,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SecretId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
secretId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"AddReplicaRegions" Text -> NonEmpty ReplicaRegionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty ReplicaRegionType
addReplicaRegions)
          ]
      )

instance Core.ToPath ReplicateSecretToRegions where
  toPath :: ReplicateSecretToRegions -> ByteString
toPath = ByteString -> ReplicateSecretToRegions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery ReplicateSecretToRegions where
  toQuery :: ReplicateSecretToRegions -> QueryString
toQuery = QueryString -> ReplicateSecretToRegions -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newReplicateSecretToRegionsResponse' smart constructor.
data ReplicateSecretToRegionsResponse = ReplicateSecretToRegionsResponse'
  { -- | Replicate a secret based on the @ReplicaRegionType@> consisting of a
    -- Region(required) and a KMSKeyId (optional) which can be the ARN, KeyID,
    -- or Alias.
    ReplicateSecretToRegionsResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | Describes the secret replication status as @PENDING@, @SUCCESS@ or
    -- @FAIL@.
    ReplicateSecretToRegionsResponse -> Maybe [ReplicationStatusType]
replicationStatus :: Prelude.Maybe [ReplicationStatusType],
    -- | The response's http status code.
    ReplicateSecretToRegionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ReplicateSecretToRegionsResponse
-> ReplicateSecretToRegionsResponse -> Bool
(ReplicateSecretToRegionsResponse
 -> ReplicateSecretToRegionsResponse -> Bool)
-> (ReplicateSecretToRegionsResponse
    -> ReplicateSecretToRegionsResponse -> Bool)
-> Eq ReplicateSecretToRegionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReplicateSecretToRegionsResponse
-> ReplicateSecretToRegionsResponse -> Bool
$c/= :: ReplicateSecretToRegionsResponse
-> ReplicateSecretToRegionsResponse -> Bool
== :: ReplicateSecretToRegionsResponse
-> ReplicateSecretToRegionsResponse -> Bool
$c== :: ReplicateSecretToRegionsResponse
-> ReplicateSecretToRegionsResponse -> Bool
Prelude.Eq, ReadPrec [ReplicateSecretToRegionsResponse]
ReadPrec ReplicateSecretToRegionsResponse
Int -> ReadS ReplicateSecretToRegionsResponse
ReadS [ReplicateSecretToRegionsResponse]
(Int -> ReadS ReplicateSecretToRegionsResponse)
-> ReadS [ReplicateSecretToRegionsResponse]
-> ReadPrec ReplicateSecretToRegionsResponse
-> ReadPrec [ReplicateSecretToRegionsResponse]
-> Read ReplicateSecretToRegionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReplicateSecretToRegionsResponse]
$creadListPrec :: ReadPrec [ReplicateSecretToRegionsResponse]
readPrec :: ReadPrec ReplicateSecretToRegionsResponse
$creadPrec :: ReadPrec ReplicateSecretToRegionsResponse
readList :: ReadS [ReplicateSecretToRegionsResponse]
$creadList :: ReadS [ReplicateSecretToRegionsResponse]
readsPrec :: Int -> ReadS ReplicateSecretToRegionsResponse
$creadsPrec :: Int -> ReadS ReplicateSecretToRegionsResponse
Prelude.Read, Int -> ReplicateSecretToRegionsResponse -> ShowS
[ReplicateSecretToRegionsResponse] -> ShowS
ReplicateSecretToRegionsResponse -> String
(Int -> ReplicateSecretToRegionsResponse -> ShowS)
-> (ReplicateSecretToRegionsResponse -> String)
-> ([ReplicateSecretToRegionsResponse] -> ShowS)
-> Show ReplicateSecretToRegionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReplicateSecretToRegionsResponse] -> ShowS
$cshowList :: [ReplicateSecretToRegionsResponse] -> ShowS
show :: ReplicateSecretToRegionsResponse -> String
$cshow :: ReplicateSecretToRegionsResponse -> String
showsPrec :: Int -> ReplicateSecretToRegionsResponse -> ShowS
$cshowsPrec :: Int -> ReplicateSecretToRegionsResponse -> ShowS
Prelude.Show, (forall x.
 ReplicateSecretToRegionsResponse
 -> Rep ReplicateSecretToRegionsResponse x)
-> (forall x.
    Rep ReplicateSecretToRegionsResponse x
    -> ReplicateSecretToRegionsResponse)
-> Generic ReplicateSecretToRegionsResponse
forall x.
Rep ReplicateSecretToRegionsResponse x
-> ReplicateSecretToRegionsResponse
forall x.
ReplicateSecretToRegionsResponse
-> Rep ReplicateSecretToRegionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ReplicateSecretToRegionsResponse x
-> ReplicateSecretToRegionsResponse
$cfrom :: forall x.
ReplicateSecretToRegionsResponse
-> Rep ReplicateSecretToRegionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ReplicateSecretToRegionsResponse' 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:
--
-- 'arn', 'replicateSecretToRegionsResponse_arn' - Replicate a secret based on the @ReplicaRegionType@> consisting of a
-- Region(required) and a KMSKeyId (optional) which can be the ARN, KeyID,
-- or Alias.
--
-- 'replicationStatus', 'replicateSecretToRegionsResponse_replicationStatus' - Describes the secret replication status as @PENDING@, @SUCCESS@ or
-- @FAIL@.
--
-- 'httpStatus', 'replicateSecretToRegionsResponse_httpStatus' - The response's http status code.
newReplicateSecretToRegionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ReplicateSecretToRegionsResponse
newReplicateSecretToRegionsResponse :: Int -> ReplicateSecretToRegionsResponse
newReplicateSecretToRegionsResponse Int
pHttpStatus_ =
  ReplicateSecretToRegionsResponse' :: Maybe Text
-> Maybe [ReplicationStatusType]
-> Int
-> ReplicateSecretToRegionsResponse
ReplicateSecretToRegionsResponse'
    { $sel:arn:ReplicateSecretToRegionsResponse' :: Maybe Text
arn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:replicationStatus:ReplicateSecretToRegionsResponse' :: Maybe [ReplicationStatusType]
replicationStatus = Maybe [ReplicationStatusType]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ReplicateSecretToRegionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Replicate a secret based on the @ReplicaRegionType@> consisting of a
-- Region(required) and a KMSKeyId (optional) which can be the ARN, KeyID,
-- or Alias.
replicateSecretToRegionsResponse_arn :: Lens.Lens' ReplicateSecretToRegionsResponse (Prelude.Maybe Prelude.Text)
replicateSecretToRegionsResponse_arn :: (Maybe Text -> f (Maybe Text))
-> ReplicateSecretToRegionsResponse
-> f ReplicateSecretToRegionsResponse
replicateSecretToRegionsResponse_arn = (ReplicateSecretToRegionsResponse -> Maybe Text)
-> (ReplicateSecretToRegionsResponse
    -> Maybe Text -> ReplicateSecretToRegionsResponse)
-> Lens
     ReplicateSecretToRegionsResponse
     ReplicateSecretToRegionsResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicateSecretToRegionsResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:ReplicateSecretToRegionsResponse' :: ReplicateSecretToRegionsResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: ReplicateSecretToRegionsResponse
s@ReplicateSecretToRegionsResponse' {} Maybe Text
a -> ReplicateSecretToRegionsResponse
s {$sel:arn:ReplicateSecretToRegionsResponse' :: Maybe Text
arn = Maybe Text
a} :: ReplicateSecretToRegionsResponse)

-- | Describes the secret replication status as @PENDING@, @SUCCESS@ or
-- @FAIL@.
replicateSecretToRegionsResponse_replicationStatus :: Lens.Lens' ReplicateSecretToRegionsResponse (Prelude.Maybe [ReplicationStatusType])
replicateSecretToRegionsResponse_replicationStatus :: (Maybe [ReplicationStatusType]
 -> f (Maybe [ReplicationStatusType]))
-> ReplicateSecretToRegionsResponse
-> f ReplicateSecretToRegionsResponse
replicateSecretToRegionsResponse_replicationStatus = (ReplicateSecretToRegionsResponse -> Maybe [ReplicationStatusType])
-> (ReplicateSecretToRegionsResponse
    -> Maybe [ReplicationStatusType]
    -> ReplicateSecretToRegionsResponse)
-> Lens
     ReplicateSecretToRegionsResponse
     ReplicateSecretToRegionsResponse
     (Maybe [ReplicationStatusType])
     (Maybe [ReplicationStatusType])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicateSecretToRegionsResponse' {Maybe [ReplicationStatusType]
replicationStatus :: Maybe [ReplicationStatusType]
$sel:replicationStatus:ReplicateSecretToRegionsResponse' :: ReplicateSecretToRegionsResponse -> Maybe [ReplicationStatusType]
replicationStatus} -> Maybe [ReplicationStatusType]
replicationStatus) (\s :: ReplicateSecretToRegionsResponse
s@ReplicateSecretToRegionsResponse' {} Maybe [ReplicationStatusType]
a -> ReplicateSecretToRegionsResponse
s {$sel:replicationStatus:ReplicateSecretToRegionsResponse' :: Maybe [ReplicationStatusType]
replicationStatus = Maybe [ReplicationStatusType]
a} :: ReplicateSecretToRegionsResponse) ((Maybe [ReplicationStatusType]
  -> f (Maybe [ReplicationStatusType]))
 -> ReplicateSecretToRegionsResponse
 -> f ReplicateSecretToRegionsResponse)
-> ((Maybe [ReplicationStatusType]
     -> f (Maybe [ReplicationStatusType]))
    -> Maybe [ReplicationStatusType]
    -> f (Maybe [ReplicationStatusType]))
-> (Maybe [ReplicationStatusType]
    -> f (Maybe [ReplicationStatusType]))
-> ReplicateSecretToRegionsResponse
-> f ReplicateSecretToRegionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ReplicationStatusType]
  [ReplicationStatusType]
  [ReplicationStatusType]
  [ReplicationStatusType]
-> Iso
     (Maybe [ReplicationStatusType])
     (Maybe [ReplicationStatusType])
     (Maybe [ReplicationStatusType])
     (Maybe [ReplicationStatusType])
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
  [ReplicationStatusType]
  [ReplicationStatusType]
  [ReplicationStatusType]
  [ReplicationStatusType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
replicateSecretToRegionsResponse_httpStatus :: Lens.Lens' ReplicateSecretToRegionsResponse Prelude.Int
replicateSecretToRegionsResponse_httpStatus :: (Int -> f Int)
-> ReplicateSecretToRegionsResponse
-> f ReplicateSecretToRegionsResponse
replicateSecretToRegionsResponse_httpStatus = (ReplicateSecretToRegionsResponse -> Int)
-> (ReplicateSecretToRegionsResponse
    -> Int -> ReplicateSecretToRegionsResponse)
-> Lens
     ReplicateSecretToRegionsResponse
     ReplicateSecretToRegionsResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicateSecretToRegionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ReplicateSecretToRegionsResponse' :: ReplicateSecretToRegionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ReplicateSecretToRegionsResponse
s@ReplicateSecretToRegionsResponse' {} Int
a -> ReplicateSecretToRegionsResponse
s {$sel:httpStatus:ReplicateSecretToRegionsResponse' :: Int
httpStatus = Int
a} :: ReplicateSecretToRegionsResponse)

instance
  Prelude.NFData
    ReplicateSecretToRegionsResponse