{-# 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.SecurityHub.Types.AwsKmsKeyDetails
-- 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.SecurityHub.Types.AwsKmsKeyDetails where

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

-- | Contains metadata about an KMS key.
--
-- /See:/ 'newAwsKmsKeyDetails' smart constructor.
data AwsKmsKeyDetails = AwsKmsKeyDetails'
  { -- | The source of the KMS key material.
    --
    -- When this value is @AWS_KMS@, KMS created the key material.
    --
    -- When this value is @EXTERNAL@, the key material was imported from your
    -- existing key management infrastructure or the KMS key lacks key
    -- material.
    --
    -- When this value is @AWS_CLOUDHSM@, the key material was created in the
    -- CloudHSM cluster associated with a custom key store.
    AwsKmsKeyDetails -> Maybe Text
origin :: Prelude.Maybe Prelude.Text,
    -- | The manager of the KMS key. KMS keys in your Amazon Web Services account
    -- are either customer managed or Amazon Web Services managed.
    AwsKmsKeyDetails -> Maybe Text
keyManager :: Prelude.Maybe Prelude.Text,
    -- | The globally unique identifier for the KMS key.
    AwsKmsKeyDetails -> Maybe Text
keyId :: Prelude.Maybe Prelude.Text,
    -- | The state of the KMS key.
    AwsKmsKeyDetails -> Maybe Text
keyState :: Prelude.Maybe Prelude.Text,
    -- | The twelve-digit account ID of the Amazon Web Services account that owns
    -- the KMS key.
    AwsKmsKeyDetails -> Maybe Text
aWSAccountId :: Prelude.Maybe Prelude.Text,
    -- | Whether the key has key rotation enabled.
    AwsKmsKeyDetails -> Maybe Bool
keyRotationStatus :: Prelude.Maybe Prelude.Bool,
    -- | Indicates when the KMS key was created.
    --
    -- Uses the @date-time@ format specified in
    -- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
    -- The value cannot contain spaces. For example,
    -- @2020-03-22T13:22:13.933Z@.
    AwsKmsKeyDetails -> Maybe Double
creationDate :: Prelude.Maybe Prelude.Double,
    -- | A description of the key.
    AwsKmsKeyDetails -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsKmsKeyDetails -> AwsKmsKeyDetails -> Bool
(AwsKmsKeyDetails -> AwsKmsKeyDetails -> Bool)
-> (AwsKmsKeyDetails -> AwsKmsKeyDetails -> Bool)
-> Eq AwsKmsKeyDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsKmsKeyDetails -> AwsKmsKeyDetails -> Bool
$c/= :: AwsKmsKeyDetails -> AwsKmsKeyDetails -> Bool
== :: AwsKmsKeyDetails -> AwsKmsKeyDetails -> Bool
$c== :: AwsKmsKeyDetails -> AwsKmsKeyDetails -> Bool
Prelude.Eq, ReadPrec [AwsKmsKeyDetails]
ReadPrec AwsKmsKeyDetails
Int -> ReadS AwsKmsKeyDetails
ReadS [AwsKmsKeyDetails]
(Int -> ReadS AwsKmsKeyDetails)
-> ReadS [AwsKmsKeyDetails]
-> ReadPrec AwsKmsKeyDetails
-> ReadPrec [AwsKmsKeyDetails]
-> Read AwsKmsKeyDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsKmsKeyDetails]
$creadListPrec :: ReadPrec [AwsKmsKeyDetails]
readPrec :: ReadPrec AwsKmsKeyDetails
$creadPrec :: ReadPrec AwsKmsKeyDetails
readList :: ReadS [AwsKmsKeyDetails]
$creadList :: ReadS [AwsKmsKeyDetails]
readsPrec :: Int -> ReadS AwsKmsKeyDetails
$creadsPrec :: Int -> ReadS AwsKmsKeyDetails
Prelude.Read, Int -> AwsKmsKeyDetails -> ShowS
[AwsKmsKeyDetails] -> ShowS
AwsKmsKeyDetails -> String
(Int -> AwsKmsKeyDetails -> ShowS)
-> (AwsKmsKeyDetails -> String)
-> ([AwsKmsKeyDetails] -> ShowS)
-> Show AwsKmsKeyDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsKmsKeyDetails] -> ShowS
$cshowList :: [AwsKmsKeyDetails] -> ShowS
show :: AwsKmsKeyDetails -> String
$cshow :: AwsKmsKeyDetails -> String
showsPrec :: Int -> AwsKmsKeyDetails -> ShowS
$cshowsPrec :: Int -> AwsKmsKeyDetails -> ShowS
Prelude.Show, (forall x. AwsKmsKeyDetails -> Rep AwsKmsKeyDetails x)
-> (forall x. Rep AwsKmsKeyDetails x -> AwsKmsKeyDetails)
-> Generic AwsKmsKeyDetails
forall x. Rep AwsKmsKeyDetails x -> AwsKmsKeyDetails
forall x. AwsKmsKeyDetails -> Rep AwsKmsKeyDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AwsKmsKeyDetails x -> AwsKmsKeyDetails
$cfrom :: forall x. AwsKmsKeyDetails -> Rep AwsKmsKeyDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsKmsKeyDetails' 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:
--
-- 'origin', 'awsKmsKeyDetails_origin' - The source of the KMS key material.
--
-- When this value is @AWS_KMS@, KMS created the key material.
--
-- When this value is @EXTERNAL@, the key material was imported from your
-- existing key management infrastructure or the KMS key lacks key
-- material.
--
-- When this value is @AWS_CLOUDHSM@, the key material was created in the
-- CloudHSM cluster associated with a custom key store.
--
-- 'keyManager', 'awsKmsKeyDetails_keyManager' - The manager of the KMS key. KMS keys in your Amazon Web Services account
-- are either customer managed or Amazon Web Services managed.
--
-- 'keyId', 'awsKmsKeyDetails_keyId' - The globally unique identifier for the KMS key.
--
-- 'keyState', 'awsKmsKeyDetails_keyState' - The state of the KMS key.
--
-- 'aWSAccountId', 'awsKmsKeyDetails_aWSAccountId' - The twelve-digit account ID of the Amazon Web Services account that owns
-- the KMS key.
--
-- 'keyRotationStatus', 'awsKmsKeyDetails_keyRotationStatus' - Whether the key has key rotation enabled.
--
-- 'creationDate', 'awsKmsKeyDetails_creationDate' - Indicates when the KMS key was created.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
--
-- 'description', 'awsKmsKeyDetails_description' - A description of the key.
newAwsKmsKeyDetails ::
  AwsKmsKeyDetails
