{-# 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.Outposts.GetConnection
(
GetConnection (..),
newGetConnection,
getConnection_connectionId,
GetConnectionResponse (..),
newGetConnectionResponse,
getConnectionResponse_connectionDetails,
getConnectionResponse_connectionId,
getConnectionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Outposts.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetConnection = GetConnection'
{
GetConnection -> Text
connectionId :: Prelude.Text
}
deriving (GetConnection -> GetConnection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetConnection -> GetConnection -> Bool
$c/= :: GetConnection -> GetConnection -> Bool
== :: GetConnection -> GetConnection -> Bool
$c== :: GetConnection -> GetConnection -> Bool
Prelude.Eq, ReadPrec [GetConnection]
ReadPrec GetConnection
Int -> ReadS GetConnection
ReadS [GetConnection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetConnection]
$creadListPrec :: ReadPrec [GetConnection]
readPrec :: ReadPrec GetConnection
$creadPrec :: ReadPrec GetConnection
readList :: ReadS [GetConnection]
$creadList :: ReadS [GetConnection]
readsPrec :: Int -> ReadS GetConnection
$creadsPrec :: Int -> ReadS GetConnection
Prelude.Read, Int -> GetConnection -> ShowS
[GetConnection] -> ShowS
GetConnection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetConnection] -> ShowS
$cshowList :: [GetConnection] -> ShowS
show :: GetConnection -> String
$cshow :: GetConnection -> String
showsPrec :: Int -> GetConnection -> ShowS
$cshowsPrec :: Int -> GetConnection -> ShowS
Prelude.Show, forall x. Rep GetConnection x -> GetConnection
forall x. GetConnection -> Rep GetConnection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetConnection x -> GetConnection
$cfrom :: forall x. GetConnection -> Rep GetConnection x
Prelude.Generic)
newGetConnection ::
Prelude.Text ->
GetConnection
newGetConnection :: Text -> GetConnection
newGetConnection Text
pConnectionId_ =
GetConnection' {$sel:connectionId:GetConnection' :: Text
connectionId = Text
pConnectionId_}
getConnection_connectionId :: Lens.Lens' GetConnection Prelude.Text
getConnection_connectionId :: Lens' GetConnection Text
getConnection_connectionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConnection' {Text
connectionId :: Text
$sel:connectionId:GetConnection' :: GetConnection -> Text
connectionId} -> Text
connectionId) (\s :: GetConnection
s@GetConnection' {} Text
a -> GetConnection
s {$sel:connectionId:GetConnection' :: Text
connectionId = Text
a} :: GetConnection)
instance Core.AWSRequest GetConnection where
type
AWSResponse GetConnection =
GetConnectionResponse
request :: (Service -> Service) -> GetConnection -> Request GetConnection
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetConnection
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetConnection)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe ConnectionDetails
-> Maybe Text -> Int -> GetConnectionResponse
GetConnectionResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ConnectionDetails")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ConnectionId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetConnection where
hashWithSalt :: Int -> GetConnection -> Int
hashWithSalt Int
_salt GetConnection' {Text
connectionId :: Text
$sel:connectionId:GetConnection' :: GetConnection -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
connectionId
instance Prelude.NFData GetConnection where
rnf :: GetConnection -> ()
rnf GetConnection' {Text
connectionId :: Text
$sel:connectionId:GetConnection' :: GetConnection -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
connectionId
instance Data.ToHeaders GetConnection where
toHeaders :: GetConnection -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath GetConnection where
toPath :: GetConnection -> ByteString
toPath GetConnection' {Text
connectionId :: Text
$sel:connectionId:GetConnection' :: GetConnection -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/connections/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
connectionId]
instance Data.ToQuery GetConnection where
toQuery :: GetConnection -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetConnectionResponse = GetConnectionResponse'
{
GetConnectionResponse -> Maybe ConnectionDetails
connectionDetails :: Prelude.Maybe ConnectionDetails,
GetConnectionResponse -> Maybe Text
connectionId :: Prelude.Maybe Prelude.Text,
GetConnectionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetConnectionResponse -> GetConnectionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetConnectionResponse -> GetConnectionResponse -> Bool
$c/= :: GetConnectionResponse -> GetConnectionResponse -> Bool
== :: GetConnectionResponse -> GetConnectionResponse -> Bool
$c== :: GetConnectionResponse -> GetConnectionResponse -> Bool
Prelude.Eq, ReadPrec [GetConnectionResponse]
ReadPrec GetConnectionResponse
Int -> ReadS GetConnectionResponse
ReadS [GetConnectionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetConnectionResponse]
$creadListPrec :: ReadPrec [GetConnectionResponse]
readPrec :: ReadPrec GetConnectionResponse
$creadPrec :: ReadPrec GetConnectionResponse
readList :: ReadS [GetConnectionResponse]
$creadList :: ReadS [GetConnectionResponse]
readsPrec :: Int -> ReadS GetConnectionResponse
$creadsPrec :: Int -> ReadS GetConnectionResponse
Prelude.Read, Int -> GetConnectionResponse -> ShowS
[GetConnectionResponse] -> ShowS
GetConnectionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetConnectionResponse] -> ShowS
$cshowList :: [GetConnectionResponse] -> ShowS
show :: GetConnectionResponse -> String
$cshow :: GetConnectionResponse -> String
showsPrec :: Int -> GetConnectionResponse -> ShowS
$cshowsPrec :: Int -> GetConnectionResponse -> ShowS
Prelude.Show, forall x. Rep GetConnectionResponse x -> GetConnectionResponse
forall x. GetConnectionResponse -> Rep GetConnectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetConnectionResponse x -> GetConnectionResponse
$cfrom :: forall x. GetConnectionResponse -> Rep GetConnectionResponse x
Prelude.Generic)
newGetConnectionResponse ::
Prelude.Int ->
GetConnectionResponse
newGetConnectionResponse :: Int -> GetConnectionResponse
newGetConnectionResponse Int
pHttpStatus_ =
GetConnectionResponse'
{ $sel:connectionDetails:GetConnectionResponse' :: Maybe ConnectionDetails
connectionDetails =
forall a. Maybe a
Prelude.Nothing,
$sel:connectionId:GetConnectionResponse' :: Maybe Text
connectionId = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetConnectionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getConnectionResponse_connectionDetails :: Lens.Lens' GetConnectionResponse (Prelude.Maybe ConnectionDetails)
getConnectionResponse_connectionDetails :: Lens' GetConnectionResponse (Maybe ConnectionDetails)
getConnectionResponse_connectionDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConnectionResponse' {Maybe ConnectionDetails
connectionDetails :: Maybe ConnectionDetails
$sel:connectionDetails:GetConnectionResponse' :: GetConnectionResponse -> Maybe ConnectionDetails
connectionDetails} -> Maybe ConnectionDetails
connectionDetails) (\s :: GetConnectionResponse
s@GetConnectionResponse' {} Maybe ConnectionDetails
a -> GetConnectionResponse
s {$sel:connectionDetails:GetConnectionResponse' :: Maybe ConnectionDetails
connectionDetails = Maybe ConnectionDetails
a} :: GetConnectionResponse)
getConnectionResponse_connectionId :: Lens.Lens' GetConnectionResponse (Prelude.Maybe Prelude.Text)
getConnectionResponse_connectionId :: Lens' GetConnectionResponse (Maybe Text)
getConnectionResponse_connectionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConnectionResponse' {Maybe Text
connectionId :: Maybe Text
$sel:connectionId:GetConnectionResponse' :: GetConnectionResponse -> Maybe Text
connectionId} -> Maybe Text
connectionId) (\s :: GetConnectionResponse
s@GetConnectionResponse' {} Maybe Text
a -> GetConnectionResponse
s {$sel:connectionId:GetConnectionResponse' :: Maybe Text
connectionId = Maybe Text
a} :: GetConnectionResponse)
getConnectionResponse_httpStatus :: Lens.Lens' GetConnectionResponse Prelude.Int
getConnectionResponse_httpStatus :: Lens' GetConnectionResponse Int
getConnectionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConnectionResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetConnectionResponse' :: GetConnectionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetConnectionResponse
s@GetConnectionResponse' {} Int
a -> GetConnectionResponse
s {$sel:httpStatus:GetConnectionResponse' :: Int
httpStatus = Int
a} :: GetConnectionResponse)
instance Prelude.NFData GetConnectionResponse where
rnf :: GetConnectionResponse -> ()
rnf GetConnectionResponse' {Int
Maybe Text
Maybe ConnectionDetails
httpStatus :: Int
connectionId :: Maybe Text
connectionDetails :: Maybe ConnectionDetails
$sel:httpStatus:GetConnectionResponse' :: GetConnectionResponse -> Int
$sel:connectionId:GetConnectionResponse' :: GetConnectionResponse -> Maybe Text
$sel:connectionDetails:GetConnectionResponse' :: GetConnectionResponse -> Maybe ConnectionDetails
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe ConnectionDetails
connectionDetails
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
connectionId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus