{-# 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.CodePipeline.Types.EncryptionKey where
import Amazonka.CodePipeline.Types.EncryptionKeyType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data EncryptionKey = EncryptionKey'
{
EncryptionKey -> Text
id :: Prelude.Text,
EncryptionKey -> EncryptionKeyType
type' :: EncryptionKeyType
}
deriving (EncryptionKey -> EncryptionKey -> Bool
(EncryptionKey -> EncryptionKey -> Bool)
-> (EncryptionKey -> EncryptionKey -> Bool) -> Eq EncryptionKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EncryptionKey -> EncryptionKey -> Bool
$c/= :: EncryptionKey -> EncryptionKey -> Bool
== :: EncryptionKey -> EncryptionKey -> Bool
$c== :: EncryptionKey -> EncryptionKey -> Bool
Prelude.Eq, ReadPrec [EncryptionKey]
ReadPrec EncryptionKey
Int -> ReadS EncryptionKey
ReadS [EncryptionKey]
(Int -> ReadS EncryptionKey)
-> ReadS [EncryptionKey]
-> ReadPrec EncryptionKey
-> ReadPrec [EncryptionKey]
-> Read EncryptionKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EncryptionKey]
$creadListPrec :: ReadPrec [EncryptionKey]
readPrec :: ReadPrec EncryptionKey
$creadPrec :: ReadPrec EncryptionKey
readList :: ReadS [EncryptionKey]
$creadList :: ReadS [EncryptionKey]
readsPrec :: Int -> ReadS EncryptionKey
$creadsPrec :: Int -> ReadS EncryptionKey
Prelude.Read, Int -> EncryptionKey -> ShowS
[EncryptionKey] -> ShowS
EncryptionKey -> String
(Int -> EncryptionKey -> ShowS)
-> (EncryptionKey -> String)
-> ([EncryptionKey] -> ShowS)
-> Show EncryptionKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EncryptionKey] -> ShowS
$cshowList :: [EncryptionKey] -> ShowS
show :: EncryptionKey -> String
$cshow :: EncryptionKey -> String
showsPrec :: Int -> EncryptionKey -> ShowS
$cshowsPrec :: Int -> EncryptionKey -> ShowS
Prelude.Show, (forall x. EncryptionKey -> Rep EncryptionKey x)
-> (forall x. Rep EncryptionKey x -> EncryptionKey)
-> Generic EncryptionKey
forall x. Rep EncryptionKey x -> EncryptionKey
forall x. EncryptionKey -> Rep EncryptionKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EncryptionKey x -> EncryptionKey
$cfrom :: forall x. EncryptionKey -> Rep EncryptionKey x
Prelude.Generic)
newEncryptionKey ::
Prelude.Text ->
EncryptionKeyType ->
EncryptionKey
newEncryptionKey :: Text -> EncryptionKeyType -> EncryptionKey
newEncryptionKey Text
pId_ EncryptionKeyType
pType_ =
EncryptionKey' :: Text -> EncryptionKeyType -> EncryptionKey
EncryptionKey' {$sel:id:EncryptionKey' :: Text
id = Text
pId_, $sel:type':EncryptionKey' :: EncryptionKeyType
type' = EncryptionKeyType
pType_}
encryptionKey_id :: Lens.Lens' EncryptionKey Prelude.Text
encryptionKey_id :: (Text -> f Text) -> EncryptionKey -> f EncryptionKey
encryptionKey_id = (EncryptionKey -> Text)
-> (EncryptionKey -> Text -> EncryptionKey)
-> Lens EncryptionKey EncryptionKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EncryptionKey' {Text
id :: Text
$sel:id:EncryptionKey' :: EncryptionKey -> Text
id} -> Text
id) (\s :: EncryptionKey
s@EncryptionKey' {} Text
a -> EncryptionKey
s {$sel:id:EncryptionKey' :: Text
id = Text
a} :: EncryptionKey)
encryptionKey_type :: Lens.Lens' EncryptionKey EncryptionKeyType
encryptionKey_type :: (EncryptionKeyType -> f EncryptionKeyType)
-> EncryptionKey -> f EncryptionKey
encryptionKey_type = (EncryptionKey -> EncryptionKeyType)
-> (EncryptionKey -> EncryptionKeyType -> EncryptionKey)
-> Lens
EncryptionKey EncryptionKey EncryptionKeyType EncryptionKeyType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EncryptionKey' {EncryptionKeyType
type' :: EncryptionKeyType
$sel:type':EncryptionKey' :: EncryptionKey -> EncryptionKeyType
type'} -> EncryptionKeyType
type') (\s :: EncryptionKey
s@EncryptionKey' {} EncryptionKeyType
a -> EncryptionKey
s {$sel:type':EncryptionKey' :: EncryptionKeyType
type' = EncryptionKeyType
a} :: EncryptionKey)
instance Core.FromJSON EncryptionKey where
parseJSON :: Value -> Parser EncryptionKey
parseJSON =
String
-> (Object -> Parser EncryptionKey)
-> Value
-> Parser EncryptionKey
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"EncryptionKey"
( \Object
x ->
Text -> EncryptionKeyType -> EncryptionKey
EncryptionKey'
(Text -> EncryptionKeyType -> EncryptionKey)
-> Parser Text -> Parser (EncryptionKeyType -> EncryptionKey)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"id") Parser (EncryptionKeyType -> EncryptionKey)
-> Parser EncryptionKeyType -> Parser EncryptionKey
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser EncryptionKeyType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"type")
)
instance Prelude.Hashable EncryptionKey
instance Prelude.NFData EncryptionKey
instance Core.ToJSON EncryptionKey where
toJSON :: EncryptionKey -> Value
toJSON EncryptionKey' {Text
EncryptionKeyType
type' :: EncryptionKeyType
id :: Text
$sel:type':EncryptionKey' :: EncryptionKey -> EncryptionKeyType
$sel:id:EncryptionKey' :: EncryptionKey -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"type" Text -> EncryptionKeyType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= EncryptionKeyType
type')
]
)