newAwsKmsKeyDetails :: AwsKmsKeyDetails
newAwsKmsKeyDetails =
  AwsKmsKeyDetails' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Double
-> Maybe Text
-> AwsKmsKeyDetails
AwsKmsKeyDetails'
    { $sel:origin:AwsKmsKeyDetails' :: Maybe Text
origin = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:keyManager:AwsKmsKeyDetails' :: Maybe Text
keyManager = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:keyId:AwsKmsKeyDetails' :: Maybe Text
keyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:keyState:AwsKmsKeyDetails' :: Maybe Text
keyState = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:aWSAccountId:AwsKmsKeyDetails' :: Maybe Text
aWSAccountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:keyRotationStatus:AwsKmsKeyDetails' :: Maybe Bool
keyRotationStatus = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:AwsKmsKeyDetails' :: Maybe Double
creationDate = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:description:AwsKmsKeyDetails' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The source of the KMS key material.
--
-- When this value is @AWS_KMS@, KMS created the key material.
--
-- When this value is @EXTERNAL@, the key material was imported from your
-- existing key management infrastructure or the KMS key lacks key
-- material.
--
-- When this value is @AWS_CLOUDHSM@, the key material was created in the
-- CloudHSM cluster associated with a custom key store.
awsKmsKeyDetails_origin :: Lens.Lens' AwsKmsKeyDetails (Prelude.Maybe Prelude.Text)
awsKmsKeyDetails_origin :: (Maybe Text -> f (Maybe Text))
-> AwsKmsKeyDetails -> f AwsKmsKeyDetails
awsKmsKeyDetails_origin = (AwsKmsKeyDetails -> Maybe Text)
-> (AwsKmsKeyDetails -> Maybe Text -> AwsKmsKeyDetails)
-> Lens AwsKmsKeyDetails AwsKmsKeyDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsKmsKeyDetails' {Maybe Text
origin :: Maybe Text
$sel:origin:AwsKmsKeyDetails' :: AwsKmsKeyDetails -> Maybe Text
origin} -> Maybe Text
origin) (\s :: AwsKmsKeyDetails
s@AwsKmsKeyDetails' {} Maybe Text
a -> AwsKmsKeyDetails
s {$sel:origin:AwsKmsKeyDetails' :: Maybe Text
origin = Maybe Text
a} :: AwsKmsKeyDetails)

