{-# 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.KMS.Types.XksKeyConfigurationType
-- 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.KMS.Types.XksKeyConfigurationType 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

-- | Information about the
-- <https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html#concept-external-key external key>
-- that is associated with a KMS key in an external key store.
--
-- This element appears in a CreateKey or DescribeKey response only for a
-- KMS key in an external key store.
--
-- The /external key/ is a symmetric encryption key that is hosted by an
-- external key manager outside of Amazon Web Services. When you use the
-- KMS key in an external key store in a cryptographic operation, the
-- cryptographic operation is performed in the external key manager using
-- the specified external key. For more information, see
-- <https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html#concept-external-key External key>
-- in the /Key Management Service Developer Guide/.
--
-- /See:/ 'newXksKeyConfigurationType' smart constructor.
data XksKeyConfigurationType = XksKeyConfigurationType'
  { -- | The ID of the external key in its external key manager. This is the ID
    -- that the external key store proxy uses to identify the external key.
    XksKeyConfigurationType -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (XksKeyConfigurationType -> XksKeyConfigurationType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: XksKeyConfigurationType -> XksKeyConfigurationType -> Bool
$c/= :: XksKeyConfigurationType -> XksKeyConfigurationType -> Bool
== :: XksKeyConfigurationType -> XksKeyConfigurationType -> Bool
$c== :: XksKeyConfigurationType -> XksKeyConfigurationType -> Bool
Prelude.Eq, ReadPrec [XksKeyConfigurationType]
ReadPrec XksKeyConfigurationType
Int -> ReadS XksKeyConfigurationType
ReadS [XksKeyConfigurationType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [XksKeyConfigurationType]
$creadListPrec :: ReadPrec [XksKeyConfigurationType]
readPrec :: ReadPrec XksKeyConfigurationType
$creadPrec :: ReadPrec XksKeyConfigurationType
readList :: ReadS [XksKeyConfigurationType]
$creadList :: ReadS [XksKeyConfigurationType]
readsPrec :: Int -> ReadS XksKeyConfigurationType
$creadsPrec :: Int -> ReadS XksKeyConfigurationType
Prelude.Read, Int -> XksKeyConfigurationType -> ShowS
[XksKeyConfigurationType] -> ShowS
XksKeyConfigurationType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [XksKeyConfigurationType] -> ShowS
$cshowList :: [XksKeyConfigurationType] -> ShowS
show :: XksKeyConfigurationType -> String
$cshow :: XksKeyConfigurationType -> String
showsPrec :: Int -> XksKeyConfigurationType -> ShowS
$cshowsPrec :: Int -> XksKeyConfigurationType -> ShowS
Prelude.Show, forall x. Rep XksKeyConfigurationType x -> XksKeyConfigurationType
forall x. XksKeyConfigurationType -> Rep XksKeyConfigurationType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep XksKeyConfigurationType x -> XksKeyConfigurationType
$cfrom :: forall x. XksKeyConfigurationType -> Rep XksKeyConfigurationType x
Prelude.Generic)

-- |
-- Create a value of 'XksKeyConfigurationType' 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:
--
-- 'id', 'xksKeyConfigurationType_id' - The ID of the external key in its external key manager. This is the ID
-- that the external key store proxy uses to identify the external key.
newXksKeyConfigurationType ::
  XksKeyConfigurationType
newXksKeyConfigurationType :: XksKeyConfigurationType
newXksKeyConfigurationType =
  XksKeyConfigurationType' {$sel:id:XksKeyConfigurationType' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing}

-- | The ID of the external key in its external key manager. This is the ID
-- that the external key store proxy uses to identify the external key.
xksKeyConfigurationType_id :: Lens.Lens' XksKeyConfigurationType (Prelude.Maybe Prelude.Text)
xksKeyConfigurationType_id :: Lens' XksKeyConfigurationType (Maybe Text)
xksKeyConfigurationType_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\XksKeyConfigurationType' {Maybe Text
id :: Maybe Text
$sel:id:XksKeyConfigurationType' :: XksKeyConfigurationType -> Maybe Text
id} -> Maybe Text
id) (\s :: XksKeyConfigurationType
s@XksKeyConfigurationType' {} Maybe Text
a -> XksKeyConfigurationType
s {$sel:id:XksKeyConfigurationType' :: Maybe Text
id = Maybe Text
a} :: XksKeyConfigurationType)

instance Data.FromJSON XksKeyConfigurationType where
  parseJSON :: Value -> Parser XksKeyConfigurationType
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"XksKeyConfigurationType"
      ( \Object
x ->
          Maybe Text -> XksKeyConfigurationType
XksKeyConfigurationType'
            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
"Id")
      )

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

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