{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.DescribeKey
-- 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)
--
-- Provides detailed information about a KMS key. You can run @DescribeKey@
-- on a
-- <https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk customer managed key>
-- or an
-- <https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk Amazon Web Services managed key>.
--
-- This detailed information includes the key ARN, creation date (and
-- deletion date, if applicable), the key state, and the origin and
-- expiration date (if any) of the key material. It includes fields, like
-- @KeySpec@, that help you distinguish symmetric from asymmetric KMS keys.
-- It also provides information that is particularly important to
-- asymmetric keys, such as the key usage (encryption or signing) and the
-- encryption algorithms or signing algorithms that the KMS key supports.
-- For KMS keys in custom key stores, it includes information about the
-- custom key store, such as the key store ID and the CloudHSM cluster ID.
-- For multi-Region keys, it displays the primary key and all related
-- replica keys.
--
-- @DescribeKey@ does not return the following information:
--
-- -   Aliases associated with the KMS key. To get this information, use
--     ListAliases.
--
-- -   Whether automatic key rotation is enabled on the KMS key. To get
--     this information, use GetKeyRotationStatus. Also, some key states
--     prevent a KMS key from being automatically rotated. For details, see
--     <https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html#rotate-keys-how-it-works How Automatic Key Rotation Works>
--     in /Key Management Service Developer Guide/.
--
-- -   Tags on the KMS key. To get this information, use ListResourceTags.
--
-- -   Key policies and grants on the KMS key. To get this information, use
--     GetKeyPolicy and ListGrants.
--
-- If you call the @DescribeKey@ operation on a /predefined Amazon Web
-- Services alias/, that is, an Amazon Web Services alias with no key ID,
-- KMS creates an
-- <https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk Amazon Web Services managed key>.
-- Then, it associates the alias with the new KMS key, and returns the
-- @KeyId@ and @Arn@ of the new KMS key in the response.
--
-- __Cross-account use__: Yes. To perform this operation with a KMS key in
-- a different Amazon Web Services account, specify the key ARN or alias
-- ARN in the value of the @KeyId@ parameter.
--
-- __Required permissions__:
-- <https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html kms:DescribeKey>
-- (key policy)
--
-- __Related operations:__
--
-- -   GetKeyPolicy
--
-- -   GetKeyRotationStatus
--
-- -   ListAliases
--
-- -   ListGrants
--
-- -   ListKeys
--
-- -   ListResourceTags
--
-- -   ListRetirableGrants
module Amazonka.KMS.DescribeKey
  ( -- * Creating a Request
    DescribeKey (..),
    newDescribeKey,

    -- * Request Lenses
    describeKey_grantTokens,
    describeKey_keyId,

    -- * Destructuring the Response
    DescribeKeyResponse (..),
    newDescribeKeyResponse,

    -- * Response Lenses
    describeKeyResponse_keyMetadata,
    describeKeyResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.KMS.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeKey' smart constructor.
data DescribeKey = DescribeKey'
  { -- | A list of grant tokens.
    --
    -- Use a grant token when your permission to call this operation comes from
    -- a new grant that has not yet achieved /eventual consistency/. For more
    -- information, see
    -- <https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token Grant token>
    -- and
    -- <https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token Using a grant token>
    -- in the /Key Management Service Developer Guide/.
    DescribeKey -> Maybe [Text]
grantTokens :: Prelude.Maybe [Prelude.Text],
    -- | Describes the specified KMS key.
    --
    -- If you specify a predefined Amazon Web Services alias (an Amazon Web
    -- Services alias with no key ID), KMS associates the alias with an
    -- <https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html##aws-managed-cmk Amazon Web Services managed key>
    -- and returns its @KeyId@ and @Arn@ in the response.
    --
    -- To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN.
    -- When using an alias name, prefix it with @\"alias\/\"@. To specify a KMS
    -- key in a different Amazon Web Services account, you must use the key ARN
    -- or alias ARN.
    --
    -- For example:
    --
    -- -   Key ID: @1234abcd-12ab-34cd-56ef-1234567890ab@
    --
    -- -   Key ARN:
    --     @arn:aws:kms:us-east-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab@
    --
    -- -   Alias name: @alias\/ExampleAlias@
    --
    -- -   Alias ARN: @arn:aws:kms:us-east-2:111122223333:alias\/ExampleAlias@
    --
    -- To get the key ID and key ARN for a KMS key, use ListKeys or
    -- DescribeKey. To get the alias name and alias ARN, use ListAliases.
    DescribeKey -> Text
keyId :: Prelude.Text
  }
  deriving (DescribeKey -> DescribeKey -> Bool
(DescribeKey -> DescribeKey -> Bool)
-> (DescribeKey -> DescribeKey -> Bool) -> Eq DescribeKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeKey -> DescribeKey -> Bool
$c/= :: DescribeKey -> DescribeKey -> Bool
== :: DescribeKey -> DescribeKey -> Bool
$c== :: DescribeKey -> DescribeKey -> Bool
Prelude.Eq, ReadPrec [DescribeKey]
ReadPrec DescribeKey
Int -> ReadS DescribeKey
ReadS [DescribeKey]
(Int -> ReadS DescribeKey)
-> ReadS [DescribeKey]
-> ReadPrec DescribeKey
-> ReadPrec [DescribeKey]
-> Read DescribeKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeKey]
$creadListPrec :: ReadPrec [DescribeKey]
readPrec :: ReadPrec DescribeKey
$creadPrec :: ReadPrec DescribeKey
readList :: ReadS [DescribeKey]
$creadList :: ReadS [DescribeKey]
readsPrec :: Int -> ReadS DescribeKey
$creadsPrec :: Int -> ReadS DescribeKey
Prelude.Read, Int -> DescribeKey -> ShowS
[DescribeKey] -> ShowS
DescribeKey -> String
(Int -> DescribeKey -> ShowS)
-> (DescribeKey -> String)
-> ([DescribeKey] -> ShowS)
-> Show DescribeKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeKey] -> ShowS
$cshowList :: [DescribeKey] -> ShowS
show :: DescribeKey -> String
$cshow :: DescribeKey -> String
showsPrec :: Int -> DescribeKey -> ShowS
$cshowsPrec :: Int -> DescribeKey -> ShowS
Prelude.Show, (forall x. DescribeKey -> Rep DescribeKey x)
-> (forall x. Rep DescribeKey x -> DescribeKey)
-> Generic DescribeKey
forall x. Rep DescribeKey x -> DescribeKey
forall x. DescribeKey -> Rep DescribeKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeKey x -> DescribeKey
$cfrom :: forall x. DescribeKey -> Rep DescribeKey x
Prelude.Generic)

-- |
-- Create a value of 'DescribeKey' 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:
--
-- 'grantTokens', 'describeKey_grantTokens' - A list of grant tokens.
--
-- Use a grant token when your permission to call this operation comes from
-- a new grant that has not yet achieved /eventual consistency/. For more
-- information, see
-- <https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token Grant token>
-- and
-- <https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token Using a grant token>
-- in the /Key Management Service Developer Guide/.
--
-- 'keyId', 'describeKey_keyId' - Describes the specified KMS key.
--
-- If you specify a predefined Amazon Web Services alias (an Amazon Web
-- Services alias with no key ID), KMS associates the alias with an
-- <https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html##aws-managed-cmk Amazon Web Services managed key>
-- and returns its @KeyId@ and @Arn@ in the response.
--
-- To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN.
-- When using an alias name, prefix it with @\"alias\/\"@. To specify a KMS
-- key in a different Amazon Web Services account, you must use the key ARN
-- or alias ARN.
--
-- For example:
--
-- -   Key ID: @1234abcd-12ab-34cd-56ef-1234567890ab@
--
-- -   Key ARN:
--     @arn:aws:kms:us-east-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab@
--
-- -   Alias name: @alias\/ExampleAlias@
--
-- -   Alias ARN: @arn:aws:kms:us-east-2:111122223333:alias\/ExampleAlias@
--
-- To get the key ID and key ARN for a KMS key, use ListKeys or
-- DescribeKey. To get the alias name and alias ARN, use ListAliases.
newDescribeKey ::
  -- | 'keyId'
  Prelude.Text ->
  DescribeKey
newDescribeKey :: Text -> DescribeKey
newDescribeKey Text
pKeyId_ =
  DescribeKey' :: Maybe [Text] -> Text -> DescribeKey
DescribeKey'
    { $sel:grantTokens:DescribeKey' :: Maybe [Text]
grantTokens = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:keyId:DescribeKey' :: Text
keyId = Text
pKeyId_
    }