-- | The manager of the KMS key. KMS keys in your Amazon Web Services account
-- are either customer managed or Amazon Web Services managed.
awsKmsKeyDetails_keyManager :: Lens.Lens' AwsKmsKeyDetails (Prelude.Maybe Prelude.Text)
awsKmsKeyDetails_keyManager :: (Maybe Text -> f (Maybe Text))
-> AwsKmsKeyDetails -> f AwsKmsKeyDetails
awsKmsKeyDetails_keyManager = (AwsKmsKeyDetails -> Maybe Text)
-> (AwsKmsKeyDetails -> Maybe Text -> AwsKmsKeyDetails)
-> Lens AwsKmsKeyDetails AwsKmsKeyDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsKmsKeyDetails' {Maybe Text
keyManager :: Maybe Text
$sel:keyManager:AwsKmsKeyDetails' :: AwsKmsKeyDetails -> Maybe Text
keyManager} -> Maybe Text
keyManager) (\s :: AwsKmsKeyDetails
s@AwsKmsKeyDetails' {} Maybe Text
a -> AwsKmsKeyDetails
s {$sel:keyManager:AwsKmsKeyDetails' :: Maybe Text
keyManager = Maybe Text
a} :: AwsKmsKeyDetails)

-- | The globally unique identifier for the KMS key.
awsKmsKeyDetails_keyId :: Lens.Lens' AwsKmsKeyDetails (Prelude.Maybe Prelude.Text)
awsKmsKeyDetails_keyId :: (Maybe Text -> f (Maybe Text))
-> AwsKmsKeyDetails -> f AwsKmsKeyDetails
awsKmsKeyDetails_keyId = (AwsKmsKeyDetails -> Maybe Text)
-> (AwsKmsKeyDetails -> Maybe Text -> AwsKmsKeyDetails)
-> Lens AwsKmsKeyDetails AwsKmsKeyDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsKmsKeyDetails' {Maybe Text
keyId :: Maybe Text
$sel:keyId:AwsKmsKeyDetails' :: AwsKmsKeyDetails -> Maybe Text
keyId} -> Maybe Text
keyId) (\s :: AwsKmsKeyDetails
s@AwsKmsKeyDetails' {} Maybe Text
a -> AwsKmsKeyDetails
s {$sel:keyId:AwsKmsKeyDetails' :: Maybe Text
keyId = Maybe Text
a} :: AwsKmsKeyDetails)

-- | The state of the KMS key.
awsKmsKeyDetails_keyState :: Lens.Lens' AwsKmsKeyDetails (Prelude.Maybe Prelude.Text)
awsKmsKeyDetails_keyState :: (Maybe Text -> f (Maybe Text))
-> AwsKmsKeyDetails -> f AwsKmsKeyDetails
awsKmsKeyDetails_keyState = (AwsKmsKeyDetails -> Maybe Text)
-> (AwsKmsKeyDetails -> Maybe Text -> AwsKmsKeyDetails)
-> Lens AwsKmsKeyDetails AwsKmsKeyDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsKmsKeyDetails' {Maybe Text
keyState :: Maybe Text
$sel:keyState:AwsKmsKeyDetails' :: AwsKmsKeyDetails -> Maybe Text
keyState} -> Maybe Text
keyState) (\s :: AwsKmsKeyDetails
s@AwsKmsKeyDetails' {} Maybe Text
a -> AwsKmsKeyDetails
s {$sel:keyState:AwsKmsKeyDetails' :: Maybe Text
keyState = Maybe Text
a} :: AwsKmsKeyDetails)

