{-# 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 #-}
module Amazonka.CodeGuruReviewer.Types.KMSKeyDetails where
import Amazonka.CodeGuruReviewer.Types.EncryptionOption
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data KMSKeyDetails = KMSKeyDetails'
{
KMSKeyDetails -> Maybe EncryptionOption
encryptionOption :: Prelude.Maybe EncryptionOption,
KMSKeyDetails -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text
}
deriving (KMSKeyDetails -> KMSKeyDetails -> Bool
(KMSKeyDetails -> KMSKeyDetails -> Bool)
-> (KMSKeyDetails -> KMSKeyDetails -> Bool) -> Eq KMSKeyDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KMSKeyDetails -> KMSKeyDetails -> Bool
$c/= :: KMSKeyDetails -> KMSKeyDetails -> Bool
== :: KMSKeyDetails -> KMSKeyDetails -> Bool
$c== :: KMSKeyDetails -> KMSKeyDetails -> Bool
Prelude.Eq, ReadPrec [KMSKeyDetails]
ReadPrec KMSKeyDetails
Int -> ReadS KMSKeyDetails
ReadS [KMSKeyDetails]
(Int -> ReadS KMSKeyDetails)
-> ReadS [KMSKeyDetails]
-> ReadPrec KMSKeyDetails
-> ReadPrec [KMSKeyDetails]
-> Read KMSKeyDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KMSKeyDetails]
$creadListPrec :: ReadPrec [KMSKeyDetails]
readPrec :: ReadPrec KMSKeyDetails
$creadPrec :: ReadPrec KMSKeyDetails
readList :: ReadS [KMSKeyDetails]
$creadList :: ReadS [KMSKeyDetails]
readsPrec :: Int -> ReadS KMSKeyDetails
$creadsPrec :: Int -> ReadS KMSKeyDetails
Prelude.Read, Int -> KMSKeyDetails -> ShowS
[KMSKeyDetails] -> ShowS
KMSKeyDetails -> String
(Int -> KMSKeyDetails -> ShowS)
-> (KMSKeyDetails -> String)
-> ([KMSKeyDetails] -> ShowS)
-> Show KMSKeyDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KMSKeyDetails] -> ShowS
$cshowList :: [KMSKeyDetails] -> ShowS
show :: KMSKeyDetails -> String
$cshow :: KMSKeyDetails -> String
showsPrec :: Int -> KMSKeyDetails -> ShowS
$cshowsPrec :: Int -> KMSKeyDetails -> ShowS
Prelude.Show, (forall x. KMSKeyDetails -> Rep KMSKeyDetails x)
-> (forall x. Rep KMSKeyDetails x -> KMSKeyDetails)
-> Generic KMSKeyDetails
forall x. Rep KMSKeyDetails x -> KMSKeyDetails
forall x. KMSKeyDetails -> Rep KMSKeyDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep KMSKeyDetails x -> KMSKeyDetails
$cfrom :: forall x. KMSKeyDetails -> Rep KMSKeyDetails x
Prelude.Generic)
newKMSKeyDetails ::
KMSKeyDetails
newKMSKeyDetails :: KMSKeyDetails
newKMSKeyDetails =
KMSKeyDetails' :: Maybe EncryptionOption -> Maybe Text -> KMSKeyDetails
KMSKeyDetails'
{ $sel:encryptionOption:KMSKeyDetails' :: Maybe EncryptionOption
encryptionOption = Maybe EncryptionOption
forall a. Maybe a
Prelude.Nothing,
$sel:kmsKeyId:KMSKeyDetails' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
kmsKeyDetails_encryptionOption :: Lens.Lens' KMSKeyDetails (Prelude.Maybe EncryptionOption)
kmsKeyDetails_encryptionOption :: (Maybe EncryptionOption -> f (Maybe EncryptionOption))
-> KMSKeyDetails -> f KMSKeyDetails
kmsKeyDetails_encryptionOption = (KMSKeyDetails -> Maybe EncryptionOption)
-> (KMSKeyDetails -> Maybe EncryptionOption -> KMSKeyDetails)
-> Lens
KMSKeyDetails
KMSKeyDetails
(Maybe EncryptionOption)
(Maybe EncryptionOption)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KMSKeyDetails' {Maybe EncryptionOption
encryptionOption :: Maybe EncryptionOption
$sel:encryptionOption:KMSKeyDetails' :: KMSKeyDetails -> Maybe EncryptionOption
encryptionOption} -> Maybe EncryptionOption
encryptionOption) (\s :: KMSKeyDetails
s@KMSKeyDetails' {} Maybe EncryptionOption
a -> KMSKeyDetails
s {$sel:encryptionOption:KMSKeyDetails' :: Maybe EncryptionOption
encryptionOption = Maybe EncryptionOption
a} :: KMSKeyDetails)
kmsKeyDetails_kmsKeyId :: Lens.Lens' KMSKeyDetails (Prelude.Maybe Prelude.Text)
kmsKeyDetails_kmsKeyId :: (Maybe Text -> f (Maybe Text)) -> KMSKeyDetails -> f KMSKeyDetails
kmsKeyDetails_kmsKeyId = (KMSKeyDetails -> Maybe Text)
-> (KMSKeyDetails -> Maybe Text -> KMSKeyDetails)
-> Lens KMSKeyDetails KMSKeyDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KMSKeyDetails' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:KMSKeyDetails' :: KMSKeyDetails -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: KMSKeyDetails
s@KMSKeyDetails' {} Maybe Text
a -> KMSKeyDetails
s {$sel:kmsKeyId:KMSKeyDetails' :: Maybe Text
kmsKeyId = Maybe Text
a} :: KMSKeyDetails)
instance Core.FromJSON KMSKeyDetails where
parseJSON :: Value -> Parser KMSKeyDetails
parseJSON =
String
-> (Object -> Parser KMSKeyDetails)
-> Value
-> Parser KMSKeyDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"KMSKeyDetails"
( \Object
x ->
Maybe EncryptionOption -> Maybe Text -> KMSKeyDetails
KMSKeyDetails'
(Maybe EncryptionOption -> Maybe Text -> KMSKeyDetails)
-> Parser (Maybe EncryptionOption)
-> Parser (Maybe Text -> KMSKeyDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe EncryptionOption)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EncryptionOption")
Parser (Maybe Text -> KMSKeyDetails)
-> Parser (Maybe Text) -> Parser KMSKeyDetails
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
"KMSKeyId")
)
instance Prelude.Hashable KMSKeyDetails
instance Prelude.NFData KMSKeyDetails
instance Core.ToJSON KMSKeyDetails where
toJSON :: KMSKeyDetails -> Value
toJSON KMSKeyDetails' {Maybe Text
Maybe EncryptionOption
kmsKeyId :: Maybe Text
encryptionOption :: Maybe EncryptionOption
$sel:kmsKeyId:KMSKeyDetails' :: KMSKeyDetails -> Maybe Text
$sel:encryptionOption:KMSKeyDetails' :: KMSKeyDetails -> Maybe EncryptionOption
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"EncryptionOption" Text -> EncryptionOption -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(EncryptionOption -> Pair) -> Maybe EncryptionOption -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EncryptionOption
encryptionOption,
(Text
"KMSKeyId" 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
kmsKeyId
]
)