{-# 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.ReplicaRegionType
-- 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.ReplicaRegionType 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

-- | A custom type that specifies a @Region@ and the @KmsKeyId@ for a replica
-- secret.
--
-- /See:/ 'newReplicaRegionType' smart constructor.
data ReplicaRegionType = ReplicaRegionType'
  { -- | The ARN, key ID, or alias of the KMS key to encrypt the secret. If you
    -- don\'t include this field, Secrets Manager uses @aws\/secretsmanager@.
    ReplicaRegionType -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | A Region code. For a list of Region codes, see
    -- <https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints Name and code of Regions>.
    ReplicaRegionType -> Maybe Text
region :: Prelude.Maybe Prelude.Text
  }
  deriving (ReplicaRegionType -> ReplicaRegionType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReplicaRegionType -> ReplicaRegionType -> Bool
$c/= :: ReplicaRegionType -> ReplicaRegionType -> Bool
== :: ReplicaRegionType -> ReplicaRegionType -> Bool
$c== :: ReplicaRegionType -> ReplicaRegionType -> Bool
Prelude.Eq, ReadPrec [ReplicaRegionType]
ReadPrec ReplicaRegionType
Int -> ReadS ReplicaRegionType
ReadS [ReplicaRegionType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReplicaRegionType]
$creadListPrec :: ReadPrec [ReplicaRegionType]
readPrec :: ReadPrec ReplicaRegionType
$creadPrec :: ReadPrec ReplicaRegionType
readList :: ReadS [ReplicaRegionType]
$creadList :: ReadS [ReplicaRegionType]
readsPrec :: Int -> ReadS ReplicaRegionType
$creadsPrec :: Int -> ReadS ReplicaRegionType
Prelude.Read, Int -> ReplicaRegionType -> ShowS
[ReplicaRegionType] -> ShowS
ReplicaRegionType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReplicaRegionType] -> ShowS
$cshowList :: [ReplicaRegionType] -> ShowS
show :: ReplicaRegionType -> String
$cshow :: ReplicaRegionType -> String
showsPrec :: Int -> ReplicaRegionType -> ShowS
$cshowsPrec :: Int -> ReplicaRegionType -> ShowS
Prelude.Show, forall x. Rep ReplicaRegionType x -> ReplicaRegionType
forall x. ReplicaRegionType -> Rep ReplicaRegionType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReplicaRegionType x -> ReplicaRegionType
$cfrom :: forall x. ReplicaRegionType -> Rep ReplicaRegionType x
Prelude.Generic)

-- |
-- Create a value of 'ReplicaRegionType' 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', 'replicaRegionType_kmsKeyId' - The ARN, key ID, or alias of the KMS key to encrypt the secret. If you
-- don\'t include this field, Secrets Manager uses @aws\/secretsmanager@.
--
-- 'region', 'replicaRegionType_region' - A Region code. For a list of Region codes, see
-- <https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints Name and code of Regions>.
newReplicaRegionType ::
  ReplicaRegionType
newReplicaRegionType :: ReplicaRegionType
newReplicaRegionType =
  ReplicaRegionType'
    { $sel:kmsKeyId:ReplicaRegionType' :: Maybe Text
kmsKeyId = forall a. Maybe a
Prelude.Nothing,
      $sel:region:ReplicaRegionType' :: Maybe Text
region = forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN, key ID, or alias of the KMS key to encrypt the secret. If you
-- don\'t include this field, Secrets Manager uses @aws\/secretsmanager@.
replicaRegionType_kmsKeyId :: Lens.Lens' ReplicaRegionType (Prelude.Maybe Prelude.Text)
replicaRegionType_kmsKeyId :: Lens' ReplicaRegionType (Maybe Text)
replicaRegionType_kmsKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicaRegionType' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:ReplicaRegionType' :: ReplicaRegionType -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: ReplicaRegionType
s@ReplicaRegionType' {} Maybe Text
a -> ReplicaRegionType
s {$sel:kmsKeyId:ReplicaRegionType' :: Maybe Text
kmsKeyId = Maybe Text
a} :: ReplicaRegionType)

-- | A Region code. For a list of Region codes, see
-- <https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints Name and code of Regions>.
replicaRegionType_region :: Lens.Lens' ReplicaRegionType (Prelude.Maybe Prelude.Text)
replicaRegionType_region :: Lens' ReplicaRegionType (Maybe Text)
replicaRegionType_region = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicaRegionType' {Maybe Text
region :: Maybe Text
$sel:region:ReplicaRegionType' :: ReplicaRegionType -> Maybe Text
region} -> Maybe Text
region) (\s :: ReplicaRegionType
s@ReplicaRegionType' {} Maybe Text
a -> ReplicaRegionType
s {$sel:region:ReplicaRegionType' :: Maybe Text
region = Maybe Text
a} :: ReplicaRegionType)

instance Prelude.Hashable ReplicaRegionType where
  hashWithSalt :: Int -> ReplicaRegionType -> Int
hashWithSalt Int
_salt ReplicaRegionType' {Maybe Text
region :: Maybe Text
kmsKeyId :: Maybe Text
$sel:region:ReplicaRegionType' :: ReplicaRegionType -> Maybe Text
$sel:kmsKeyId:ReplicaRegionType' :: ReplicaRegionType -> 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 Text
region

instance Prelude.NFData ReplicaRegionType where
  rnf :: ReplicaRegionType -> ()
rnf ReplicaRegionType' {Maybe Text
region :: Maybe Text
kmsKeyId :: Maybe Text
$sel:region:ReplicaRegionType' :: ReplicaRegionType -> Maybe Text
$sel:kmsKeyId:ReplicaRegionType' :: ReplicaRegionType -> 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 Text
region

instance Data.ToJSON ReplicaRegionType where
  toJSON :: ReplicaRegionType -> Value
toJSON ReplicaRegionType' {Maybe Text
region :: Maybe Text
kmsKeyId :: Maybe Text
$sel:region:ReplicaRegionType' :: ReplicaRegionType -> Maybe Text
$sel:kmsKeyId:ReplicaRegionType' :: ReplicaRegionType -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"KmsKeyId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyId,
            (Key
"Region" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
region
          ]
      )