-- | The twelve-digit account ID of the Amazon Web Services account that owns
-- the KMS key.
awsKmsKeyDetails_aWSAccountId :: Lens.Lens' AwsKmsKeyDetails (Prelude.Maybe Prelude.Text)
awsKmsKeyDetails_aWSAccountId :: (Maybe Text -> f (Maybe Text))
-> AwsKmsKeyDetails -> f AwsKmsKeyDetails
awsKmsKeyDetails_aWSAccountId = (AwsKmsKeyDetails -> Maybe Text)
-> (AwsKmsKeyDetails -> Maybe Text -> AwsKmsKeyDetails)
-> Lens AwsKmsKeyDetails AwsKmsKeyDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsKmsKeyDetails' {Maybe Text
aWSAccountId :: Maybe Text
$sel:aWSAccountId:AwsKmsKeyDetails' :: AwsKmsKeyDetails -> Maybe Text
aWSAccountId} -> Maybe Text
aWSAccountId) (\s :: AwsKmsKeyDetails
s@AwsKmsKeyDetails' {} Maybe Text
a -> AwsKmsKeyDetails
s {$sel:aWSAccountId:AwsKmsKeyDetails' :: Maybe Text
aWSAccountId = Maybe Text
a} :: AwsKmsKeyDetails)

-- | Whether the key has key rotation enabled.
awsKmsKeyDetails_keyRotationStatus :: Lens.Lens' AwsKmsKeyDetails (Prelude.Maybe Prelude.Bool)
awsKmsKeyDetails_keyRotationStatus :: (Maybe Bool -> f (Maybe Bool))
-> AwsKmsKeyDetails -> f AwsKmsKeyDetails
awsKmsKeyDetails_keyRotationStatus = (AwsKmsKeyDetails -> Maybe Bool)
-> (AwsKmsKeyDetails -> Maybe Bool -> AwsKmsKeyDetails)
-> Lens AwsKmsKeyDetails AwsKmsKeyDetails (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsKmsKeyDetails' {Maybe Bool
keyRotationStatus :: Maybe Bool
$sel:keyRotationStatus:AwsKmsKeyDetails' :: AwsKmsKeyDetails -> Maybe Bool
keyRotationStatus} -> Maybe Bool
keyRotationStatus) (\s :: AwsKmsKeyDetails
s@AwsKmsKeyDetails' {} Maybe Bool
a -> AwsKmsKeyDetails
s {$sel:keyRotationStatus:AwsKmsKeyDetails' :: Maybe Bool
keyRotationStatus = Maybe Bool
a} :: AwsKmsKeyDetails)

-- | Indicates when the KMS key was created.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
awsKmsKeyDetails_creationDate :: Lens.Lens' AwsKmsKeyDetails (Prelude.Maybe Prelude.Double)
awsKmsKeyDetails_creationDate :: (Maybe Double -> f (Maybe Double))
-> AwsKmsKeyDetails -> f AwsKmsKeyDetails
awsKmsKeyDetails_creationDate = (AwsKmsKeyDetails -> Maybe Double)
-> (AwsKmsKeyDetails -> Maybe Double -> AwsKmsKeyDetails)
-> Lens
     AwsKmsKeyDetails AwsKmsKeyDetails (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsKmsKeyDetails' {Maybe Double
creationDate :: Maybe Double
$sel:creationDate:AwsKmsKeyDetails' :: AwsKmsKeyDetails -> Maybe Double
creationDate} -> Maybe Double
creationDate) (\s :: AwsKmsKeyDetails
s@AwsKmsKeyDetails' {} Maybe Double
a -> AwsKmsKeyDetails
s {$sel:creationDate:AwsKmsKeyDetails' :: Maybe Double
creationDate = Maybe Double
a} :: AwsKmsKeyDetails)

-- | A description of the key.
awsKmsKeyDetails_description :: Lens.Lens' AwsKmsKeyDetails (Prelude.Maybe Prelude.Text)
awsKmsKeyDetails_description :: (Maybe Text -> f (Maybe Text))
-> AwsKmsKeyDetails -> f AwsKmsKeyDetails
awsKmsKeyDetails_description = (AwsKmsKeyDetails -> Maybe Text)
-> (AwsKmsKeyDetails -> Maybe Text -> AwsKmsKeyDetails)
-> Lens AwsKmsKeyDetails AwsKmsKeyDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsKmsKeyDetails' {Maybe Text
description :: Maybe Text
$sel:description:AwsKmsKeyDetails' :: AwsKmsKeyDetails -> Maybe Text
description} -> Maybe Text
description) (\s :: AwsKmsKeyDetails
s@AwsKmsKeyDetails' {} Maybe Text
a -> AwsKmsKeyDetails
s {$sel:description:AwsKmsKeyDetails' :: Maybe Text
description = Maybe Text
a} :: AwsKmsKeyDetails)