-- | A list of grant tokens.
--
-- Use a grant token when your permission to call this operation comes from
-- a new grant that has not yet achieved /eventual consistency/. For more
-- information, see
-- <https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token Grant token>
-- and
-- <https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token Using a grant token>
-- in the /Key Management Service Developer Guide/.
describeKey_grantTokens :: Lens.Lens' DescribeKey (Prelude.Maybe [Prelude.Text])
describeKey_grantTokens :: (Maybe [Text] -> f (Maybe [Text])) -> DescribeKey -> f DescribeKey
describeKey_grantTokens = (DescribeKey -> Maybe [Text])
-> (DescribeKey -> Maybe [Text] -> DescribeKey)
-> Lens DescribeKey DescribeKey (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeKey' {Maybe [Text]
grantTokens :: Maybe [Text]
$sel:grantTokens:DescribeKey' :: DescribeKey -> Maybe [Text]
grantTokens} -> Maybe [Text]
grantTokens) (\s :: DescribeKey
s@DescribeKey' {} Maybe [Text]
a -> DescribeKey
s {$sel:grantTokens:DescribeKey' :: Maybe [Text]
grantTokens = Maybe [Text]
a} :: DescribeKey) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeKey -> f DescribeKey)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeKey
-> f DescribeKey
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Describes the specified KMS key.
--
-- If you specify a predefined Amazon Web Services alias (an Amazon Web
-- Services alias with no key ID), KMS associates the alias with an
-- <https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html##aws-managed-cmk Amazon Web Services managed key>
-- and returns its @KeyId@ and @Arn@ in the response.
--
-- To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN.
-- When using an alias name, prefix it with @\"alias\/\"@. To specify a KMS
-- key in a different Amazon Web Services account, you must use the key ARN
-- or alias ARN.
--
-- For example:
--
-- -   Key ID: @1234abcd-12ab-34cd-56ef-1234567890ab@
--
-- -   Key ARN:
--     @arn:aws:kms:us-east-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab@
--
-- -   Alias name: @alias\/ExampleAlias@
--
-- -   Alias ARN: @arn:aws:kms:us-east-2:111122223333:alias\/ExampleAlias@
--
-- To get the key ID and key ARN for a KMS key, use ListKeys or
-- DescribeKey. To get the alias name and alias ARN, use ListAliases.
describeKey_keyId :: Lens.Lens' DescribeKey Prelude.Text
describeKey_keyId :: (Text -> f Text) -> DescribeKey -> f DescribeKey
describeKey_keyId = (DescribeKey -> Text)
-> (DescribeKey -> Text -> DescribeKey)
-> Lens DescribeKey DescribeKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeKey' {Text
keyId :: Text
$sel:keyId:DescribeKey' :: DescribeKey -> Text
keyId} -> Text
keyId) (\s :: DescribeKey
s@DescribeKey' {} Text
a -> DescribeKey
s {$sel:keyId:DescribeKey' :: Text
keyId = Text
a} :: DescribeKey)

instance Core.AWSRequest DescribeKey where
  type AWSResponse DescribeKey = DescribeKeyResponse
  request :: DescribeKey -> Request DescribeKey
request = Service -> DescribeKey -> Request DescribeKey
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeKey)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeKey))
-> Logger
-> Service
-> Proxy DescribeKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeKey)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe KeyMetadata -> Int -> DescribeKeyResponse
DescribeKeyResponse'
            (Maybe KeyMetadata -> Int -> DescribeKeyResponse)
-> Either String (Maybe KeyMetadata)
-> Either String (Int -> DescribeKeyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe KeyMetadata)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"KeyMetadata")
            Either String (Int -> DescribeKeyResponse)
-> Either String Int -> Either String DescribeKeyResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeKey

instance Prelude.NFData DescribeKey

instance Core.ToHeaders DescribeKey where
  toHeaders :: DescribeKey -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeKey -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"TrentService.DescribeKey" :: Prelude.ByteString),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DescribeKey where
  toJSON :: DescribeKey -> Value
toJSON DescribeKey' {Maybe [Text]
Text
keyId :: Text
grantTokens :: Maybe [Text]
$sel:keyId:DescribeKey' :: DescribeKey -> Text
$sel:grantTokens:DescribeKey' :: DescribeKey -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"GrantTokens" 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]
grantTokens,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"KeyId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
keyId)
          ]
      )

instance Core.ToPath DescribeKey where
  toPath :: DescribeKey -> ByteString
toPath = ByteString -> DescribeKey -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DescribeKey where
  toQuery :: DescribeKey -> QueryString
