{-# 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.Transfer.ImportSshPublicKey
(
ImportSshPublicKey (..),
newImportSshPublicKey,
importSshPublicKey_serverId,
importSshPublicKey_sshPublicKeyBody,
importSshPublicKey_userName,
ImportSshPublicKeyResponse (..),
newImportSshPublicKeyResponse,
importSshPublicKeyResponse_httpStatus,
importSshPublicKeyResponse_serverId,
importSshPublicKeyResponse_sshPublicKeyId,
importSshPublicKeyResponse_userName,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Transfer.Types
data ImportSshPublicKey = ImportSshPublicKey'
{
ImportSshPublicKey -> Text
serverId :: Prelude.Text,
ImportSshPublicKey -> Text
sshPublicKeyBody :: Prelude.Text,
ImportSshPublicKey -> Text
userName :: Prelude.Text
}
deriving (ImportSshPublicKey -> ImportSshPublicKey -> Bool
(ImportSshPublicKey -> ImportSshPublicKey -> Bool)
-> (ImportSshPublicKey -> ImportSshPublicKey -> Bool)
-> Eq ImportSshPublicKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportSshPublicKey -> ImportSshPublicKey -> Bool
$c/= :: ImportSshPublicKey -> ImportSshPublicKey -> Bool
== :: ImportSshPublicKey -> ImportSshPublicKey -> Bool
$c== :: ImportSshPublicKey -> ImportSshPublicKey -> Bool
Prelude.Eq, ReadPrec [ImportSshPublicKey]
ReadPrec ImportSshPublicKey
Int -> ReadS ImportSshPublicKey
ReadS [ImportSshPublicKey]
(Int -> ReadS ImportSshPublicKey)
-> ReadS [ImportSshPublicKey]
-> ReadPrec ImportSshPublicKey
-> ReadPrec [ImportSshPublicKey]
-> Read ImportSshPublicKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportSshPublicKey]
$creadListPrec :: ReadPrec [ImportSshPublicKey]
readPrec :: ReadPrec ImportSshPublicKey
$creadPrec :: ReadPrec ImportSshPublicKey
readList :: ReadS [ImportSshPublicKey]
$creadList :: ReadS [ImportSshPublicKey]
readsPrec :: Int -> ReadS ImportSshPublicKey
$creadsPrec :: Int -> ReadS ImportSshPublicKey
Prelude.Read, Int -> ImportSshPublicKey -> ShowS
[ImportSshPublicKey] -> ShowS
ImportSshPublicKey -> String
(Int -> ImportSshPublicKey -> ShowS)
-> (ImportSshPublicKey -> String)
-> ([ImportSshPublicKey] -> ShowS)
-> Show ImportSshPublicKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportSshPublicKey] -> ShowS
$cshowList :: [ImportSshPublicKey] -> ShowS
show :: ImportSshPublicKey -> String
$cshow :: ImportSshPublicKey -> String
showsPrec :: Int -> ImportSshPublicKey -> ShowS
$cshowsPrec :: Int -> ImportSshPublicKey -> ShowS
Prelude.Show, (forall x. ImportSshPublicKey -> Rep ImportSshPublicKey x)
-> (forall x. Rep ImportSshPublicKey x -> ImportSshPublicKey)
-> Generic ImportSshPublicKey
forall x. Rep ImportSshPublicKey x -> ImportSshPublicKey
forall x. ImportSshPublicKey -> Rep ImportSshPublicKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImportSshPublicKey x -> ImportSshPublicKey
$cfrom :: forall x. ImportSshPublicKey -> Rep ImportSshPublicKey x
Prelude.Generic)
newImportSshPublicKey ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
ImportSshPublicKey
newImportSshPublicKey :: Text -> Text -> Text -> ImportSshPublicKey
newImportSshPublicKey
Text
pServerId_
Text
pSshPublicKeyBody_
Text
pUserName_ =
ImportSshPublicKey' :: Text -> Text -> Text -> ImportSshPublicKey
ImportSshPublicKey'
{ $sel:serverId:ImportSshPublicKey' :: Text
serverId = Text
pServerId_,
$sel:sshPublicKeyBody:ImportSshPublicKey' :: Text
sshPublicKeyBody = Text
pSshPublicKeyBody_,
$sel:userName:ImportSshPublicKey' :: Text
userName = Text
pUserName_
}
importSshPublicKey_serverId :: Lens.Lens' ImportSshPublicKey Prelude.Text
importSshPublicKey_serverId :: (Text -> f Text) -> ImportSshPublicKey -> f ImportSshPublicKey
importSshPublicKey_serverId = (ImportSshPublicKey -> Text)
-> (ImportSshPublicKey -> Text -> ImportSshPublicKey)
-> Lens ImportSshPublicKey ImportSshPublicKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportSshPublicKey' {Text
serverId :: Text
$sel:serverId:ImportSshPublicKey' :: ImportSshPublicKey -> Text
serverId} -> Text
serverId) (\s :: ImportSshPublicKey
s@ImportSshPublicKey' {} Text
a -> ImportSshPublicKey
s {$sel:serverId:ImportSshPublicKey' :: Text
serverId = Text
a} :: ImportSshPublicKey)
importSshPublicKey_sshPublicKeyBody :: Lens.Lens' ImportSshPublicKey Prelude.Text
importSshPublicKey_sshPublicKeyBody :: (Text -> f Text) -> ImportSshPublicKey -> f ImportSshPublicKey
importSshPublicKey_sshPublicKeyBody = (ImportSshPublicKey -> Text)
-> (ImportSshPublicKey -> Text -> ImportSshPublicKey)
-> Lens ImportSshPublicKey ImportSshPublicKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportSshPublicKey' {Text
sshPublicKeyBody :: Text
$sel:sshPublicKeyBody:ImportSshPublicKey' :: ImportSshPublicKey -> Text
sshPublicKeyBody} -> Text
sshPublicKeyBody) (\s :: ImportSshPublicKey
s@ImportSshPublicKey' {} Text
a -> ImportSshPublicKey
s {$sel:sshPublicKeyBody:ImportSshPublicKey' :: Text
sshPublicKeyBody = Text
a} :: ImportSshPublicKey)
importSshPublicKey_userName :: Lens.Lens' ImportSshPublicKey Prelude.Text
importSshPublicKey_userName :: (Text -> f Text) -> ImportSshPublicKey -> f ImportSshPublicKey
importSshPublicKey_userName = (ImportSshPublicKey -> Text)
-> (ImportSshPublicKey -> Text -> ImportSshPublicKey)
-> Lens ImportSshPublicKey ImportSshPublicKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportSshPublicKey' {Text
userName :: Text
$sel:userName:ImportSshPublicKey' :: ImportSshPublicKey -> Text
userName} -> Text
userName) (\s :: ImportSshPublicKey
s@ImportSshPublicKey' {} Text
a -> ImportSshPublicKey
s {$sel:userName:ImportSshPublicKey' :: Text
userName = Text
a} :: ImportSshPublicKey)
instance Core.AWSRequest ImportSshPublicKey where
type
AWSResponse ImportSshPublicKey =
ImportSshPublicKeyResponse
request :: ImportSshPublicKey -> Request ImportSshPublicKey
request = Service -> ImportSshPublicKey -> Request ImportSshPublicKey
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ImportSshPublicKey
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ImportSshPublicKey)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ImportSshPublicKey))
-> Logger
-> Service
-> Proxy ImportSshPublicKey
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ImportSshPublicKey)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> Text -> Text -> Text -> ImportSshPublicKeyResponse
ImportSshPublicKeyResponse'
(Int -> Text -> Text -> Text -> ImportSshPublicKeyResponse)
-> Either String Int
-> Either
String (Text -> Text -> Text -> ImportSshPublicKeyResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (Text -> Text -> Text -> ImportSshPublicKeyResponse)
-> Either String Text
-> Either String (Text -> Text -> ImportSshPublicKeyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"ServerId")
Either String (Text -> Text -> ImportSshPublicKeyResponse)
-> Either String Text
-> Either String (Text -> ImportSshPublicKeyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"SshPublicKeyId")
Either String (Text -> ImportSshPublicKeyResponse)
-> Either String Text -> Either String ImportSshPublicKeyResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"UserName")
)
instance Prelude.Hashable ImportSshPublicKey
instance Prelude.NFData ImportSshPublicKey
instance Core.ToHeaders ImportSshPublicKey where
toHeaders :: ImportSshPublicKey -> ResponseHeaders
toHeaders =
ResponseHeaders -> ImportSshPublicKey -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"TransferService.ImportSshPublicKey" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON ImportSshPublicKey where
toJSON :: ImportSshPublicKey -> Value
toJSON ImportSshPublicKey' {Text
userName :: Text
sshPublicKeyBody :: Text
serverId :: Text
$sel:userName:ImportSshPublicKey' :: ImportSshPublicKey -> Text
$sel:sshPublicKeyBody:ImportSshPublicKey' :: ImportSshPublicKey -> Text
$sel:serverId:ImportSshPublicKey' :: ImportSshPublicKey -> 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
"ServerId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serverId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"SshPublicKeyBody" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sshPublicKeyBody),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UserName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userName)
]
)
instance Core.ToPath ImportSshPublicKey where
toPath :: ImportSshPublicKey -> ByteString
toPath = ByteString -> ImportSshPublicKey -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ImportSshPublicKey where
toQuery :: ImportSshPublicKey -> QueryString
toQuery = QueryString -> ImportSshPublicKey -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ImportSshPublicKeyResponse = ImportSshPublicKeyResponse'
{
ImportSshPublicKeyResponse -> Int
httpStatus :: Prelude.Int,
ImportSshPublicKeyResponse -> Text
serverId :: Prelude.Text,
ImportSshPublicKeyResponse -> Text
sshPublicKeyId :: Prelude.Text,
ImportSshPublicKeyResponse -> Text
userName :: Prelude.Text
}
deriving (ImportSshPublicKeyResponse -> ImportSshPublicKeyResponse -> Bool
(ImportSshPublicKeyResponse -> ImportSshPublicKeyResponse -> Bool)
-> (ImportSshPublicKeyResponse
-> ImportSshPublicKeyResponse -> Bool)
-> Eq ImportSshPublicKeyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportSshPublicKeyResponse -> ImportSshPublicKeyResponse -> Bool
$c/= :: ImportSshPublicKeyResponse -> ImportSshPublicKeyResponse -> Bool
== :: ImportSshPublicKeyResponse -> ImportSshPublicKeyResponse -> Bool
$c== :: ImportSshPublicKeyResponse -> ImportSshPublicKeyResponse -> Bool
Prelude.Eq, ReadPrec [ImportSshPublicKeyResponse]
ReadPrec ImportSshPublicKeyResponse
Int -> ReadS ImportSshPublicKeyResponse
ReadS [ImportSshPublicKeyResponse]
(Int -> ReadS ImportSshPublicKeyResponse)
-> ReadS [ImportSshPublicKeyResponse]
-> ReadPrec ImportSshPublicKeyResponse
-> ReadPrec [ImportSshPublicKeyResponse]
-> Read ImportSshPublicKeyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportSshPublicKeyResponse]
$creadListPrec :: ReadPrec [ImportSshPublicKeyResponse]
readPrec :: ReadPrec ImportSshPublicKeyResponse
$creadPrec :: ReadPrec ImportSshPublicKeyResponse
readList :: ReadS [ImportSshPublicKeyResponse]
$creadList :: ReadS [ImportSshPublicKeyResponse]
readsPrec :: Int -> ReadS ImportSshPublicKeyResponse
$creadsPrec :: Int -> ReadS ImportSshPublicKeyResponse
Prelude.Read, Int -> ImportSshPublicKeyResponse -> ShowS
[ImportSshPublicKeyResponse] -> ShowS
ImportSshPublicKeyResponse -> String
(Int -> ImportSshPublicKeyResponse -> ShowS)
-> (ImportSshPublicKeyResponse -> String)
-> ([ImportSshPublicKeyResponse] -> ShowS)
-> Show ImportSshPublicKeyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportSshPublicKeyResponse] -> ShowS
$cshowList :: [ImportSshPublicKeyResponse] -> ShowS
show :: ImportSshPublicKeyResponse -> String
$cshow :: ImportSshPublicKeyResponse -> String
showsPrec :: Int -> ImportSshPublicKeyResponse -> ShowS
$cshowsPrec :: Int -> ImportSshPublicKeyResponse -> ShowS
Prelude.Show, (forall x.
ImportSshPublicKeyResponse -> Rep ImportSshPublicKeyResponse x)
-> (forall x.
Rep ImportSshPublicKeyResponse x -> ImportSshPublicKeyResponse)
-> Generic ImportSshPublicKeyResponse
forall x.
Rep ImportSshPublicKeyResponse x -> ImportSshPublicKeyResponse
forall x.
ImportSshPublicKeyResponse -> Rep ImportSshPublicKeyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ImportSshPublicKeyResponse x -> ImportSshPublicKeyResponse
$cfrom :: forall x.
ImportSshPublicKeyResponse -> Rep ImportSshPublicKeyResponse x
Prelude.Generic)
newImportSshPublicKeyResponse ::
Prelude.Int ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
ImportSshPublicKeyResponse
newImportSshPublicKeyResponse :: Int -> Text -> Text -> Text -> ImportSshPublicKeyResponse
newImportSshPublicKeyResponse
Int
pHttpStatus_
Text
pServerId_
Text
pSshPublicKeyId_
Text
pUserName_ =
ImportSshPublicKeyResponse' :: Int -> Text -> Text -> Text -> ImportSshPublicKeyResponse
ImportSshPublicKeyResponse'
{ $sel:httpStatus:ImportSshPublicKeyResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:serverId:ImportSshPublicKeyResponse' :: Text
serverId = Text
pServerId_,
$sel:sshPublicKeyId:ImportSshPublicKeyResponse' :: Text
sshPublicKeyId = Text
pSshPublicKeyId_,
$sel:userName:ImportSshPublicKeyResponse' :: Text
userName = Text
pUserName_
}
importSshPublicKeyResponse_httpStatus :: Lens.Lens' ImportSshPublicKeyResponse Prelude.Int
importSshPublicKeyResponse_httpStatus :: (Int -> f Int)
-> ImportSshPublicKeyResponse -> f ImportSshPublicKeyResponse
importSshPublicKeyResponse_httpStatus = (ImportSshPublicKeyResponse -> Int)
-> (ImportSshPublicKeyResponse
-> Int -> ImportSshPublicKeyResponse)
-> Lens
ImportSshPublicKeyResponse ImportSshPublicKeyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportSshPublicKeyResponse' {Int
httpStatus :: Int
$sel:httpStatus:ImportSshPublicKeyResponse' :: ImportSshPublicKeyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ImportSshPublicKeyResponse
s@ImportSshPublicKeyResponse' {} Int
a -> ImportSshPublicKeyResponse
s {$sel:httpStatus:ImportSshPublicKeyResponse' :: Int
httpStatus = Int
a} :: ImportSshPublicKeyResponse)
importSshPublicKeyResponse_serverId :: Lens.Lens' ImportSshPublicKeyResponse Prelude.Text
importSshPublicKeyResponse_serverId :: (Text -> f Text)
-> ImportSshPublicKeyResponse -> f ImportSshPublicKeyResponse
importSshPublicKeyResponse_serverId = (ImportSshPublicKeyResponse -> Text)
-> (ImportSshPublicKeyResponse
-> Text -> ImportSshPublicKeyResponse)
-> Lens
ImportSshPublicKeyResponse ImportSshPublicKeyResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportSshPublicKeyResponse' {Text
serverId :: Text
$sel:serverId:ImportSshPublicKeyResponse' :: ImportSshPublicKeyResponse -> Text
serverId} -> Text
serverId) (\s :: ImportSshPublicKeyResponse
s@ImportSshPublicKeyResponse' {} Text
a -> ImportSshPublicKeyResponse
s {$sel:serverId:ImportSshPublicKeyResponse' :: Text
serverId = Text
a} :: ImportSshPublicKeyResponse)
importSshPublicKeyResponse_sshPublicKeyId :: Lens.Lens' ImportSshPublicKeyResponse Prelude.Text
importSshPublicKeyResponse_sshPublicKeyId :: (Text -> f Text)
-> ImportSshPublicKeyResponse -> f ImportSshPublicKeyResponse
importSshPublicKeyResponse_sshPublicKeyId = (ImportSshPublicKeyResponse -> Text)
-> (ImportSshPublicKeyResponse
-> Text -> ImportSshPublicKeyResponse)
-> Lens
ImportSshPublicKeyResponse ImportSshPublicKeyResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportSshPublicKeyResponse' {Text
sshPublicKeyId :: Text
$sel:sshPublicKeyId:ImportSshPublicKeyResponse' :: ImportSshPublicKeyResponse -> Text
sshPublicKeyId} -> Text
sshPublicKeyId) (\s :: ImportSshPublicKeyResponse
s@ImportSshPublicKeyResponse' {} Text
a -> ImportSshPublicKeyResponse
s {$sel:sshPublicKeyId:ImportSshPublicKeyResponse' :: Text
sshPublicKeyId = Text
a} :: ImportSshPublicKeyResponse)
importSshPublicKeyResponse_userName :: Lens.Lens' ImportSshPublicKeyResponse Prelude.Text
importSshPublicKeyResponse_userName :: (Text -> f Text)
-> ImportSshPublicKeyResponse -> f ImportSshPublicKeyResponse
importSshPublicKeyResponse_userName = (ImportSshPublicKeyResponse -> Text)
-> (ImportSshPublicKeyResponse
-> Text -> ImportSshPublicKeyResponse)
-> Lens
ImportSshPublicKeyResponse ImportSshPublicKeyResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportSshPublicKeyResponse' {Text
userName :: Text
$sel:userName:ImportSshPublicKeyResponse' :: ImportSshPublicKeyResponse -> Text
userName} -> Text
userName) (\s :: ImportSshPublicKeyResponse
s@ImportSshPublicKeyResponse' {} Text
a -> ImportSshPublicKeyResponse
s {$sel:userName:ImportSshPublicKeyResponse' :: Text
userName = Text
a} :: ImportSshPublicKeyResponse)
instance Prelude.NFData ImportSshPublicKeyResponse