{-# 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.Translate.Types.EncryptionKey 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
import Amazonka.Translate.Types.EncryptionKeyType
data EncryptionKey = EncryptionKey'
{
EncryptionKey -> EncryptionKeyType
type' :: EncryptionKeyType,
EncryptionKey -> Text
id :: Prelude.Text
}
deriving (EncryptionKey -> EncryptionKey -> Bool
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]
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
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. 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 ::
EncryptionKeyType ->
Prelude.Text ->
EncryptionKey
newEncryptionKey :: EncryptionKeyType -> Text -> EncryptionKey
newEncryptionKey EncryptionKeyType
pType_ Text
pId_ =
EncryptionKey' {$sel:type':EncryptionKey' :: EncryptionKeyType
type' = EncryptionKeyType
pType_, $sel:id:EncryptionKey' :: Text
id = Text
pId_}
encryptionKey_type :: Lens.Lens' EncryptionKey EncryptionKeyType
encryptionKey_type :: Lens' EncryptionKey EncryptionKeyType
encryptionKey_type = 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)
encryptionKey_id :: Lens.Lens' EncryptionKey Prelude.Text
encryptionKey_id :: Lens' EncryptionKey Text
encryptionKey_id = 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)
instance Data.FromJSON EncryptionKey where
parseJSON :: Value -> Parser EncryptionKey
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"EncryptionKey"
( \Object
x ->
EncryptionKeyType -> Text -> EncryptionKey
EncryptionKey'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Type")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Id")
)
instance Prelude.Hashable EncryptionKey where
hashWithSalt :: Int -> EncryptionKey -> Int
hashWithSalt Int
_salt EncryptionKey' {Text
EncryptionKeyType
id :: Text
type' :: EncryptionKeyType
$sel:id:EncryptionKey' :: EncryptionKey -> Text
$sel:type':EncryptionKey' :: EncryptionKey -> EncryptionKeyType
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` EncryptionKeyType
type'
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
instance Prelude.NFData EncryptionKey where
rnf :: EncryptionKey -> ()
rnf EncryptionKey' {Text
EncryptionKeyType
id :: Text
type' :: EncryptionKeyType
$sel:id:EncryptionKey' :: EncryptionKey -> Text
$sel:type':EncryptionKey' :: EncryptionKey -> EncryptionKeyType
..} =
forall a. NFData a => a -> ()
Prelude.rnf EncryptionKeyType
type' seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
instance Data.ToJSON EncryptionKey where
toJSON :: EncryptionKey -> Value
toJSON EncryptionKey' {Text
EncryptionKeyType
id :: Text
type' :: EncryptionKeyType
$sel:id:EncryptionKey' :: EncryptionKey -> Text
$sel:type':EncryptionKey' :: EncryptionKey -> EncryptionKeyType
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= EncryptionKeyType
type'),
forall a. a -> Maybe a
Prelude.Just (Key
"Id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
id)
]
)