{-# 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.DirectConnect.DescribeHostedConnections
(
DescribeHostedConnections (..),
newDescribeHostedConnections,
describeHostedConnections_connectionId,
Connections (..),
newConnections,
connections_connections,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DirectConnect.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 DescribeHostedConnections = DescribeHostedConnections'
{
DescribeHostedConnections -> Text
connectionId :: Prelude.Text
}
deriving (DescribeHostedConnections -> DescribeHostedConnections -> Bool
(DescribeHostedConnections -> DescribeHostedConnections -> Bool)
-> (DescribeHostedConnections -> DescribeHostedConnections -> Bool)
-> Eq DescribeHostedConnections
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeHostedConnections -> DescribeHostedConnections -> Bool
$c/= :: DescribeHostedConnections -> DescribeHostedConnections -> Bool
== :: DescribeHostedConnections -> DescribeHostedConnections -> Bool
$c== :: DescribeHostedConnections -> DescribeHostedConnections -> Bool
Prelude.Eq, ReadPrec [DescribeHostedConnections]
ReadPrec DescribeHostedConnections
Int -> ReadS DescribeHostedConnections
ReadS [DescribeHostedConnections]
(Int -> ReadS DescribeHostedConnections)
-> ReadS [DescribeHostedConnections]
-> ReadPrec DescribeHostedConnections
-> ReadPrec [DescribeHostedConnections]
-> Read DescribeHostedConnections
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeHostedConnections]
$creadListPrec :: ReadPrec [DescribeHostedConnections]
readPrec :: ReadPrec DescribeHostedConnections
$creadPrec :: ReadPrec DescribeHostedConnections
readList :: ReadS [DescribeHostedConnections]
$creadList :: ReadS [DescribeHostedConnections]
readsPrec :: Int -> ReadS DescribeHostedConnections
$creadsPrec :: Int -> ReadS DescribeHostedConnections
Prelude.Read, Int -> DescribeHostedConnections -> ShowS
[DescribeHostedConnections] -> ShowS
DescribeHostedConnections -> String
(Int -> DescribeHostedConnections -> ShowS)
-> (DescribeHostedConnections -> String)
-> ([DescribeHostedConnections] -> ShowS)
-> Show DescribeHostedConnections
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeHostedConnections] -> ShowS
$cshowList :: [DescribeHostedConnections] -> ShowS
show :: DescribeHostedConnections -> String
$cshow :: DescribeHostedConnections -> String
showsPrec :: Int -> DescribeHostedConnections -> ShowS
$cshowsPrec :: Int -> DescribeHostedConnections -> ShowS
Prelude.Show, (forall x.
DescribeHostedConnections -> Rep DescribeHostedConnections x)
-> (forall x.
Rep DescribeHostedConnections x -> DescribeHostedConnections)
-> Generic DescribeHostedConnections
forall x.
Rep DescribeHostedConnections x -> DescribeHostedConnections
forall x.
DescribeHostedConnections -> Rep DescribeHostedConnections x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeHostedConnections x -> DescribeHostedConnections
$cfrom :: forall x.
DescribeHostedConnections -> Rep DescribeHostedConnections x
Prelude.Generic)
newDescribeHostedConnections ::
Prelude.Text ->
DescribeHostedConnections
newDescribeHostedConnections :: Text -> DescribeHostedConnections
newDescribeHostedConnections Text
pConnectionId_ =
DescribeHostedConnections' :: Text -> DescribeHostedConnections
DescribeHostedConnections'
{ $sel:connectionId:DescribeHostedConnections' :: Text
connectionId =
Text
pConnectionId_
}
describeHostedConnections_connectionId :: Lens.Lens' DescribeHostedConnections Prelude.Text
describeHostedConnections_connectionId :: (Text -> f Text)
-> DescribeHostedConnections -> f DescribeHostedConnections
describeHostedConnections_connectionId = (DescribeHostedConnections -> Text)
-> (DescribeHostedConnections -> Text -> DescribeHostedConnections)
-> Lens
DescribeHostedConnections DescribeHostedConnections Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHostedConnections' {Text
connectionId :: Text
$sel:connectionId:DescribeHostedConnections' :: DescribeHostedConnections -> Text
connectionId} -> Text
connectionId) (\s :: DescribeHostedConnections
s@DescribeHostedConnections' {} Text
a -> DescribeHostedConnections
s {$sel:connectionId:DescribeHostedConnections' :: Text
connectionId = Text
a} :: DescribeHostedConnections)
instance Core.AWSRequest DescribeHostedConnections where
type
AWSResponse DescribeHostedConnections =
Connections
request :: DescribeHostedConnections -> Request DescribeHostedConnections
request = Service
-> DescribeHostedConnections -> Request DescribeHostedConnections
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeHostedConnections
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeHostedConnections)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeHostedConnections))
-> Logger
-> Service
-> Proxy DescribeHostedConnections
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeHostedConnections)))
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 -> Object -> Either String Connections
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable DescribeHostedConnections
instance Prelude.NFData DescribeHostedConnections
instance Core.ToHeaders DescribeHostedConnections where
toHeaders :: DescribeHostedConnections -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeHostedConnections -> 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
"OvertureService.DescribeHostedConnections" ::
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 DescribeHostedConnections where
toJSON :: DescribeHostedConnections -> Value
toJSON DescribeHostedConnections' {Text
connectionId :: Text
$sel:connectionId:DescribeHostedConnections' :: DescribeHostedConnections -> 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
"connectionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
connectionId)]
)
instance Core.ToPath DescribeHostedConnections where
toPath :: DescribeHostedConnections -> ByteString
toPath = ByteString -> DescribeHostedConnections -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeHostedConnections where
toQuery :: DescribeHostedConnections -> QueryString
toQuery = QueryString -> DescribeHostedConnections -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty