{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.IAM.GetSSHPublicKey
(
GetSSHPublicKey (..),
newGetSSHPublicKey,
getSSHPublicKey_userName,
getSSHPublicKey_sSHPublicKeyId,
getSSHPublicKey_encoding,
GetSSHPublicKeyResponse (..),
newGetSSHPublicKeyResponse,
getSSHPublicKeyResponse_sSHPublicKey,
getSSHPublicKeyResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IAM.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetSSHPublicKey = GetSSHPublicKey'
{
GetSSHPublicKey -> Text
userName :: Prelude.Text,
GetSSHPublicKey -> Text
sSHPublicKeyId :: Prelude.Text,
GetSSHPublicKey -> EncodingType
encoding :: EncodingType
}
deriving (GetSSHPublicKey -> GetSSHPublicKey -> Bool
(GetSSHPublicKey -> GetSSHPublicKey -> Bool)
-> (GetSSHPublicKey -> GetSSHPublicKey -> Bool)
-> Eq GetSSHPublicKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSSHPublicKey -> GetSSHPublicKey -> Bool
$c/= :: GetSSHPublicKey -> GetSSHPublicKey -> Bool
== :: GetSSHPublicKey -> GetSSHPublicKey -> Bool
$c== :: GetSSHPublicKey -> GetSSHPublicKey -> Bool
Prelude.Eq, ReadPrec [GetSSHPublicKey]
ReadPrec GetSSHPublicKey
Int -> ReadS GetSSHPublicKey
ReadS [GetSSHPublicKey]
(Int -> ReadS GetSSHPublicKey)
-> ReadS [GetSSHPublicKey]
-> ReadPrec GetSSHPublicKey
-> ReadPrec [GetSSHPublicKey]
-> Read GetSSHPublicKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSSHPublicKey]
$creadListPrec :: ReadPrec [GetSSHPublicKey]
readPrec :: ReadPrec GetSSHPublicKey
$creadPrec :: ReadPrec GetSSHPublicKey
readList :: ReadS [GetSSHPublicKey]
$creadList :: ReadS [GetSSHPublicKey]
readsPrec :: Int -> ReadS GetSSHPublicKey
$creadsPrec :: Int -> ReadS GetSSHPublicKey
Prelude.Read, Int -> GetSSHPublicKey -> ShowS
[GetSSHPublicKey] -> ShowS
GetSSHPublicKey -> String
(Int -> GetSSHPublicKey -> ShowS)
-> (GetSSHPublicKey -> String)
-> ([GetSSHPublicKey] -> ShowS)
-> Show GetSSHPublicKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSSHPublicKey] -> ShowS
$cshowList :: [GetSSHPublicKey] -> ShowS
show :: GetSSHPublicKey -> String
$cshow :: GetSSHPublicKey -> String
showsPrec :: Int -> GetSSHPublicKey -> ShowS
$cshowsPrec :: Int -> GetSSHPublicKey -> ShowS
Prelude.Show, (forall x. GetSSHPublicKey -> Rep GetSSHPublicKey x)
-> (forall x. Rep GetSSHPublicKey x -> GetSSHPublicKey)
-> Generic GetSSHPublicKey
forall x. Rep GetSSHPublicKey x -> GetSSHPublicKey
forall x. GetSSHPublicKey -> Rep GetSSHPublicKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSSHPublicKey x -> GetSSHPublicKey
$cfrom :: forall x. GetSSHPublicKey -> Rep GetSSHPublicKey x
Prelude.Generic)
newGetSSHPublicKey ::
Prelude.Text ->
Prelude.Text ->
EncodingType ->
GetSSHPublicKey
newGetSSHPublicKey :: Text -> Text -> EncodingType -> GetSSHPublicKey
newGetSSHPublicKey
Text
pUserName_
Text
pSSHPublicKeyId_
EncodingType
pEncoding_ =
GetSSHPublicKey' :: Text -> Text -> EncodingType -> GetSSHPublicKey
GetSSHPublicKey'
{ $sel:userName:GetSSHPublicKey' :: Text
userName = Text
pUserName_,
$sel:sSHPublicKeyId:GetSSHPublicKey' :: Text
sSHPublicKeyId = Text
pSSHPublicKeyId_,
$sel:encoding:GetSSHPublicKey' :: EncodingType
encoding = EncodingType
pEncoding_
}
getSSHPublicKey_userName :: Lens.Lens' GetSSHPublicKey Prelude.Text
getSSHPublicKey_userName :: (Text -> f Text) -> GetSSHPublicKey -> f GetSSHPublicKey
getSSHPublicKey_userName = (GetSSHPublicKey -> Text)
-> (GetSSHPublicKey -> Text -> GetSSHPublicKey)
-> Lens GetSSHPublicKey GetSSHPublicKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSSHPublicKey' {Text
userName :: Text
$sel:userName:GetSSHPublicKey' :: GetSSHPublicKey -> Text
userName} -> Text
userName) (\s :: GetSSHPublicKey
s@GetSSHPublicKey' {} Text
a -> GetSSHPublicKey
s {$sel:userName:GetSSHPublicKey' :: Text
userName = Text
a} :: GetSSHPublicKey)
getSSHPublicKey_sSHPublicKeyId :: Lens.Lens' GetSSHPublicKey Prelude.Text
getSSHPublicKey_sSHPublicKeyId :: (Text -> f Text) -> GetSSHPublicKey -> f GetSSHPublicKey
getSSHPublicKey_sSHPublicKeyId = (GetSSHPublicKey -> Text)
-> (GetSSHPublicKey -> Text -> GetSSHPublicKey)
-> Lens GetSSHPublicKey GetSSHPublicKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSSHPublicKey' {Text
sSHPublicKeyId :: Text
$sel:sSHPublicKeyId:GetSSHPublicKey' :: GetSSHPublicKey -> Text
sSHPublicKeyId} -> Text
sSHPublicKeyId) (\s :: GetSSHPublicKey
s@GetSSHPublicKey' {} Text
a -> GetSSHPublicKey
s {$sel:sSHPublicKeyId:GetSSHPublicKey' :: Text
sSHPublicKeyId = Text
a} :: GetSSHPublicKey)
getSSHPublicKey_encoding :: Lens.Lens' GetSSHPublicKey EncodingType
getSSHPublicKey_encoding :: (EncodingType -> f EncodingType)
-> GetSSHPublicKey -> f GetSSHPublicKey
getSSHPublicKey_encoding = (GetSSHPublicKey -> EncodingType)
-> (GetSSHPublicKey -> EncodingType -> GetSSHPublicKey)
-> Lens GetSSHPublicKey GetSSHPublicKey EncodingType EncodingType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSSHPublicKey' {EncodingType
encoding :: EncodingType
$sel:encoding:GetSSHPublicKey' :: GetSSHPublicKey -> EncodingType
encoding} -> EncodingType
encoding) (\s :: GetSSHPublicKey
s@GetSSHPublicKey' {} EncodingType
a -> GetSSHPublicKey
s {$sel:encoding:GetSSHPublicKey' :: EncodingType
encoding = EncodingType
a} :: GetSSHPublicKey)
instance Core.AWSRequest GetSSHPublicKey where
type
AWSResponse GetSSHPublicKey =
GetSSHPublicKeyResponse
request :: GetSSHPublicKey -> Request GetSSHPublicKey
request = Service -> GetSSHPublicKey -> Request GetSSHPublicKey
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy GetSSHPublicKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetSSHPublicKey)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetSSHPublicKey))
-> Logger
-> Service
-> Proxy GetSSHPublicKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetSSHPublicKey)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"GetSSHPublicKeyResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe SSHPublicKey -> Int -> GetSSHPublicKeyResponse
GetSSHPublicKeyResponse'
(Maybe SSHPublicKey -> Int -> GetSSHPublicKeyResponse)
-> Either String (Maybe SSHPublicKey)
-> Either String (Int -> GetSSHPublicKeyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe SSHPublicKey)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SSHPublicKey")
Either String (Int -> GetSSHPublicKeyResponse)
-> Either String Int -> Either String GetSSHPublicKeyResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetSSHPublicKey
instance Prelude.NFData GetSSHPublicKey
instance Core.ToHeaders GetSSHPublicKey where
toHeaders :: GetSSHPublicKey -> ResponseHeaders
toHeaders = ResponseHeaders -> GetSSHPublicKey -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetSSHPublicKey where
toPath :: GetSSHPublicKey -> ByteString
toPath = ByteString -> GetSSHPublicKey -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetSSHPublicKey where
toQuery :: GetSSHPublicKey -> QueryString
toQuery GetSSHPublicKey' {Text
EncodingType
encoding :: EncodingType
sSHPublicKeyId :: Text
userName :: Text
$sel:encoding:GetSSHPublicKey' :: GetSSHPublicKey -> EncodingType
$sel:sSHPublicKeyId:GetSSHPublicKey' :: GetSSHPublicKey -> Text
$sel:userName:GetSSHPublicKey' :: GetSSHPublicKey -> Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"GetSSHPublicKey" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
ByteString
"UserName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
userName,
ByteString
"SSHPublicKeyId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
sSHPublicKeyId,
ByteString
"Encoding" ByteString -> EncodingType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: EncodingType
encoding
]
data GetSSHPublicKeyResponse = GetSSHPublicKeyResponse'
{
GetSSHPublicKeyResponse -> Maybe SSHPublicKey
sSHPublicKey :: Prelude.Maybe SSHPublicKey,
GetSSHPublicKeyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetSSHPublicKeyResponse -> GetSSHPublicKeyResponse -> Bool
(GetSSHPublicKeyResponse -> GetSSHPublicKeyResponse -> Bool)
-> (GetSSHPublicKeyResponse -> GetSSHPublicKeyResponse -> Bool)
-> Eq GetSSHPublicKeyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSSHPublicKeyResponse -> GetSSHPublicKeyResponse -> Bool
$c/= :: GetSSHPublicKeyResponse -> GetSSHPublicKeyResponse -> Bool
== :: GetSSHPublicKeyResponse -> GetSSHPublicKeyResponse -> Bool
$c== :: GetSSHPublicKeyResponse -> GetSSHPublicKeyResponse -> Bool
Prelude.Eq, ReadPrec [GetSSHPublicKeyResponse]
ReadPrec GetSSHPublicKeyResponse
Int -> ReadS GetSSHPublicKeyResponse
ReadS [GetSSHPublicKeyResponse]
(Int -> ReadS GetSSHPublicKeyResponse)
-> ReadS [GetSSHPublicKeyResponse]
-> ReadPrec GetSSHPublicKeyResponse
-> ReadPrec [GetSSHPublicKeyResponse]
-> Read GetSSHPublicKeyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSSHPublicKeyResponse]
$creadListPrec :: ReadPrec [GetSSHPublicKeyResponse]
readPrec :: ReadPrec GetSSHPublicKeyResponse
$creadPrec :: ReadPrec GetSSHPublicKeyResponse
readList :: ReadS [GetSSHPublicKeyResponse]
$creadList :: ReadS [GetSSHPublicKeyResponse]
readsPrec :: Int -> ReadS GetSSHPublicKeyResponse
$creadsPrec :: Int -> ReadS GetSSHPublicKeyResponse
Prelude.Read, Int -> GetSSHPublicKeyResponse -> ShowS
[GetSSHPublicKeyResponse] -> ShowS
GetSSHPublicKeyResponse -> String
(Int -> GetSSHPublicKeyResponse -> ShowS)
-> (GetSSHPublicKeyResponse -> String)
-> ([GetSSHPublicKeyResponse] -> ShowS)
-> Show GetSSHPublicKeyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSSHPublicKeyResponse] -> ShowS
$cshowList :: [GetSSHPublicKeyResponse] -> ShowS
show :: GetSSHPublicKeyResponse -> String
$cshow :: GetSSHPublicKeyResponse -> String
showsPrec :: Int -> GetSSHPublicKeyResponse -> ShowS
$cshowsPrec :: Int -> GetSSHPublicKeyResponse -> ShowS
Prelude.Show, (forall x.
GetSSHPublicKeyResponse -> Rep GetSSHPublicKeyResponse x)
-> (forall x.
Rep GetSSHPublicKeyResponse x -> GetSSHPublicKeyResponse)
-> Generic GetSSHPublicKeyResponse
forall x. Rep GetSSHPublicKeyResponse x -> GetSSHPublicKeyResponse
forall x. GetSSHPublicKeyResponse -> Rep GetSSHPublicKeyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSSHPublicKeyResponse x -> GetSSHPublicKeyResponse
$cfrom :: forall x. GetSSHPublicKeyResponse -> Rep GetSSHPublicKeyResponse x
Prelude.Generic)
newGetSSHPublicKeyResponse ::
Prelude.Int ->
GetSSHPublicKeyResponse
newGetSSHPublicKeyResponse :: Int -> GetSSHPublicKeyResponse
newGetSSHPublicKeyResponse Int
pHttpStatus_ =
GetSSHPublicKeyResponse' :: Maybe SSHPublicKey -> Int -> GetSSHPublicKeyResponse
GetSSHPublicKeyResponse'
{ $sel:sSHPublicKey:GetSSHPublicKeyResponse' :: Maybe SSHPublicKey
sSHPublicKey =
Maybe SSHPublicKey
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetSSHPublicKeyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getSSHPublicKeyResponse_sSHPublicKey :: Lens.Lens' GetSSHPublicKeyResponse (Prelude.Maybe SSHPublicKey)
getSSHPublicKeyResponse_sSHPublicKey :: (Maybe SSHPublicKey -> f (Maybe SSHPublicKey))
-> GetSSHPublicKeyResponse -> f GetSSHPublicKeyResponse
getSSHPublicKeyResponse_sSHPublicKey = (GetSSHPublicKeyResponse -> Maybe SSHPublicKey)
-> (GetSSHPublicKeyResponse
-> Maybe SSHPublicKey -> GetSSHPublicKeyResponse)
-> Lens
GetSSHPublicKeyResponse
GetSSHPublicKeyResponse
(Maybe SSHPublicKey)
(Maybe SSHPublicKey)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSSHPublicKeyResponse' {Maybe SSHPublicKey
sSHPublicKey :: Maybe SSHPublicKey
$sel:sSHPublicKey:GetSSHPublicKeyResponse' :: GetSSHPublicKeyResponse -> Maybe SSHPublicKey
sSHPublicKey} -> Maybe SSHPublicKey
sSHPublicKey) (\s :: GetSSHPublicKeyResponse
s@GetSSHPublicKeyResponse' {} Maybe SSHPublicKey
a -> GetSSHPublicKeyResponse
s {$sel:sSHPublicKey:GetSSHPublicKeyResponse' :: Maybe SSHPublicKey
sSHPublicKey = Maybe SSHPublicKey
a} :: GetSSHPublicKeyResponse)
getSSHPublicKeyResponse_httpStatus :: Lens.Lens' GetSSHPublicKeyResponse Prelude.Int
getSSHPublicKeyResponse_httpStatus :: (Int -> f Int)
-> GetSSHPublicKeyResponse -> f GetSSHPublicKeyResponse
getSSHPublicKeyResponse_httpStatus = (GetSSHPublicKeyResponse -> Int)
-> (GetSSHPublicKeyResponse -> Int -> GetSSHPublicKeyResponse)
-> Lens GetSSHPublicKeyResponse GetSSHPublicKeyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSSHPublicKeyResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetSSHPublicKeyResponse' :: GetSSHPublicKeyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetSSHPublicKeyResponse
s@GetSSHPublicKeyResponse' {} Int
a -> GetSSHPublicKeyResponse
s {$sel:httpStatus:GetSSHPublicKeyResponse' :: Int
httpStatus = Int
a} :: GetSSHPublicKeyResponse)
instance Prelude.NFData GetSSHPublicKeyResponse