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

-- | 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
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]
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
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. 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' {$sel:kmsEncryptionKeyArn:KMSKey' :: Maybe Text
kmsEncryptionKeyArn = forall a. Maybe a
Prelude.Nothing}

-- | The encryption key ARN.
kmsKey_kmsEncryptionKeyArn :: Lens.Lens' KMSKey (Prelude.Maybe Prelude.Text)
kmsKey_kmsEncryptionKeyArn :: Lens' KMSKey (Maybe Text)
kmsKey_kmsEncryptionKeyArn = 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 Data.FromJSON KMSKey where
  parseJSON :: Value -> Parser KMSKey
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"KMSKey"
      ( \Object
x ->
          Maybe Text -> KMSKey
KMSKey'
            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
"kmsEncryptionKeyArn")
      )

instance Prelude.Hashable KMSKey where
  hashWithSalt :: Int -> KMSKey -> Int
hashWithSalt Int
_salt KMSKey' {Maybe Text
kmsEncryptionKeyArn :: Maybe Text
$sel:kmsEncryptionKeyArn:KMSKey' :: KMSKey -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsEncryptionKeyArn

instance Prelude.NFData KMSKey where
  rnf :: KMSKey -> ()
rnf KMSKey' {Maybe Text
kmsEncryptionKeyArn :: Maybe Text
$sel:kmsEncryptionKeyArn:KMSKey' :: KMSKey -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
kmsEncryptionKeyArn