{-# 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.FraudDetector.Types.KMSKey
-- 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.FraudDetector.Types.KMSKey where

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

-- | The KMS key details.
--
-- /See:/ 'newKMSKey' smart constructor.
data KMSKey = KMSKey'
  { -- | The encryption key ARN.
    KMSKey -> Maybe Text
kmsEncryptionKeyArn :: Prelude.Maybe Prelude.Text
  }
  deriving (KMSKey -> KMSKey -> Bool
(KMSKey -> KMSKey -> Bool)
-> (KMSKey -> KMSKey -> Bool) -> Eq KMSKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KMSKey -> KMSKey -> Bool
$c/= :: KMSKey -> KMSKey -> Bool
== :: KMSKey -> KMSKey -> Bool
$c== :: KMSKey -> KMSKey -> Bool
Prelude.Eq, ReadPrec [KMSKey]
ReadPrec KMSKey
Int -> ReadS KMSKey
ReadS [KMSKey]
(Int -> ReadS KMSKey)
-> ReadS [KMSKey]
-> ReadPrec KMSKey
-> ReadPrec [KMSKey]
-> Read KMSKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KMSKey]
$creadListPrec :: ReadPrec [KMSKey]
readPrec :: ReadPrec KMSKey
$creadPrec :: ReadPrec KMSKey
readList :: ReadS [KMSKey]
$creadList :: ReadS [KMSKey]
readsPrec :: Int -> ReadS KMSKey
$creadsPrec :: Int -> ReadS KMSKey
Prelude.Read, Int -> KMSKey -> ShowS
[KMSKey] -> ShowS
KMSKey -> String
(Int -> KMSKey -> ShowS)
-> (KMSKey -> String) -> ([KMSKey] -> ShowS) -> Show KMSKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KMSKey] -> ShowS
$cshowList :: [KMSKey] -> ShowS
show :: KMSKey -> String
$cshow :: KMSKey -> String
showsPrec :: Int -> KMSKey -> ShowS
$cshowsPrec :: Int -> KMSKey -> ShowS
Prelude.Show, (forall x. KMSKey -> Rep KMSKey x)
-> (forall x. Rep KMSKey x -> KMSKey) -> Generic KMSKey
forall x. Rep KMSKey x -> KMSKey
forall x. KMSKey -> Rep KMSKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep KMSKey x -> KMSKey
$cfrom :: forall x. KMSKey -> Rep KMSKey x
Prelude.Generic)

-- |
-- Create a value of 'KMSKey' 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:
--
-- 'kmsEncryptionKeyArn', 'kmsKey_kmsEncryptionKeyArn' - The encryption key ARN.
newKMSKey ::
  KMSKey
newKMSKey :: KMSKey
newKMSKey =
  KMSKey' :: Maybe Text -> KMSKey
KMSKey' {$sel:kmsEncryptionKeyArn:KMSKey' :: Maybe Text
kmsEncryptionKeyArn = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The encryption key ARN.
kmsKey_kmsEncryptionKeyArn :: Lens.Lens' KMSKey (Prelude.Maybe Prelude.Text)
kmsKey_kmsEncryptionKeyArn :: (Maybe Text -> f (Maybe Text)) -> KMSKey -> f KMSKey
kmsKey_kmsEncryptionKeyArn = (KMSKey -> Maybe Text)
-> (KMSKey -> Maybe Text -> KMSKey)
-> Lens KMSKey KMSKey (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KMSKey' {Maybe Text
kmsEncryptionKeyArn :: Maybe Text
$sel:kmsEncryptionKeyArn:KMSKey' :: KMSKey -> Maybe Text
kmsEncryptionKeyArn} -> Maybe Text
kmsEncryptionKeyArn) (\s :: KMSKey
s@KMSKey' {} Maybe Text
a -> KMSKey
s {$sel:kmsEncryptionKeyArn:KMSKey' :: Maybe Text
kmsEncryptionKeyArn = Maybe Text
a} :: KMSKey)

instance Core.FromJSON KMSKey where
  parseJSON :: Value -> Parser KMSKey
parseJSON =
    String -> (Object -> Parser KMSKey) -> Value -> Parser KMSKey
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"KMSKey"
      ( \Object
x ->
          Maybe Text -> KMSKey
KMSKey'
            (Maybe Text -> KMSKey) -> Parser (Maybe Text) -> Parser KMSKey
forall (f :: * -> *) a b. Functor 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
"kmsEncryptionKeyArn")
      )

instance Prelude.Hashable KMSKey

instance Prelude.NFData KMSKey