{-# 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.IoTSecureTunneling.CloseTunnel
(
CloseTunnel (..),
newCloseTunnel,
closeTunnel_delete,
closeTunnel_tunnelId,
CloseTunnelResponse (..),
newCloseTunnelResponse,
closeTunnelResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoTSecureTunneling.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 CloseTunnel = CloseTunnel'
{
CloseTunnel -> Maybe Bool
delete' :: Prelude.Maybe Prelude.Bool,
CloseTunnel -> Text
tunnelId :: Prelude.Text
}
deriving (CloseTunnel -> CloseTunnel -> Bool
(CloseTunnel -> CloseTunnel -> Bool)
-> (CloseTunnel -> CloseTunnel -> Bool) -> Eq CloseTunnel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloseTunnel -> CloseTunnel -> Bool
$c/= :: CloseTunnel -> CloseTunnel -> Bool
== :: CloseTunnel -> CloseTunnel -> Bool
$c== :: CloseTunnel -> CloseTunnel -> Bool
Prelude.Eq, ReadPrec [CloseTunnel]
ReadPrec CloseTunnel
Int -> ReadS CloseTunnel
ReadS [CloseTunnel]
(Int -> ReadS CloseTunnel)
-> ReadS [CloseTunnel]
-> ReadPrec CloseTunnel
-> ReadPrec [CloseTunnel]
-> Read CloseTunnel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloseTunnel]
$creadListPrec :: ReadPrec [CloseTunnel]
readPrec :: ReadPrec CloseTunnel
$creadPrec :: ReadPrec CloseTunnel
readList :: ReadS [CloseTunnel]
$creadList :: ReadS [CloseTunnel]
readsPrec :: Int -> ReadS CloseTunnel
$creadsPrec :: Int -> ReadS CloseTunnel
Prelude.Read, Int -> CloseTunnel -> ShowS
[CloseTunnel] -> ShowS
CloseTunnel -> String
(Int -> CloseTunnel -> ShowS)
-> (CloseTunnel -> String)
-> ([CloseTunnel] -> ShowS)
-> Show CloseTunnel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloseTunnel] -> ShowS
$cshowList :: [CloseTunnel] -> ShowS
show :: CloseTunnel -> String
$cshow :: CloseTunnel -> String
showsPrec :: Int -> CloseTunnel -> ShowS
$cshowsPrec :: Int -> CloseTunnel -> ShowS
Prelude.Show, (forall x. CloseTunnel -> Rep CloseTunnel x)
-> (forall x. Rep CloseTunnel x -> CloseTunnel)
-> Generic CloseTunnel
forall x. Rep CloseTunnel x -> CloseTunnel
forall x. CloseTunnel -> Rep CloseTunnel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CloseTunnel x -> CloseTunnel
$cfrom :: forall x. CloseTunnel -> Rep CloseTunnel x
Prelude.Generic)
newCloseTunnel ::
Prelude.Text ->
CloseTunnel
newCloseTunnel :: Text -> CloseTunnel
newCloseTunnel Text
pTunnelId_ =
CloseTunnel' :: Maybe Bool -> Text -> CloseTunnel
CloseTunnel'
{ $sel:delete':CloseTunnel' :: Maybe Bool
delete' = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:tunnelId:CloseTunnel' :: Text
tunnelId = Text
pTunnelId_
}
closeTunnel_delete :: Lens.Lens' CloseTunnel (Prelude.Maybe Prelude.Bool)
closeTunnel_delete :: (Maybe Bool -> f (Maybe Bool)) -> CloseTunnel -> f CloseTunnel
closeTunnel_delete = (CloseTunnel -> Maybe Bool)
-> (CloseTunnel -> Maybe Bool -> CloseTunnel)
-> Lens CloseTunnel CloseTunnel (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloseTunnel' {Maybe Bool
delete' :: Maybe Bool
$sel:delete':CloseTunnel' :: CloseTunnel -> Maybe Bool
delete'} -> Maybe Bool
delete') (\s :: CloseTunnel
s@CloseTunnel' {} Maybe Bool
a -> CloseTunnel
s {$sel:delete':CloseTunnel' :: Maybe Bool
delete' = Maybe Bool
a} :: CloseTunnel)
closeTunnel_tunnelId :: Lens.Lens' CloseTunnel Prelude.Text
closeTunnel_tunnelId :: (Text -> f Text) -> CloseTunnel -> f CloseTunnel
closeTunnel_tunnelId = (CloseTunnel -> Text)
-> (CloseTunnel -> Text -> CloseTunnel)
-> Lens CloseTunnel CloseTunnel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloseTunnel' {Text
tunnelId :: Text
$sel:tunnelId:CloseTunnel' :: CloseTunnel -> Text
tunnelId} -> Text
tunnelId) (\s :: CloseTunnel
s@CloseTunnel' {} Text
a -> CloseTunnel
s {$sel:tunnelId:CloseTunnel' :: Text
tunnelId = Text
a} :: CloseTunnel)
instance Core.AWSRequest CloseTunnel where
type AWSResponse CloseTunnel = CloseTunnelResponse
request :: CloseTunnel -> Request CloseTunnel
request = Service -> CloseTunnel -> Request CloseTunnel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CloseTunnel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CloseTunnel)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse CloseTunnel))
-> Logger
-> Service
-> Proxy CloseTunnel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CloseTunnel)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> CloseTunnelResponse
CloseTunnelResponse'
(Int -> CloseTunnelResponse)
-> Either String Int -> Either String CloseTunnelResponse
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))
)
instance Prelude.Hashable CloseTunnel
instance Prelude.NFData CloseTunnel
instance Core.ToHeaders CloseTunnel where
toHeaders :: CloseTunnel -> ResponseHeaders
toHeaders =
ResponseHeaders -> CloseTunnel -> 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
"IoTSecuredTunneling.CloseTunnel" ::
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 CloseTunnel where
toJSON :: CloseTunnel -> Value
toJSON CloseTunnel' {Maybe Bool
Text
tunnelId :: Text
delete' :: Maybe Bool
$sel:tunnelId:CloseTunnel' :: CloseTunnel -> Text
$sel:delete':CloseTunnel' :: CloseTunnel -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"delete" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
delete',
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"tunnelId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tunnelId)
]
)
instance Core.ToPath CloseTunnel where
toPath :: CloseTunnel -> ByteString
toPath = ByteString -> CloseTunnel -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CloseTunnel where
toQuery :: CloseTunnel -> QueryString
toQuery = QueryString -> CloseTunnel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CloseTunnelResponse = CloseTunnelResponse'
{
CloseTunnelResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CloseTunnelResponse -> CloseTunnelResponse -> Bool
(CloseTunnelResponse -> CloseTunnelResponse -> Bool)
-> (CloseTunnelResponse -> CloseTunnelResponse -> Bool)
-> Eq CloseTunnelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloseTunnelResponse -> CloseTunnelResponse -> Bool
$c/= :: CloseTunnelResponse -> CloseTunnelResponse -> Bool
== :: CloseTunnelResponse -> CloseTunnelResponse -> Bool
$c== :: CloseTunnelResponse -> CloseTunnelResponse -> Bool
Prelude.Eq, ReadPrec [CloseTunnelResponse]
ReadPrec CloseTunnelResponse
Int -> ReadS CloseTunnelResponse
ReadS [CloseTunnelResponse]
(Int -> ReadS CloseTunnelResponse)
-> ReadS [CloseTunnelResponse]
-> ReadPrec CloseTunnelResponse
-> ReadPrec [CloseTunnelResponse]
-> Read CloseTunnelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloseTunnelResponse]
$creadListPrec :: ReadPrec [CloseTunnelResponse]
readPrec :: ReadPrec CloseTunnelResponse
$creadPrec :: ReadPrec CloseTunnelResponse
readList :: ReadS [CloseTunnelResponse]
$creadList :: ReadS [CloseTunnelResponse]
readsPrec :: Int -> ReadS CloseTunnelResponse
$creadsPrec :: Int -> ReadS CloseTunnelResponse
Prelude.Read, Int -> CloseTunnelResponse -> ShowS
[CloseTunnelResponse] -> ShowS
CloseTunnelResponse -> String
(Int -> CloseTunnelResponse -> ShowS)
-> (CloseTunnelResponse -> String)
-> ([CloseTunnelResponse] -> ShowS)
-> Show CloseTunnelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloseTunnelResponse] -> ShowS
$cshowList :: [CloseTunnelResponse] -> ShowS
show :: CloseTunnelResponse -> String
$cshow :: CloseTunnelResponse -> String
showsPrec :: Int -> CloseTunnelResponse -> ShowS
$cshowsPrec :: Int -> CloseTunnelResponse -> ShowS
Prelude.Show, (forall x. CloseTunnelResponse -> Rep CloseTunnelResponse x)
-> (forall x. Rep CloseTunnelResponse x -> CloseTunnelResponse)
-> Generic CloseTunnelResponse
forall x. Rep CloseTunnelResponse x -> CloseTunnelResponse
forall x. CloseTunnelResponse -> Rep CloseTunnelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CloseTunnelResponse x -> CloseTunnelResponse
$cfrom :: forall x. CloseTunnelResponse -> Rep CloseTunnelResponse x
Prelude.Generic)
newCloseTunnelResponse ::
Prelude.Int ->
CloseTunnelResponse
newCloseTunnelResponse :: Int -> CloseTunnelResponse
newCloseTunnelResponse Int
pHttpStatus_ =
CloseTunnelResponse' :: Int -> CloseTunnelResponse
CloseTunnelResponse' {$sel:httpStatus:CloseTunnelResponse' :: Int
httpStatus = Int
pHttpStatus_}
closeTunnelResponse_httpStatus :: Lens.Lens' CloseTunnelResponse Prelude.Int
closeTunnelResponse_httpStatus :: (Int -> f Int) -> CloseTunnelResponse -> f CloseTunnelResponse
closeTunnelResponse_httpStatus = (CloseTunnelResponse -> Int)
-> (CloseTunnelResponse -> Int -> CloseTunnelResponse)
-> Lens CloseTunnelResponse CloseTunnelResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloseTunnelResponse' {Int
httpStatus :: Int
$sel:httpStatus:CloseTunnelResponse' :: CloseTunnelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CloseTunnelResponse
s@CloseTunnelResponse' {} Int
a -> CloseTunnelResponse
s {$sel:httpStatus:CloseTunnelResponse' :: Int
httpStatus = Int
a} :: CloseTunnelResponse)
instance Prelude.NFData CloseTunnelResponse