toQuery = QueryString -> DescribeKey -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDescribeKeyResponse' smart constructor.
data DescribeKeyResponse = DescribeKeyResponse'
  { -- | Metadata associated with the key.
    DescribeKeyResponse -> Maybe KeyMetadata
keyMetadata :: Prelude.Maybe KeyMetadata,
    -- | The response's http status code.
    DescribeKeyResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeKeyResponse -> DescribeKeyResponse -> Bool
(DescribeKeyResponse -> DescribeKeyResponse -> Bool)
-> (DescribeKeyResponse -> DescribeKeyResponse -> Bool)
-> Eq DescribeKeyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeKeyResponse -> DescribeKeyResponse -> Bool
$c/= :: DescribeKeyResponse -> DescribeKeyResponse -> Bool
== :: DescribeKeyResponse -> DescribeKeyResponse -> Bool
$c== :: DescribeKeyResponse -> DescribeKeyResponse -> Bool
Prelude.Eq, ReadPrec [DescribeKeyResponse]
ReadPrec DescribeKeyResponse
Int -> ReadS DescribeKeyResponse
ReadS [DescribeKeyResponse]
(Int -> ReadS DescribeKeyResponse)
-> ReadS [DescribeKeyResponse]
-> ReadPrec DescribeKeyResponse
-> ReadPrec [DescribeKeyResponse]
-> Read DescribeKeyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeKeyResponse]
$creadListPrec :: ReadPrec [DescribeKeyResponse]
readPrec :: ReadPrec DescribeKeyResponse
$creadPrec :: ReadPrec DescribeKeyResponse
readList :: ReadS [DescribeKeyResponse]
$creadList :: ReadS [DescribeKeyResponse]
readsPrec :: Int -> ReadS DescribeKeyResponse
$creadsPrec :: Int -> ReadS DescribeKeyResponse
Prelude.Read, Int -> DescribeKeyResponse -> ShowS
[DescribeKeyResponse] -> ShowS
DescribeKeyResponse -> String
(Int -> DescribeKeyResponse -> ShowS)
-> (DescribeKeyResponse -> String)
-> ([DescribeKeyResponse] -> ShowS)
-> Show DescribeKeyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeKeyResponse] -> ShowS
$cshowList :: [DescribeKeyResponse] -> ShowS
show :: DescribeKeyResponse -> String
$cshow :: DescribeKeyResponse -> String
showsPrec :: Int -> DescribeKeyResponse -> ShowS
$cshowsPrec :: Int -> DescribeKeyResponse -> ShowS
Prelude.Show, (forall x. DescribeKeyResponse -> Rep DescribeKeyResponse x)
-> (forall x. Rep DescribeKeyResponse x -> DescribeKeyResponse)
-> Generic DescribeKeyResponse
forall x. Rep DescribeKeyResponse x -> DescribeKeyResponse
forall x. DescribeKeyResponse -> Rep DescribeKeyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeKeyResponse x -> DescribeKeyResponse
$cfrom :: forall x. DescribeKeyResponse -> Rep DescribeKeyResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeKeyResponse' 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:
--
-- 'keyMetadata', 'describeKeyResponse_keyMetadata' - Metadata associated with the key.
--
-- 'httpStatus', 'describeKeyResponse_httpStatus' - The response's http status code.
newDescribeKeyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeKeyResponse
newDescribeKeyResponse :: Int -> DescribeKeyResponse
newDescribeKeyResponse Int
pHttpStatus_ =
  DescribeKeyResponse' :: Maybe KeyMetadata -> Int -> DescribeKeyResponse
DescribeKeyResponse'
    { $sel:keyMetadata:DescribeKeyResponse' :: Maybe KeyMetadata
keyMetadata = Maybe KeyMetadata
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeKeyResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Metadata associated with the key.
describeKeyResponse_keyMetadata :: Lens.Lens' DescribeKeyResponse (Prelude.Maybe KeyMetadata)
describeKeyResponse_keyMetadata :: (Maybe KeyMetadata -> f (Maybe KeyMetadata))
-> DescribeKeyResponse -> f DescribeKeyResponse
describeKeyResponse_keyMetadata = (DescribeKeyResponse -> Maybe KeyMetadata)
-> (DescribeKeyResponse
    -> Maybe KeyMetadata -> DescribeKeyResponse)
-> Lens
     DescribeKeyResponse
     DescribeKeyResponse
     (Maybe KeyMetadata)
     (Maybe KeyMetadata)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeKeyResponse' {Maybe KeyMetadata
keyMetadata :: Maybe KeyMetadata
$sel:keyMetadata:DescribeKeyResponse' :: DescribeKeyResponse -> Maybe KeyMetadata
keyMetadata} -> Maybe KeyMetadata
keyMetadata) (\s :: DescribeKeyResponse
s@DescribeKeyResponse' {} Maybe KeyMetadata
a -> DescribeKeyResponse
s {$sel:keyMetadata:DescribeKeyResponse' :: Maybe KeyMetadata
keyMetadata = Maybe KeyMetadata
a} :: DescribeKeyResponse)

-- | The response's http status code.
describeKeyResponse_httpStatus :: Lens.Lens' DescribeKeyResponse Prelude.Int
describeKeyResponse_httpStatus :: (Int -> f Int) -> DescribeKeyResponse -> f DescribeKeyResponse
describeKeyResponse_httpStatus = (DescribeKeyResponse -> Int)
-> (DescribeKeyResponse -> Int -> DescribeKeyResponse)
-> Lens DescribeKeyResponse DescribeKeyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeKeyResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeKeyResponse' :: DescribeKeyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeKeyResponse
s@DescribeKeyResponse' {} Int
a -> DescribeKeyResponse
s {$sel:httpStatus:DescribeKeyResponse' :: Int
httpStatus = Int
a} :: DescribeKeyResponse)

instance Prelude.NFData DescribeKeyResponse