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

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

-- | (Optional) Custom type consisting of a @Region@ (required) and the
-- @KmsKeyId@ which can be an @ARN@, @Key ID@, or @Alias@.
--
-- /See:/ 'newReplicaRegionType' smart constructor.
data ReplicaRegionType = ReplicaRegionType'
  { -- | Can be an @ARN@, @Key ID@, or @Alias@.
    ReplicaRegionType -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | Describes a single instance of Region objects.
    ReplicaRegionType -> Maybe Text
region :: Prelude.Maybe Prelude.Text
  }
  deriving (ReplicaRegionType -> ReplicaRegionType -> Bool
(ReplicaRegionType -> ReplicaRegionType -> Bool)
-> (ReplicaRegionType -> ReplicaRegionType -> Bool)
-> Eq ReplicaRegionType
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]
(Int -> ReadS ReplicaRegionType)
-> ReadS [ReplicaRegionType]
-> ReadPrec ReplicaRegionType
-> ReadPrec [ReplicaRegionType]
-> Read 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
(Int -> ReplicaRegionType -> ShowS)
-> (ReplicaRegionType -> String)
-> ([ReplicaRegionType] -> ShowS)
-> Show ReplicaRegionType
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. ReplicaRegionType -> Rep ReplicaRegionType x)
-> (forall x. Rep ReplicaRegionType x -> ReplicaRegionType)
-> Generic ReplicaRegionType
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' - Can be an @ARN@, @Key ID@, or @Alias@.
--
-- 'region', 'replicaRegionType_region' - Describes a single instance of Region objects.
newReplicaRegionType ::
  ReplicaRegionType
newReplicaRegionType :: ReplicaRegionType
newReplicaRegionType =
  ReplicaRegionType' :: Maybe Text -> Maybe Text -> ReplicaRegionType
ReplicaRegionType'
    { $sel:kmsKeyId:ReplicaRegionType' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:region:ReplicaRegionType' :: Maybe Text
region = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | Describes a single instance of Region objects.
replicaRegionType_region :: Lens.Lens' ReplicaRegionType (Prelude.Maybe Prelude.Text)
replicaRegionType_region :: (Maybe Text -> f (Maybe Text))
-> ReplicaRegionType -> f ReplicaRegionType
replicaRegionType_region = (ReplicaRegionType -> Maybe Text)
-> (ReplicaRegionType -> Maybe Text -> ReplicaRegionType)
-> Lens
     ReplicaRegionType ReplicaRegionType (Maybe Text) (Maybe Text)
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

instance Prelude.NFData ReplicaRegionType

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"KmsKeyId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyId,
            (Text
"Region" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
region
          ]
      )