instance Core.FromJSON AwsKmsKeyDetails where
  parseJSON :: Value -> Parser AwsKmsKeyDetails
parseJSON =
    String
-> (Object -> Parser AwsKmsKeyDetails)
-> Value
-> Parser AwsKmsKeyDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsKmsKeyDetails"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Double
-> Maybe Text
-> AwsKmsKeyDetails
AwsKmsKeyDetails'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Double
 -> Maybe Text
 -> AwsKmsKeyDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Double
      -> Maybe Text
      -> AwsKmsKeyDetails)
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
"Origin")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Double
   -> Maybe Text
   -> AwsKmsKeyDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Double
      -> Maybe Text
      -> AwsKmsKeyDetails)
forall (f :: * -> *) a b. Applicative f => 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
"KeyManager")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Double
   -> Maybe Text
   -> AwsKmsKeyDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Double
      -> Maybe Text
      -> AwsKmsKeyDetails)
forall (f :: * -> *) a b. Applicative f => 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
"KeyId")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Double
   -> Maybe Text
   -> AwsKmsKeyDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Bool -> Maybe Double -> Maybe Text -> AwsKmsKeyDetails)
forall (f :: * -> *) a b. Applicative f => 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
"KeyState")
            Parser
  (Maybe Text
   -> Maybe Bool -> Maybe Double -> Maybe Text -> AwsKmsKeyDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool -> Maybe Double -> Maybe Text -> AwsKmsKeyDetails)
forall (f :: * -> *) a b. Applicative f => 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
"AWSAccountId")
            Parser
  (Maybe Bool -> Maybe Double -> Maybe Text -> AwsKmsKeyDetails)
-> Parser (Maybe Bool)
-> Parser (Maybe Double -> Maybe Text -> AwsKmsKeyDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"KeyRotationStatus")
            Parser (Maybe Double -> Maybe Text -> AwsKmsKeyDetails)
-> Parser (Maybe Double) -> Parser (Maybe Text -> AwsKmsKeyDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreationDate")
            Parser (Maybe Text -> AwsKmsKeyDetails)
-> Parser (Maybe Text) -> Parser AwsKmsKeyDetails
forall (f :: * -> *) a b. Applicative f => 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
"Description")
      )

instance Prelude.Hashable AwsKmsKeyDetails

instance Prelude.NFData AwsKmsKeyDetails

instance Core.ToJSON AwsKmsKeyDetails where
  toJSON :: AwsKmsKeyDetails -> Value
toJSON AwsKmsKeyDetails' {Maybe Bool
Maybe Double
Maybe Text
description :: Maybe Text
creationDate :: Maybe Double
keyRotationStatus :: Maybe Bool
aWSAccountId :: Maybe Text
keyState :: Maybe Text
keyId :: Maybe Text
keyManager :: Maybe Text
origin :: Maybe Text
$sel:description:AwsKmsKeyDetails' :: AwsKmsKeyDetails -> Maybe Text
$sel:creationDate:AwsKmsKeyDetails' :: AwsKmsKeyDetails -> Maybe Double
$sel:keyRotationStatus:AwsKmsKeyDetails' :: AwsKmsKeyDetails -> Maybe Bool
$sel:aWSAccountId:AwsKmsKeyDetails' :: AwsKmsKeyDetails -> Maybe Text
$sel:keyState:AwsKmsKeyDetails' :: AwsKmsKeyDetails -> Maybe Text
$sel:keyId:AwsKmsKeyDetails' :: AwsKmsKeyDetails -> Maybe Text
$sel:keyManager:AwsKmsKeyDetails' :: AwsKmsKeyDetails -> Maybe Text
$sel:origin:AwsKmsKeyDetails' :: AwsKmsKeyDetails -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Origin" 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
origin,
            (Text
"KeyManager" 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
keyManager,
            (Text
"KeyId" 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
keyId,
            (Text
"KeyState" 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
keyState,
            (Text
"AWSAccountId" 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
aWSAccountId,
            (Text
"KeyRotationStatus" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
keyRotationStatus,
            (Text
"CreationDate" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
creationDate,
            (Text
"Description" 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
description
          ]
      )