{-# 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.UploadSSHPublicKey
(
UploadSSHPublicKey (..),
newUploadSSHPublicKey,
uploadSSHPublicKey_userName,
uploadSSHPublicKey_sSHPublicKeyBody,
UploadSSHPublicKeyResponse (..),
newUploadSSHPublicKeyResponse,
uploadSSHPublicKeyResponse_sSHPublicKey,
uploadSSHPublicKeyResponse_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 UploadSSHPublicKey = UploadSSHPublicKey'
{
UploadSSHPublicKey -> Text
userName :: Prelude.Text,
UploadSSHPublicKey -> Text
sSHPublicKeyBody :: Prelude.Text
}
deriving (UploadSSHPublicKey -> UploadSSHPublicKey -> Bool
(UploadSSHPublicKey -> UploadSSHPublicKey -> Bool)
-> (UploadSSHPublicKey -> UploadSSHPublicKey -> Bool)
-> Eq UploadSSHPublicKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UploadSSHPublicKey -> UploadSSHPublicKey -> Bool
$c/= :: UploadSSHPublicKey -> UploadSSHPublicKey -> Bool
== :: UploadSSHPublicKey -> UploadSSHPublicKey -> Bool
$c== :: UploadSSHPublicKey -> UploadSSHPublicKey -> Bool
Prelude.Eq, ReadPrec [UploadSSHPublicKey]
ReadPrec UploadSSHPublicKey
Int -> ReadS UploadSSHPublicKey
ReadS [UploadSSHPublicKey]
(Int -> ReadS UploadSSHPublicKey)
-> ReadS [UploadSSHPublicKey]
-> ReadPrec UploadSSHPublicKey
-> ReadPrec [UploadSSHPublicKey]
-> Read UploadSSHPublicKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UploadSSHPublicKey]
$creadListPrec :: ReadPrec [UploadSSHPublicKey]
readPrec :: ReadPrec UploadSSHPublicKey
$creadPrec :: ReadPrec UploadSSHPublicKey
readList :: ReadS [UploadSSHPublicKey]
$creadList :: ReadS [UploadSSHPublicKey]
readsPrec :: Int -> ReadS UploadSSHPublicKey
$creadsPrec :: Int -> ReadS UploadSSHPublicKey
Prelude.Read, Int -> UploadSSHPublicKey -> ShowS
[UploadSSHPublicKey] -> ShowS
UploadSSHPublicKey -> String
(Int -> UploadSSHPublicKey -> ShowS)
-> (UploadSSHPublicKey -> String)
-> ([UploadSSHPublicKey] -> ShowS)
-> Show UploadSSHPublicKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UploadSSHPublicKey] -> ShowS
$cshowList :: [UploadSSHPublicKey] -> ShowS
show :: UploadSSHPublicKey -> String
$cshow :: UploadSSHPublicKey -> String
showsPrec :: Int -> UploadSSHPublicKey -> ShowS
$cshowsPrec :: Int -> UploadSSHPublicKey -> ShowS
Prelude.Show, (forall x. UploadSSHPublicKey -> Rep UploadSSHPublicKey x)
-> (forall x. Rep UploadSSHPublicKey x -> UploadSSHPublicKey)
-> Generic UploadSSHPublicKey
forall x. Rep UploadSSHPublicKey x -> UploadSSHPublicKey
forall x. UploadSSHPublicKey -> Rep UploadSSHPublicKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UploadSSHPublicKey x -> UploadSSHPublicKey
$cfrom :: forall x. UploadSSHPublicKey -> Rep UploadSSHPublicKey x
Prelude.Generic)
newUploadSSHPublicKey ::
Prelude.Text ->
Prelude.Text ->
UploadSSHPublicKey
newUploadSSHPublicKey :: Text -> Text -> UploadSSHPublicKey
newUploadSSHPublicKey Text
pUserName_ Text
pSSHPublicKeyBody_ =
UploadSSHPublicKey' :: Text -> Text -> UploadSSHPublicKey
UploadSSHPublicKey'
{ $sel:userName:UploadSSHPublicKey' :: Text
userName = Text
pUserName_,
$sel:sSHPublicKeyBody:UploadSSHPublicKey' :: Text
sSHPublicKeyBody = Text
pSSHPublicKeyBody_
}
uploadSSHPublicKey_userName :: Lens.Lens' UploadSSHPublicKey Prelude.Text
uploadSSHPublicKey_userName :: (Text -> f Text) -> UploadSSHPublicKey -> f UploadSSHPublicKey
uploadSSHPublicKey_userName = (UploadSSHPublicKey -> Text)
-> (UploadSSHPublicKey -> Text -> UploadSSHPublicKey)
-> Lens UploadSSHPublicKey UploadSSHPublicKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadSSHPublicKey' {Text
userName :: Text
$sel:userName:UploadSSHPublicKey' :: UploadSSHPublicKey -> Text
userName} -> Text
userName) (\s :: UploadSSHPublicKey
s@UploadSSHPublicKey' {} Text
a -> UploadSSHPublicKey
s {$sel:userName:UploadSSHPublicKey' :: Text
userName = Text
a} :: UploadSSHPublicKey)
uploadSSHPublicKey_sSHPublicKeyBody :: Lens.Lens' UploadSSHPublicKey Prelude.Text
uploadSSHPublicKey_sSHPublicKeyBody :: (Text -> f Text) -> UploadSSHPublicKey -> f UploadSSHPublicKey
uploadSSHPublicKey_sSHPublicKeyBody = (UploadSSHPublicKey -> Text)
-> (UploadSSHPublicKey -> Text -> UploadSSHPublicKey)
-> Lens UploadSSHPublicKey UploadSSHPublicKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadSSHPublicKey' {Text
sSHPublicKeyBody :: Text
$sel:sSHPublicKeyBody:UploadSSHPublicKey' :: UploadSSHPublicKey -> Text
sSHPublicKeyBody} -> Text
sSHPublicKeyBody) (\s :: UploadSSHPublicKey
s@UploadSSHPublicKey' {} Text
a -> UploadSSHPublicKey
s {$sel:sSHPublicKeyBody:UploadSSHPublicKey' :: Text
sSHPublicKeyBody = Text
a} :: UploadSSHPublicKey)
instance Core.AWSRequest UploadSSHPublicKey where
type
AWSResponse UploadSSHPublicKey =
UploadSSHPublicKeyResponse
request :: UploadSSHPublicKey -> Request UploadSSHPublicKey
request = Service -> UploadSSHPublicKey -> Request UploadSSHPublicKey
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy UploadSSHPublicKey
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UploadSSHPublicKey)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse UploadSSHPublicKey))
-> Logger
-> Service
-> Proxy UploadSSHPublicKey
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UploadSSHPublicKey)))
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
"UploadSSHPublicKeyResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe SSHPublicKey -> Int -> UploadSSHPublicKeyResponse
UploadSSHPublicKeyResponse'
(Maybe SSHPublicKey -> Int -> UploadSSHPublicKeyResponse)
-> Either String (Maybe SSHPublicKey)
-> Either String (Int -> UploadSSHPublicKeyResponse)
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 -> UploadSSHPublicKeyResponse)
-> Either String Int -> Either String UploadSSHPublicKeyResponse
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 UploadSSHPublicKey
instance Prelude.NFData UploadSSHPublicKey
instance Core.ToHeaders UploadSSHPublicKey where
toHeaders :: UploadSSHPublicKey -> ResponseHeaders
toHeaders = ResponseHeaders -> UploadSSHPublicKey -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath UploadSSHPublicKey where
toPath :: UploadSSHPublicKey -> ByteString
toPath = ByteString -> UploadSSHPublicKey -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UploadSSHPublicKey where
toQuery :: UploadSSHPublicKey -> QueryString
toQuery UploadSSHPublicKey' {Text
sSHPublicKeyBody :: Text
userName :: Text
$sel:sSHPublicKeyBody:UploadSSHPublicKey' :: UploadSSHPublicKey -> Text
$sel:userName:UploadSSHPublicKey' :: UploadSSHPublicKey -> 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
"UploadSSHPublicKey" :: 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
"SSHPublicKeyBody" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
sSHPublicKeyBody
]
data UploadSSHPublicKeyResponse = UploadSSHPublicKeyResponse'
{
UploadSSHPublicKeyResponse -> Maybe SSHPublicKey
sSHPublicKey :: Prelude.Maybe SSHPublicKey,
UploadSSHPublicKeyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UploadSSHPublicKeyResponse -> UploadSSHPublicKeyResponse -> Bool
(UploadSSHPublicKeyResponse -> UploadSSHPublicKeyResponse -> Bool)
-> (UploadSSHPublicKeyResponse
-> UploadSSHPublicKeyResponse -> Bool)
-> Eq UploadSSHPublicKeyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UploadSSHPublicKeyResponse -> UploadSSHPublicKeyResponse -> Bool
$c/= :: UploadSSHPublicKeyResponse -> UploadSSHPublicKeyResponse -> Bool
== :: UploadSSHPublicKeyResponse -> UploadSSHPublicKeyResponse -> Bool
$c== :: UploadSSHPublicKeyResponse -> UploadSSHPublicKeyResponse -> Bool
Prelude.Eq, ReadPrec [UploadSSHPublicKeyResponse]
ReadPrec UploadSSHPublicKeyResponse
Int -> ReadS UploadSSHPublicKeyResponse
ReadS [UploadSSHPublicKeyResponse]
(Int -> ReadS UploadSSHPublicKeyResponse)
-> ReadS [UploadSSHPublicKeyResponse]
-> ReadPrec UploadSSHPublicKeyResponse
-> ReadPrec [UploadSSHPublicKeyResponse]
-> Read UploadSSHPublicKeyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UploadSSHPublicKeyResponse]
$creadListPrec :: ReadPrec [UploadSSHPublicKeyResponse]
readPrec :: ReadPrec UploadSSHPublicKeyResponse
$creadPrec :: ReadPrec UploadSSHPublicKeyResponse
readList :: ReadS [UploadSSHPublicKeyResponse]
$creadList :: ReadS [UploadSSHPublicKeyResponse]
readsPrec :: Int -> ReadS UploadSSHPublicKeyResponse
$creadsPrec :: Int -> ReadS UploadSSHPublicKeyResponse
Prelude.Read, Int -> UploadSSHPublicKeyResponse -> ShowS
[UploadSSHPublicKeyResponse] -> ShowS
UploadSSHPublicKeyResponse -> String
(Int -> UploadSSHPublicKeyResponse -> ShowS)
-> (UploadSSHPublicKeyResponse -> String)
-> ([UploadSSHPublicKeyResponse] -> ShowS)
-> Show UploadSSHPublicKeyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UploadSSHPublicKeyResponse] -> ShowS
$cshowList :: [UploadSSHPublicKeyResponse] -> ShowS
show :: UploadSSHPublicKeyResponse -> String
$cshow :: UploadSSHPublicKeyResponse -> String
showsPrec :: Int -> UploadSSHPublicKeyResponse -> ShowS
$cshowsPrec :: Int -> UploadSSHPublicKeyResponse -> ShowS
Prelude.Show, (forall x.
UploadSSHPublicKeyResponse -> Rep UploadSSHPublicKeyResponse x)
-> (forall x.
Rep UploadSSHPublicKeyResponse x -> UploadSSHPublicKeyResponse)
-> Generic UploadSSHPublicKeyResponse
forall x.
Rep UploadSSHPublicKeyResponse x -> UploadSSHPublicKeyResponse
forall x.
UploadSSHPublicKeyResponse -> Rep UploadSSHPublicKeyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UploadSSHPublicKeyResponse x -> UploadSSHPublicKeyResponse
$cfrom :: forall x.
UploadSSHPublicKeyResponse -> Rep UploadSSHPublicKeyResponse x
Prelude.Generic)
newUploadSSHPublicKeyResponse ::
Prelude.Int ->
UploadSSHPublicKeyResponse
newUploadSSHPublicKeyResponse :: Int -> UploadSSHPublicKeyResponse
newUploadSSHPublicKeyResponse Int
pHttpStatus_ =
UploadSSHPublicKeyResponse' :: Maybe SSHPublicKey -> Int -> UploadSSHPublicKeyResponse
UploadSSHPublicKeyResponse'
{ $sel:sSHPublicKey:UploadSSHPublicKeyResponse' :: Maybe SSHPublicKey
sSHPublicKey =
Maybe SSHPublicKey
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UploadSSHPublicKeyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
uploadSSHPublicKeyResponse_sSHPublicKey :: Lens.Lens' UploadSSHPublicKeyResponse (Prelude.Maybe SSHPublicKey)
uploadSSHPublicKeyResponse_sSHPublicKey :: (Maybe SSHPublicKey -> f (Maybe SSHPublicKey))
-> UploadSSHPublicKeyResponse -> f UploadSSHPublicKeyResponse
uploadSSHPublicKeyResponse_sSHPublicKey = (UploadSSHPublicKeyResponse -> Maybe SSHPublicKey)
-> (UploadSSHPublicKeyResponse
-> Maybe SSHPublicKey -> UploadSSHPublicKeyResponse)
-> Lens
UploadSSHPublicKeyResponse
UploadSSHPublicKeyResponse
(Maybe SSHPublicKey)
(Maybe SSHPublicKey)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadSSHPublicKeyResponse' {Maybe SSHPublicKey
sSHPublicKey :: Maybe SSHPublicKey
$sel:sSHPublicKey:UploadSSHPublicKeyResponse' :: UploadSSHPublicKeyResponse -> Maybe SSHPublicKey
sSHPublicKey} -> Maybe SSHPublicKey
sSHPublicKey) (\s :: UploadSSHPublicKeyResponse
s@UploadSSHPublicKeyResponse' {} Maybe SSHPublicKey
a -> UploadSSHPublicKeyResponse
s {$sel:sSHPublicKey:UploadSSHPublicKeyResponse' :: Maybe SSHPublicKey
sSHPublicKey = Maybe SSHPublicKey
a} :: UploadSSHPublicKeyResponse)
uploadSSHPublicKeyResponse_httpStatus :: Lens.Lens' UploadSSHPublicKeyResponse Prelude.Int
uploadSSHPublicKeyResponse_httpStatus :: (Int -> f Int)
-> UploadSSHPublicKeyResponse -> f UploadSSHPublicKeyResponse
uploadSSHPublicKeyResponse_httpStatus = (UploadSSHPublicKeyResponse -> Int)
-> (UploadSSHPublicKeyResponse
-> Int -> UploadSSHPublicKeyResponse)
-> Lens
UploadSSHPublicKeyResponse UploadSSHPublicKeyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadSSHPublicKeyResponse' {Int
httpStatus :: Int
$sel:httpStatus:UploadSSHPublicKeyResponse' :: UploadSSHPublicKeyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UploadSSHPublicKeyResponse
s@UploadSSHPublicKeyResponse' {} Int
a -> UploadSSHPublicKeyResponse
s {$sel:httpStatus:UploadSSHPublicKeyResponse' :: Int
httpStatus = Int
a} :: UploadSSHPublicKeyResponse)
instance Prelude.NFData UploadSSHPublicKeyResponse