{-# 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.IoT.Types.KeyPair where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data KeyPair = KeyPair'
{
KeyPair -> Maybe (Sensitive Text)
privateKey :: Prelude.Maybe (Core.Sensitive Prelude.Text),
KeyPair -> Maybe Text
publicKey :: Prelude.Maybe Prelude.Text
}
deriving (KeyPair -> KeyPair -> Bool
(KeyPair -> KeyPair -> Bool)
-> (KeyPair -> KeyPair -> Bool) -> Eq KeyPair
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KeyPair -> KeyPair -> Bool
$c/= :: KeyPair -> KeyPair -> Bool
== :: KeyPair -> KeyPair -> Bool
$c== :: KeyPair -> KeyPair -> Bool
Prelude.Eq, Int -> KeyPair -> ShowS
[KeyPair] -> ShowS
KeyPair -> String
(Int -> KeyPair -> ShowS)
-> (KeyPair -> String) -> ([KeyPair] -> ShowS) -> Show KeyPair
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KeyPair] -> ShowS
$cshowList :: [KeyPair] -> ShowS
show :: KeyPair -> String
$cshow :: KeyPair -> String
showsPrec :: Int -> KeyPair -> ShowS
$cshowsPrec :: Int -> KeyPair -> ShowS
Prelude.Show, (forall x. KeyPair -> Rep KeyPair x)
-> (forall x. Rep KeyPair x -> KeyPair) -> Generic KeyPair
forall x. Rep KeyPair x -> KeyPair
forall x. KeyPair -> Rep KeyPair x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep KeyPair x -> KeyPair
$cfrom :: forall x. KeyPair -> Rep KeyPair x
Prelude.Generic)
newKeyPair ::
KeyPair
newKeyPair :: KeyPair
newKeyPair =
KeyPair' :: Maybe (Sensitive Text) -> Maybe Text -> KeyPair
KeyPair'
{ $sel:privateKey:KeyPair' :: Maybe (Sensitive Text)
privateKey = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:publicKey:KeyPair' :: Maybe Text
publicKey = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
keyPair_privateKey :: Lens.Lens' KeyPair (Prelude.Maybe Prelude.Text)
keyPair_privateKey :: (Maybe Text -> f (Maybe Text)) -> KeyPair -> f KeyPair
keyPair_privateKey = (KeyPair -> Maybe (Sensitive Text))
-> (KeyPair -> Maybe (Sensitive Text) -> KeyPair)
-> Lens
KeyPair KeyPair (Maybe (Sensitive Text)) (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyPair' {Maybe (Sensitive Text)
privateKey :: Maybe (Sensitive Text)
$sel:privateKey:KeyPair' :: KeyPair -> Maybe (Sensitive Text)
privateKey} -> Maybe (Sensitive Text)
privateKey) (\s :: KeyPair
s@KeyPair' {} Maybe (Sensitive Text)
a -> KeyPair
s {$sel:privateKey:KeyPair' :: Maybe (Sensitive Text)
privateKey = Maybe (Sensitive Text)
a} :: KeyPair) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> KeyPair -> f KeyPair)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> KeyPair
-> f KeyPair
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
keyPair_publicKey :: Lens.Lens' KeyPair (Prelude.Maybe Prelude.Text)
keyPair_publicKey :: (Maybe Text -> f (Maybe Text)) -> KeyPair -> f KeyPair
keyPair_publicKey = (KeyPair -> Maybe Text)
-> (KeyPair -> Maybe Text -> KeyPair)
-> Lens KeyPair KeyPair (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyPair' {Maybe Text
publicKey :: Maybe Text
$sel:publicKey:KeyPair' :: KeyPair -> Maybe Text
publicKey} -> Maybe Text
publicKey) (\s :: KeyPair
s@KeyPair' {} Maybe Text
a -> KeyPair
s {$sel:publicKey:KeyPair' :: Maybe Text
publicKey = Maybe Text
a} :: KeyPair)
instance Core.FromJSON KeyPair where
parseJSON :: Value -> Parser KeyPair
parseJSON =
String -> (Object -> Parser KeyPair) -> Value -> Parser KeyPair
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"KeyPair"
( \Object
x ->
Maybe (Sensitive Text) -> Maybe Text -> KeyPair
KeyPair'
(Maybe (Sensitive Text) -> Maybe Text -> KeyPair)
-> Parser (Maybe (Sensitive Text))
-> Parser (Maybe Text -> KeyPair)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PrivateKey")
Parser (Maybe Text -> KeyPair)
-> Parser (Maybe Text) -> Parser KeyPair
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
"PublicKey")
)
instance Prelude.Hashable KeyPair
instance Prelude.NFData KeyPair