{-# 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.NetworkManager.DeregisterTransitGateway
(
DeregisterTransitGateway (..),
newDeregisterTransitGateway,
deregisterTransitGateway_globalNetworkId,
deregisterTransitGateway_transitGatewayArn,
DeregisterTransitGatewayResponse (..),
newDeregisterTransitGatewayResponse,
deregisterTransitGatewayResponse_transitGatewayRegistration,
deregisterTransitGatewayResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.NetworkManager.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DeregisterTransitGateway = DeregisterTransitGateway'
{
DeregisterTransitGateway -> Text
globalNetworkId :: Prelude.Text,
DeregisterTransitGateway -> Text
transitGatewayArn :: Prelude.Text
}
deriving (DeregisterTransitGateway -> DeregisterTransitGateway -> Bool
(DeregisterTransitGateway -> DeregisterTransitGateway -> Bool)
-> (DeregisterTransitGateway -> DeregisterTransitGateway -> Bool)
-> Eq DeregisterTransitGateway
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeregisterTransitGateway -> DeregisterTransitGateway -> Bool
$c/= :: DeregisterTransitGateway -> DeregisterTransitGateway -> Bool
== :: DeregisterTransitGateway -> DeregisterTransitGateway -> Bool
$c== :: DeregisterTransitGateway -> DeregisterTransitGateway -> Bool
Prelude.Eq, ReadPrec [DeregisterTransitGateway]
ReadPrec DeregisterTransitGateway
Int -> ReadS DeregisterTransitGateway
ReadS [DeregisterTransitGateway]
(Int -> ReadS DeregisterTransitGateway)
-> ReadS [DeregisterTransitGateway]
-> ReadPrec DeregisterTransitGateway
-> ReadPrec [DeregisterTransitGateway]
-> Read DeregisterTransitGateway
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeregisterTransitGateway]
$creadListPrec :: ReadPrec [DeregisterTransitGateway]
readPrec :: ReadPrec DeregisterTransitGateway
$creadPrec :: ReadPrec DeregisterTransitGateway
readList :: ReadS [DeregisterTransitGateway]
$creadList :: ReadS [DeregisterTransitGateway]
readsPrec :: Int -> ReadS DeregisterTransitGateway
$creadsPrec :: Int -> ReadS DeregisterTransitGateway
Prelude.Read, Int -> DeregisterTransitGateway -> ShowS
[DeregisterTransitGateway] -> ShowS
DeregisterTransitGateway -> String
(Int -> DeregisterTransitGateway -> ShowS)
-> (DeregisterTransitGateway -> String)
-> ([DeregisterTransitGateway] -> ShowS)
-> Show DeregisterTransitGateway
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeregisterTransitGateway] -> ShowS
$cshowList :: [DeregisterTransitGateway] -> ShowS
show :: DeregisterTransitGateway -> String
$cshow :: DeregisterTransitGateway -> String
showsPrec :: Int -> DeregisterTransitGateway -> ShowS
$cshowsPrec :: Int -> DeregisterTransitGateway -> ShowS
Prelude.Show, (forall x.
DeregisterTransitGateway -> Rep DeregisterTransitGateway x)
-> (forall x.
Rep DeregisterTransitGateway x -> DeregisterTransitGateway)
-> Generic DeregisterTransitGateway
forall x.
Rep DeregisterTransitGateway x -> DeregisterTransitGateway
forall x.
DeregisterTransitGateway -> Rep DeregisterTransitGateway x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeregisterTransitGateway x -> DeregisterTransitGateway
$cfrom :: forall x.
DeregisterTransitGateway -> Rep DeregisterTransitGateway x
Prelude.Generic)
newDeregisterTransitGateway ::
Prelude.Text ->
Prelude.Text ->
DeregisterTransitGateway
newDeregisterTransitGateway :: Text -> Text -> DeregisterTransitGateway
newDeregisterTransitGateway
Text
pGlobalNetworkId_
Text
pTransitGatewayArn_ =
DeregisterTransitGateway' :: Text -> Text -> DeregisterTransitGateway
DeregisterTransitGateway'
{ $sel:globalNetworkId:DeregisterTransitGateway' :: Text
globalNetworkId =
Text
pGlobalNetworkId_,
$sel:transitGatewayArn:DeregisterTransitGateway' :: Text
transitGatewayArn = Text
pTransitGatewayArn_
}
deregisterTransitGateway_globalNetworkId :: Lens.Lens' DeregisterTransitGateway Prelude.Text
deregisterTransitGateway_globalNetworkId :: (Text -> f Text)
-> DeregisterTransitGateway -> f DeregisterTransitGateway
deregisterTransitGateway_globalNetworkId = (DeregisterTransitGateway -> Text)
-> (DeregisterTransitGateway -> Text -> DeregisterTransitGateway)
-> Lens DeregisterTransitGateway DeregisterTransitGateway Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterTransitGateway' {Text
globalNetworkId :: Text
$sel:globalNetworkId:DeregisterTransitGateway' :: DeregisterTransitGateway -> Text
globalNetworkId} -> Text
globalNetworkId) (\s :: DeregisterTransitGateway
s@DeregisterTransitGateway' {} Text
a -> DeregisterTransitGateway
s {$sel:globalNetworkId:DeregisterTransitGateway' :: Text
globalNetworkId = Text
a} :: DeregisterTransitGateway)
deregisterTransitGateway_transitGatewayArn :: Lens.Lens' DeregisterTransitGateway Prelude.Text
deregisterTransitGateway_transitGatewayArn :: (Text -> f Text)
-> DeregisterTransitGateway -> f DeregisterTransitGateway
deregisterTransitGateway_transitGatewayArn = (DeregisterTransitGateway -> Text)
-> (DeregisterTransitGateway -> Text -> DeregisterTransitGateway)
-> Lens DeregisterTransitGateway DeregisterTransitGateway Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterTransitGateway' {Text
transitGatewayArn :: Text
$sel:transitGatewayArn:DeregisterTransitGateway' :: DeregisterTransitGateway -> Text
transitGatewayArn} -> Text
transitGatewayArn) (\s :: DeregisterTransitGateway
s@DeregisterTransitGateway' {} Text
a -> DeregisterTransitGateway
s {$sel:transitGatewayArn:DeregisterTransitGateway' :: Text
transitGatewayArn = Text
a} :: DeregisterTransitGateway)
instance Core.AWSRequest DeregisterTransitGateway where
type
AWSResponse DeregisterTransitGateway =
DeregisterTransitGatewayResponse
request :: DeregisterTransitGateway -> Request DeregisterTransitGateway
request = Service
-> DeregisterTransitGateway -> Request DeregisterTransitGateway
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
response :: Logger
-> Service
-> Proxy DeregisterTransitGateway
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeregisterTransitGateway)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeregisterTransitGateway))
-> Logger
-> Service
-> Proxy DeregisterTransitGateway
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeregisterTransitGateway)))
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 TransitGatewayRegistration
-> Int -> DeregisterTransitGatewayResponse
DeregisterTransitGatewayResponse'
(Maybe TransitGatewayRegistration
-> Int -> DeregisterTransitGatewayResponse)
-> Either String (Maybe TransitGatewayRegistration)
-> Either String (Int -> DeregisterTransitGatewayResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe TransitGatewayRegistration)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TransitGatewayRegistration")
Either String (Int -> DeregisterTransitGatewayResponse)
-> Either String Int
-> Either String DeregisterTransitGatewayResponse
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 DeregisterTransitGateway
instance Prelude.NFData DeregisterTransitGateway
instance Core.ToHeaders DeregisterTransitGateway where
toHeaders :: DeregisterTransitGateway -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeregisterTransitGateway -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.ToPath DeregisterTransitGateway where
toPath :: DeregisterTransitGateway -> ByteString
toPath DeregisterTransitGateway' {Text
transitGatewayArn :: Text
globalNetworkId :: Text
$sel:transitGatewayArn:DeregisterTransitGateway' :: DeregisterTransitGateway -> Text
$sel:globalNetworkId:DeregisterTransitGateway' :: DeregisterTransitGateway -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/global-networks/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
globalNetworkId,
ByteString
"/transit-gateway-registrations/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
transitGatewayArn
]
instance Core.ToQuery DeregisterTransitGateway where
toQuery :: DeregisterTransitGateway -> QueryString
toQuery = QueryString -> DeregisterTransitGateway -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeregisterTransitGatewayResponse = DeregisterTransitGatewayResponse'
{
DeregisterTransitGatewayResponse
-> Maybe TransitGatewayRegistration
transitGatewayRegistration :: Prelude.Maybe TransitGatewayRegistration,
DeregisterTransitGatewayResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeregisterTransitGatewayResponse
-> DeregisterTransitGatewayResponse -> Bool
(DeregisterTransitGatewayResponse
-> DeregisterTransitGatewayResponse -> Bool)
-> (DeregisterTransitGatewayResponse
-> DeregisterTransitGatewayResponse -> Bool)
-> Eq DeregisterTransitGatewayResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeregisterTransitGatewayResponse
-> DeregisterTransitGatewayResponse -> Bool
$c/= :: DeregisterTransitGatewayResponse
-> DeregisterTransitGatewayResponse -> Bool
== :: DeregisterTransitGatewayResponse
-> DeregisterTransitGatewayResponse -> Bool
$c== :: DeregisterTransitGatewayResponse
-> DeregisterTransitGatewayResponse -> Bool
Prelude.Eq, ReadPrec [DeregisterTransitGatewayResponse]
ReadPrec DeregisterTransitGatewayResponse
Int -> ReadS DeregisterTransitGatewayResponse
ReadS [DeregisterTransitGatewayResponse]
(Int -> ReadS DeregisterTransitGatewayResponse)
-> ReadS [DeregisterTransitGatewayResponse]
-> ReadPrec DeregisterTransitGatewayResponse
-> ReadPrec [DeregisterTransitGatewayResponse]
-> Read DeregisterTransitGatewayResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeregisterTransitGatewayResponse]
$creadListPrec :: ReadPrec [DeregisterTransitGatewayResponse]
readPrec :: ReadPrec DeregisterTransitGatewayResponse
$creadPrec :: ReadPrec DeregisterTransitGatewayResponse
readList :: ReadS [DeregisterTransitGatewayResponse]
$creadList :: ReadS [DeregisterTransitGatewayResponse]
readsPrec :: Int -> ReadS DeregisterTransitGatewayResponse
$creadsPrec :: Int -> ReadS DeregisterTransitGatewayResponse
Prelude.Read, Int -> DeregisterTransitGatewayResponse -> ShowS
[DeregisterTransitGatewayResponse] -> ShowS
DeregisterTransitGatewayResponse -> String
(Int -> DeregisterTransitGatewayResponse -> ShowS)
-> (DeregisterTransitGatewayResponse -> String)
-> ([DeregisterTransitGatewayResponse] -> ShowS)
-> Show DeregisterTransitGatewayResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeregisterTransitGatewayResponse] -> ShowS
$cshowList :: [DeregisterTransitGatewayResponse] -> ShowS
show :: DeregisterTransitGatewayResponse -> String
$cshow :: DeregisterTransitGatewayResponse -> String
showsPrec :: Int -> DeregisterTransitGatewayResponse -> ShowS
$cshowsPrec :: Int -> DeregisterTransitGatewayResponse -> ShowS
Prelude.Show, (forall x.
DeregisterTransitGatewayResponse
-> Rep DeregisterTransitGatewayResponse x)
-> (forall x.
Rep DeregisterTransitGatewayResponse x
-> DeregisterTransitGatewayResponse)
-> Generic DeregisterTransitGatewayResponse
forall x.
Rep DeregisterTransitGatewayResponse x
-> DeregisterTransitGatewayResponse
forall x.
DeregisterTransitGatewayResponse
-> Rep DeregisterTransitGatewayResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeregisterTransitGatewayResponse x
-> DeregisterTransitGatewayResponse
$cfrom :: forall x.
DeregisterTransitGatewayResponse
-> Rep DeregisterTransitGatewayResponse x
Prelude.Generic)
newDeregisterTransitGatewayResponse ::
Prelude.Int ->
DeregisterTransitGatewayResponse
newDeregisterTransitGatewayResponse :: Int -> DeregisterTransitGatewayResponse
newDeregisterTransitGatewayResponse Int
pHttpStatus_ =
DeregisterTransitGatewayResponse' :: Maybe TransitGatewayRegistration
-> Int -> DeregisterTransitGatewayResponse
DeregisterTransitGatewayResponse'
{ $sel:transitGatewayRegistration:DeregisterTransitGatewayResponse' :: Maybe TransitGatewayRegistration
transitGatewayRegistration =
Maybe TransitGatewayRegistration
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeregisterTransitGatewayResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deregisterTransitGatewayResponse_transitGatewayRegistration :: Lens.Lens' DeregisterTransitGatewayResponse (Prelude.Maybe TransitGatewayRegistration)
deregisterTransitGatewayResponse_transitGatewayRegistration :: (Maybe TransitGatewayRegistration
-> f (Maybe TransitGatewayRegistration))
-> DeregisterTransitGatewayResponse
-> f DeregisterTransitGatewayResponse
deregisterTransitGatewayResponse_transitGatewayRegistration = (DeregisterTransitGatewayResponse
-> Maybe TransitGatewayRegistration)
-> (DeregisterTransitGatewayResponse
-> Maybe TransitGatewayRegistration
-> DeregisterTransitGatewayResponse)
-> Lens
DeregisterTransitGatewayResponse
DeregisterTransitGatewayResponse
(Maybe TransitGatewayRegistration)
(Maybe TransitGatewayRegistration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterTransitGatewayResponse' {Maybe TransitGatewayRegistration
transitGatewayRegistration :: Maybe TransitGatewayRegistration
$sel:transitGatewayRegistration:DeregisterTransitGatewayResponse' :: DeregisterTransitGatewayResponse
-> Maybe TransitGatewayRegistration
transitGatewayRegistration} -> Maybe TransitGatewayRegistration
transitGatewayRegistration) (\s :: DeregisterTransitGatewayResponse
s@DeregisterTransitGatewayResponse' {} Maybe TransitGatewayRegistration
a -> DeregisterTransitGatewayResponse
s {$sel:transitGatewayRegistration:DeregisterTransitGatewayResponse' :: Maybe TransitGatewayRegistration
transitGatewayRegistration = Maybe TransitGatewayRegistration
a} :: DeregisterTransitGatewayResponse)
deregisterTransitGatewayResponse_httpStatus :: Lens.Lens' DeregisterTransitGatewayResponse Prelude.Int
deregisterTransitGatewayResponse_httpStatus :: (Int -> f Int)
-> DeregisterTransitGatewayResponse
-> f DeregisterTransitGatewayResponse
deregisterTransitGatewayResponse_httpStatus = (DeregisterTransitGatewayResponse -> Int)
-> (DeregisterTransitGatewayResponse
-> Int -> DeregisterTransitGatewayResponse)
-> Lens
DeregisterTransitGatewayResponse
DeregisterTransitGatewayResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterTransitGatewayResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeregisterTransitGatewayResponse' :: DeregisterTransitGatewayResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeregisterTransitGatewayResponse
s@DeregisterTransitGatewayResponse' {} Int
a -> DeregisterTransitGatewayResponse
s {$sel:httpStatus:DeregisterTransitGatewayResponse' :: Int
httpStatus = Int
a} :: DeregisterTransitGatewayResponse)
instance
Prelude.NFData
DeregisterTransitGatewayResponse