{-# 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.DescribeServer
(
DescribeServer (..),
newDescribeServer,
describeServer_serverId,
DescribeServerResponse (..),
newDescribeServerResponse,
describeServerResponse_httpStatus,
describeServerResponse_server,
)
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 DescribeServer = DescribeServer'
{
DescribeServer -> Text
serverId :: Prelude.Text
}
deriving (DescribeServer -> DescribeServer -> Bool
(DescribeServer -> DescribeServer -> Bool)
-> (DescribeServer -> DescribeServer -> Bool) -> Eq DescribeServer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeServer -> DescribeServer -> Bool
$c/= :: DescribeServer -> DescribeServer -> Bool
== :: DescribeServer -> DescribeServer -> Bool
$c== :: DescribeServer -> DescribeServer -> Bool
Prelude.Eq, ReadPrec [DescribeServer]
ReadPrec DescribeServer
Int -> ReadS DescribeServer
ReadS [DescribeServer]
(Int -> ReadS DescribeServer)
-> ReadS [DescribeServer]
-> ReadPrec DescribeServer
-> ReadPrec [DescribeServer]
-> Read DescribeServer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeServer]
$creadListPrec :: ReadPrec [DescribeServer]
readPrec :: ReadPrec DescribeServer
$creadPrec :: ReadPrec DescribeServer
readList :: ReadS [DescribeServer]
$creadList :: ReadS [DescribeServer]
readsPrec :: Int -> ReadS DescribeServer
$creadsPrec :: Int -> ReadS DescribeServer
Prelude.Read, Int -> DescribeServer -> ShowS
[DescribeServer] -> ShowS
DescribeServer -> String
(Int -> DescribeServer -> ShowS)
-> (DescribeServer -> String)
-> ([DescribeServer] -> ShowS)
-> Show DescribeServer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeServer] -> ShowS
$cshowList :: [DescribeServer] -> ShowS
show :: DescribeServer -> String
$cshow :: DescribeServer -> String
showsPrec :: Int -> DescribeServer -> ShowS
$cshowsPrec :: Int -> DescribeServer -> ShowS
Prelude.Show, (forall x. DescribeServer -> Rep DescribeServer x)
-> (forall x. Rep DescribeServer x -> DescribeServer)
-> Generic DescribeServer
forall x. Rep DescribeServer x -> DescribeServer
forall x. DescribeServer -> Rep DescribeServer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeServer x -> DescribeServer
$cfrom :: forall x. DescribeServer -> Rep DescribeServer x
Prelude.Generic)
newDescribeServer ::
Prelude.Text ->
DescribeServer
newDescribeServer :: Text -> DescribeServer
newDescribeServer Text
pServerId_ =
DescribeServer' :: Text -> DescribeServer
DescribeServer' {$sel:serverId:DescribeServer' :: Text
serverId = Text
pServerId_}
describeServer_serverId :: Lens.Lens' DescribeServer Prelude.Text
describeServer_serverId :: (Text -> f Text) -> DescribeServer -> f DescribeServer
describeServer_serverId = (DescribeServer -> Text)
-> (DescribeServer -> Text -> DescribeServer)
-> Lens DescribeServer DescribeServer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeServer' {Text
serverId :: Text
$sel:serverId:DescribeServer' :: DescribeServer -> Text
serverId} -> Text
serverId) (\s :: DescribeServer
s@DescribeServer' {} Text
a -> DescribeServer
s {$sel:serverId:DescribeServer' :: Text
serverId = Text
a} :: DescribeServer)
instance Core.AWSRequest DescribeServer where
type
AWSResponse DescribeServer =
DescribeServerResponse
request :: DescribeServer -> Request DescribeServer
request = Service -> DescribeServer -> Request DescribeServer
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeServer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeServer)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeServer))
-> Logger
-> Service
-> Proxy DescribeServer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeServer)))
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 -> DescribedServer -> DescribeServerResponse
DescribeServerResponse'
(Int -> DescribedServer -> DescribeServerResponse)
-> Either String Int
-> Either String (DescribedServer -> DescribeServerResponse)
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 (DescribedServer -> DescribeServerResponse)
-> Either String DescribedServer
-> Either String DescribeServerResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String DescribedServer
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Server")
)
instance Prelude.Hashable DescribeServer
instance Prelude.NFData DescribeServer
instance Core.ToHeaders DescribeServer where
toHeaders :: DescribeServer -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeServer -> 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.DescribeServer" ::
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 DescribeServer where
toJSON :: DescribeServer -> Value
toJSON DescribeServer' {Text
serverId :: Text
$sel:serverId:DescribeServer' :: DescribeServer -> 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)]
)
instance Core.ToPath DescribeServer where
toPath :: DescribeServer -> ByteString
toPath = ByteString -> DescribeServer -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeServer where
toQuery :: DescribeServer -> QueryString
toQuery = QueryString -> DescribeServer -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeServerResponse = DescribeServerResponse'
{
DescribeServerResponse -> Int
httpStatus :: Prelude.Int,
DescribeServerResponse -> DescribedServer
server :: DescribedServer
}
deriving (DescribeServerResponse -> DescribeServerResponse -> Bool
(DescribeServerResponse -> DescribeServerResponse -> Bool)
-> (DescribeServerResponse -> DescribeServerResponse -> Bool)
-> Eq DescribeServerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeServerResponse -> DescribeServerResponse -> Bool
$c/= :: DescribeServerResponse -> DescribeServerResponse -> Bool
== :: DescribeServerResponse -> DescribeServerResponse -> Bool
$c== :: DescribeServerResponse -> DescribeServerResponse -> Bool
Prelude.Eq, ReadPrec [DescribeServerResponse]
ReadPrec DescribeServerResponse
Int -> ReadS DescribeServerResponse
ReadS [DescribeServerResponse]
(Int -> ReadS DescribeServerResponse)
-> ReadS [DescribeServerResponse]
-> ReadPrec DescribeServerResponse
-> ReadPrec [DescribeServerResponse]
-> Read DescribeServerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeServerResponse]
$creadListPrec :: ReadPrec [DescribeServerResponse]
readPrec :: ReadPrec DescribeServerResponse
$creadPrec :: ReadPrec DescribeServerResponse
readList :: ReadS [DescribeServerResponse]
$creadList :: ReadS [DescribeServerResponse]
readsPrec :: Int -> ReadS DescribeServerResponse
$creadsPrec :: Int -> ReadS DescribeServerResponse
Prelude.Read, Int -> DescribeServerResponse -> ShowS
[DescribeServerResponse] -> ShowS
DescribeServerResponse -> String
(Int -> DescribeServerResponse -> ShowS)
-> (DescribeServerResponse -> String)
-> ([DescribeServerResponse] -> ShowS)
-> Show DescribeServerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeServerResponse] -> ShowS
$cshowList :: [DescribeServerResponse] -> ShowS
show :: DescribeServerResponse -> String
$cshow :: DescribeServerResponse -> String
showsPrec :: Int -> DescribeServerResponse -> ShowS
$cshowsPrec :: Int -> DescribeServerResponse -> ShowS
Prelude.Show, (forall x. DescribeServerResponse -> Rep DescribeServerResponse x)
-> (forall x.
Rep DescribeServerResponse x -> DescribeServerResponse)
-> Generic DescribeServerResponse
forall x. Rep DescribeServerResponse x -> DescribeServerResponse
forall x. DescribeServerResponse -> Rep DescribeServerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeServerResponse x -> DescribeServerResponse
$cfrom :: forall x. DescribeServerResponse -> Rep DescribeServerResponse x
Prelude.Generic)
newDescribeServerResponse ::
Prelude.Int ->
DescribedServer ->
DescribeServerResponse
newDescribeServerResponse :: Int -> DescribedServer -> DescribeServerResponse
newDescribeServerResponse Int
pHttpStatus_ DescribedServer
pServer_ =
DescribeServerResponse' :: Int -> DescribedServer -> DescribeServerResponse
DescribeServerResponse'
{ $sel:httpStatus:DescribeServerResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:server:DescribeServerResponse' :: DescribedServer
server = DescribedServer
pServer_
}
describeServerResponse_httpStatus :: Lens.Lens' DescribeServerResponse Prelude.Int
describeServerResponse_httpStatus :: (Int -> f Int)
-> DescribeServerResponse -> f DescribeServerResponse
describeServerResponse_httpStatus = (DescribeServerResponse -> Int)
-> (DescribeServerResponse -> Int -> DescribeServerResponse)
-> Lens DescribeServerResponse DescribeServerResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeServerResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeServerResponse' :: DescribeServerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeServerResponse
s@DescribeServerResponse' {} Int
a -> DescribeServerResponse
s {$sel:httpStatus:DescribeServerResponse' :: Int
httpStatus = Int
a} :: DescribeServerResponse)
describeServerResponse_server :: Lens.Lens' DescribeServerResponse DescribedServer
describeServerResponse_server :: (DescribedServer -> f DescribedServer)
-> DescribeServerResponse -> f DescribeServerResponse
describeServerResponse_server = (DescribeServerResponse -> DescribedServer)
-> (DescribeServerResponse
-> DescribedServer -> DescribeServerResponse)
-> Lens
DescribeServerResponse
DescribeServerResponse
DescribedServer
DescribedServer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeServerResponse' {DescribedServer
server :: DescribedServer
$sel:server:DescribeServerResponse' :: DescribeServerResponse -> DescribedServer
server} -> DescribedServer
server) (\s :: DescribeServerResponse
s@DescribeServerResponse' {} DescribedServer
a -> DescribeServerResponse
s {$sel:server:DescribeServerResponse' :: DescribedServer
server = DescribedServer
a} :: DescribeServerResponse)
instance Prelude.NFData DescribeServerResponse