{-# 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.ConfirmConnection
(
ConfirmConnection (..),
newConfirmConnection,
confirmConnection_connectionId,
ConfirmConnectionResponse (..),
newConfirmConnectionResponse,
confirmConnectionResponse_connectionState,
confirmConnectionResponse_httpStatus,
)
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 ConfirmConnection = ConfirmConnection'
{
ConfirmConnection -> Text
connectionId :: Prelude.Text
}
deriving (ConfirmConnection -> ConfirmConnection -> Bool
(ConfirmConnection -> ConfirmConnection -> Bool)
-> (ConfirmConnection -> ConfirmConnection -> Bool)
-> Eq ConfirmConnection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfirmConnection -> ConfirmConnection -> Bool
$c/= :: ConfirmConnection -> ConfirmConnection -> Bool
== :: ConfirmConnection -> ConfirmConnection -> Bool
$c== :: ConfirmConnection -> ConfirmConnection -> Bool
Prelude.Eq, ReadPrec [ConfirmConnection]
ReadPrec ConfirmConnection
Int -> ReadS ConfirmConnection
ReadS [ConfirmConnection]
(Int -> ReadS ConfirmConnection)
-> ReadS [ConfirmConnection]
-> ReadPrec ConfirmConnection
-> ReadPrec [ConfirmConnection]
-> Read ConfirmConnection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfirmConnection]
$creadListPrec :: ReadPrec [ConfirmConnection]
readPrec :: ReadPrec ConfirmConnection
$creadPrec :: ReadPrec ConfirmConnection
readList :: ReadS [ConfirmConnection]
$creadList :: ReadS [ConfirmConnection]
readsPrec :: Int -> ReadS ConfirmConnection
$creadsPrec :: Int -> ReadS ConfirmConnection
Prelude.Read, Int -> ConfirmConnection -> ShowS
[ConfirmConnection] -> ShowS
ConfirmConnection -> String
(Int -> ConfirmConnection -> ShowS)
-> (ConfirmConnection -> String)
-> ([ConfirmConnection] -> ShowS)
-> Show ConfirmConnection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfirmConnection] -> ShowS
$cshowList :: [ConfirmConnection] -> ShowS
show :: ConfirmConnection -> String
$cshow :: ConfirmConnection -> String
showsPrec :: Int -> ConfirmConnection -> ShowS
$cshowsPrec :: Int -> ConfirmConnection -> ShowS
Prelude.Show, (forall x. ConfirmConnection -> Rep ConfirmConnection x)
-> (forall x. Rep ConfirmConnection x -> ConfirmConnection)
-> Generic ConfirmConnection
forall x. Rep ConfirmConnection x -> ConfirmConnection
forall x. ConfirmConnection -> Rep ConfirmConnection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConfirmConnection x -> ConfirmConnection
$cfrom :: forall x. ConfirmConnection -> Rep ConfirmConnection x
Prelude.Generic)
newConfirmConnection ::
Prelude.Text ->
ConfirmConnection
newConfirmConnection :: Text -> ConfirmConnection
newConfirmConnection Text
pConnectionId_ =
ConfirmConnection' :: Text -> ConfirmConnection
ConfirmConnection' {$sel:connectionId:ConfirmConnection' :: Text
connectionId = Text
pConnectionId_}
confirmConnection_connectionId :: Lens.Lens' ConfirmConnection Prelude.Text
confirmConnection_connectionId :: (Text -> f Text) -> ConfirmConnection -> f ConfirmConnection
confirmConnection_connectionId = (ConfirmConnection -> Text)
-> (ConfirmConnection -> Text -> ConfirmConnection)
-> Lens ConfirmConnection ConfirmConnection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmConnection' {Text
connectionId :: Text
$sel:connectionId:ConfirmConnection' :: ConfirmConnection -> Text
connectionId} -> Text
connectionId) (\s :: ConfirmConnection
s@ConfirmConnection' {} Text
a -> ConfirmConnection
s {$sel:connectionId:ConfirmConnection' :: Text
connectionId = Text
a} :: ConfirmConnection)
instance Core.AWSRequest ConfirmConnection where
type
AWSResponse ConfirmConnection =
ConfirmConnectionResponse
request :: ConfirmConnection -> Request ConfirmConnection
request = Service -> ConfirmConnection -> Request ConfirmConnection
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ConfirmConnection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ConfirmConnection)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ConfirmConnection))
-> Logger
-> Service
-> Proxy ConfirmConnection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ConfirmConnection)))
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 ->
Maybe ConnectionState -> Int -> ConfirmConnectionResponse
ConfirmConnectionResponse'
(Maybe ConnectionState -> Int -> ConfirmConnectionResponse)
-> Either String (Maybe ConnectionState)
-> Either String (Int -> ConfirmConnectionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ConnectionState)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"connectionState")
Either String (Int -> ConfirmConnectionResponse)
-> Either String Int -> Either String ConfirmConnectionResponse
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 ConfirmConnection
instance Prelude.NFData ConfirmConnection
instance Core.ToHeaders ConfirmConnection where
toHeaders :: ConfirmConnection -> ResponseHeaders
toHeaders =
ResponseHeaders -> ConfirmConnection -> 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.ConfirmConnection" ::
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 ConfirmConnection where
toJSON :: ConfirmConnection -> Value
toJSON ConfirmConnection' {Text
connectionId :: Text
$sel:connectionId:ConfirmConnection' :: ConfirmConnection -> 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 ConfirmConnection where
toPath :: ConfirmConnection -> ByteString
toPath = ByteString -> ConfirmConnection -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ConfirmConnection where
toQuery :: ConfirmConnection -> QueryString
toQuery = QueryString -> ConfirmConnection -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ConfirmConnectionResponse = ConfirmConnectionResponse'
{
ConfirmConnectionResponse -> Maybe ConnectionState
connectionState :: Prelude.Maybe ConnectionState,
ConfirmConnectionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ConfirmConnectionResponse -> ConfirmConnectionResponse -> Bool
(ConfirmConnectionResponse -> ConfirmConnectionResponse -> Bool)
-> (ConfirmConnectionResponse -> ConfirmConnectionResponse -> Bool)
-> Eq ConfirmConnectionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfirmConnectionResponse -> ConfirmConnectionResponse -> Bool
$c/= :: ConfirmConnectionResponse -> ConfirmConnectionResponse -> Bool
== :: ConfirmConnectionResponse -> ConfirmConnectionResponse -> Bool
$c== :: ConfirmConnectionResponse -> ConfirmConnectionResponse -> Bool
Prelude.Eq, ReadPrec [ConfirmConnectionResponse]
ReadPrec ConfirmConnectionResponse
Int -> ReadS ConfirmConnectionResponse
ReadS [ConfirmConnectionResponse]
(Int -> ReadS ConfirmConnectionResponse)
-> ReadS [ConfirmConnectionResponse]
-> ReadPrec ConfirmConnectionResponse
-> ReadPrec [ConfirmConnectionResponse]
-> Read ConfirmConnectionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfirmConnectionResponse]
$creadListPrec :: ReadPrec [ConfirmConnectionResponse]
readPrec :: ReadPrec ConfirmConnectionResponse
$creadPrec :: ReadPrec ConfirmConnectionResponse
readList :: ReadS [ConfirmConnectionResponse]
$creadList :: ReadS [ConfirmConnectionResponse]
readsPrec :: Int -> ReadS ConfirmConnectionResponse
$creadsPrec :: Int -> ReadS ConfirmConnectionResponse
Prelude.Read, Int -> ConfirmConnectionResponse -> ShowS
[ConfirmConnectionResponse] -> ShowS
ConfirmConnectionResponse -> String
(Int -> ConfirmConnectionResponse -> ShowS)
-> (ConfirmConnectionResponse -> String)
-> ([ConfirmConnectionResponse] -> ShowS)
-> Show ConfirmConnectionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfirmConnectionResponse] -> ShowS
$cshowList :: [ConfirmConnectionResponse] -> ShowS
show :: ConfirmConnectionResponse -> String
$cshow :: ConfirmConnectionResponse -> String
showsPrec :: Int -> ConfirmConnectionResponse -> ShowS
$cshowsPrec :: Int -> ConfirmConnectionResponse -> ShowS
Prelude.Show, (forall x.
ConfirmConnectionResponse -> Rep ConfirmConnectionResponse x)
-> (forall x.
Rep ConfirmConnectionResponse x -> ConfirmConnectionResponse)
-> Generic ConfirmConnectionResponse
forall x.
Rep ConfirmConnectionResponse x -> ConfirmConnectionResponse
forall x.
ConfirmConnectionResponse -> Rep ConfirmConnectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConfirmConnectionResponse x -> ConfirmConnectionResponse
$cfrom :: forall x.
ConfirmConnectionResponse -> Rep ConfirmConnectionResponse x
Prelude.Generic)
newConfirmConnectionResponse ::
Prelude.Int ->
ConfirmConnectionResponse
newConfirmConnectionResponse :: Int -> ConfirmConnectionResponse
newConfirmConnectionResponse Int
pHttpStatus_ =
ConfirmConnectionResponse' :: Maybe ConnectionState -> Int -> ConfirmConnectionResponse
ConfirmConnectionResponse'
{ $sel:connectionState:ConfirmConnectionResponse' :: Maybe ConnectionState
connectionState =
Maybe ConnectionState
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ConfirmConnectionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
confirmConnectionResponse_connectionState :: Lens.Lens' ConfirmConnectionResponse (Prelude.Maybe ConnectionState)
confirmConnectionResponse_connectionState :: (Maybe ConnectionState -> f (Maybe ConnectionState))
-> ConfirmConnectionResponse -> f ConfirmConnectionResponse
confirmConnectionResponse_connectionState = (ConfirmConnectionResponse -> Maybe ConnectionState)
-> (ConfirmConnectionResponse
-> Maybe ConnectionState -> ConfirmConnectionResponse)
-> Lens
ConfirmConnectionResponse
ConfirmConnectionResponse
(Maybe ConnectionState)
(Maybe ConnectionState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmConnectionResponse' {Maybe ConnectionState
connectionState :: Maybe ConnectionState
$sel:connectionState:ConfirmConnectionResponse' :: ConfirmConnectionResponse -> Maybe ConnectionState
connectionState} -> Maybe ConnectionState
connectionState) (\s :: ConfirmConnectionResponse
s@ConfirmConnectionResponse' {} Maybe ConnectionState
a -> ConfirmConnectionResponse
s {$sel:connectionState:ConfirmConnectionResponse' :: Maybe ConnectionState
connectionState = Maybe ConnectionState
a} :: ConfirmConnectionResponse)
confirmConnectionResponse_httpStatus :: Lens.Lens' ConfirmConnectionResponse Prelude.Int
confirmConnectionResponse_httpStatus :: (Int -> f Int)
-> ConfirmConnectionResponse -> f ConfirmConnectionResponse
confirmConnectionResponse_httpStatus = (ConfirmConnectionResponse -> Int)
-> (ConfirmConnectionResponse -> Int -> ConfirmConnectionResponse)
-> Lens ConfirmConnectionResponse ConfirmConnectionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmConnectionResponse' {Int
httpStatus :: Int
$sel:httpStatus:ConfirmConnectionResponse' :: ConfirmConnectionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ConfirmConnectionResponse
s@ConfirmConnectionResponse' {} Int
a -> ConfirmConnectionResponse
s {$sel:httpStatus:ConfirmConnectionResponse' :: Int
httpStatus = Int
a} :: ConfirmConnectionResponse)
instance Prelude.NFData ConfirmConnectionResponse