{-# 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.DescribeTunnel
(
DescribeTunnel (..),
newDescribeTunnel,
describeTunnel_tunnelId,
DescribeTunnelResponse (..),
newDescribeTunnelResponse,
describeTunnelResponse_tunnel,
describeTunnelResponse_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 DescribeTunnel = DescribeTunnel'
{
DescribeTunnel -> Text
tunnelId :: Prelude.Text
}
deriving (DescribeTunnel -> DescribeTunnel -> Bool
(DescribeTunnel -> DescribeTunnel -> Bool)
-> (DescribeTunnel -> DescribeTunnel -> Bool) -> Eq DescribeTunnel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTunnel -> DescribeTunnel -> Bool
$c/= :: DescribeTunnel -> DescribeTunnel -> Bool
== :: DescribeTunnel -> DescribeTunnel -> Bool
$c== :: DescribeTunnel -> DescribeTunnel -> Bool
Prelude.Eq, ReadPrec [DescribeTunnel]
ReadPrec DescribeTunnel
Int -> ReadS DescribeTunnel
ReadS [DescribeTunnel]
(Int -> ReadS DescribeTunnel)
-> ReadS [DescribeTunnel]
-> ReadPrec DescribeTunnel
-> ReadPrec [DescribeTunnel]
-> Read DescribeTunnel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTunnel]
$creadListPrec :: ReadPrec [DescribeTunnel]
readPrec :: ReadPrec DescribeTunnel
$creadPrec :: ReadPrec DescribeTunnel
readList :: ReadS [DescribeTunnel]
$creadList :: ReadS [DescribeTunnel]
readsPrec :: Int -> ReadS DescribeTunnel
$creadsPrec :: Int -> ReadS DescribeTunnel
Prelude.Read, Int -> DescribeTunnel -> ShowS
[DescribeTunnel] -> ShowS
DescribeTunnel -> String
(Int -> DescribeTunnel -> ShowS)
-> (DescribeTunnel -> String)
-> ([DescribeTunnel] -> ShowS)
-> Show DescribeTunnel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTunnel] -> ShowS
$cshowList :: [DescribeTunnel] -> ShowS
show :: DescribeTunnel -> String
$cshow :: DescribeTunnel -> String
showsPrec :: Int -> DescribeTunnel -> ShowS
$cshowsPrec :: Int -> DescribeTunnel -> ShowS
Prelude.Show, (forall x. DescribeTunnel -> Rep DescribeTunnel x)
-> (forall x. Rep DescribeTunnel x -> DescribeTunnel)
-> Generic DescribeTunnel
forall x. Rep DescribeTunnel x -> DescribeTunnel
forall x. DescribeTunnel -> Rep DescribeTunnel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeTunnel x -> DescribeTunnel
$cfrom :: forall x. DescribeTunnel -> Rep DescribeTunnel x
Prelude.Generic)
newDescribeTunnel ::
Prelude.Text ->
DescribeTunnel
newDescribeTunnel :: Text -> DescribeTunnel
newDescribeTunnel Text
pTunnelId_ =
DescribeTunnel' :: Text -> DescribeTunnel
DescribeTunnel' {$sel:tunnelId:DescribeTunnel' :: Text
tunnelId = Text
pTunnelId_}
describeTunnel_tunnelId :: Lens.Lens' DescribeTunnel Prelude.Text
describeTunnel_tunnelId :: (Text -> f Text) -> DescribeTunnel -> f DescribeTunnel
describeTunnel_tunnelId = (DescribeTunnel -> Text)
-> (DescribeTunnel -> Text -> DescribeTunnel)
-> Lens DescribeTunnel DescribeTunnel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTunnel' {Text
tunnelId :: Text
$sel:tunnelId:DescribeTunnel' :: DescribeTunnel -> Text
tunnelId} -> Text
tunnelId) (\s :: DescribeTunnel
s@DescribeTunnel' {} Text
a -> DescribeTunnel
s {$sel:tunnelId:DescribeTunnel' :: Text
tunnelId = Text
a} :: DescribeTunnel)
instance Core.AWSRequest DescribeTunnel where
type
AWSResponse DescribeTunnel =
DescribeTunnelResponse
request :: DescribeTunnel -> Request DescribeTunnel
request = Service -> DescribeTunnel -> Request DescribeTunnel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeTunnel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeTunnel)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeTunnel))
-> Logger
-> Service
-> Proxy DescribeTunnel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeTunnel)))
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 Tunnel -> Int -> DescribeTunnelResponse
DescribeTunnelResponse'
(Maybe Tunnel -> Int -> DescribeTunnelResponse)
-> Either String (Maybe Tunnel)
-> Either String (Int -> DescribeTunnelResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Tunnel)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"tunnel")
Either String (Int -> DescribeTunnelResponse)
-> Either String Int -> Either String DescribeTunnelResponse
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 DescribeTunnel
instance Prelude.NFData DescribeTunnel
instance Core.ToHeaders DescribeTunnel where
toHeaders :: DescribeTunnel -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeTunnel -> 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.DescribeTunnel" ::
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 DescribeTunnel where
toJSON :: DescribeTunnel -> Value
toJSON DescribeTunnel' {Text
tunnelId :: Text
$sel:tunnelId:DescribeTunnel' :: DescribeTunnel -> 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
"tunnelId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tunnelId)]
)
instance Core.ToPath DescribeTunnel where
toPath :: DescribeTunnel -> ByteString
toPath = ByteString -> DescribeTunnel -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeTunnel where
toQuery :: DescribeTunnel -> QueryString
toQuery = QueryString -> DescribeTunnel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeTunnelResponse = DescribeTunnelResponse'
{
DescribeTunnelResponse -> Maybe Tunnel
tunnel :: Prelude.Maybe Tunnel,
DescribeTunnelResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeTunnelResponse -> DescribeTunnelResponse -> Bool
(DescribeTunnelResponse -> DescribeTunnelResponse -> Bool)
-> (DescribeTunnelResponse -> DescribeTunnelResponse -> Bool)
-> Eq DescribeTunnelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTunnelResponse -> DescribeTunnelResponse -> Bool
$c/= :: DescribeTunnelResponse -> DescribeTunnelResponse -> Bool
== :: DescribeTunnelResponse -> DescribeTunnelResponse -> Bool
$c== :: DescribeTunnelResponse -> DescribeTunnelResponse -> Bool
Prelude.Eq, ReadPrec [DescribeTunnelResponse]
ReadPrec DescribeTunnelResponse
Int -> ReadS DescribeTunnelResponse
ReadS [DescribeTunnelResponse]
(Int -> ReadS DescribeTunnelResponse)
-> ReadS [DescribeTunnelResponse]
-> ReadPrec DescribeTunnelResponse
-> ReadPrec [DescribeTunnelResponse]
-> Read DescribeTunnelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTunnelResponse]
$creadListPrec :: ReadPrec [DescribeTunnelResponse]
readPrec :: ReadPrec DescribeTunnelResponse
$creadPrec :: ReadPrec DescribeTunnelResponse
readList :: ReadS [DescribeTunnelResponse]
$creadList :: ReadS [DescribeTunnelResponse]
readsPrec :: Int -> ReadS DescribeTunnelResponse
$creadsPrec :: Int -> ReadS DescribeTunnelResponse
Prelude.Read, Int -> DescribeTunnelResponse -> ShowS
[DescribeTunnelResponse] -> ShowS
DescribeTunnelResponse -> String
(Int -> DescribeTunnelResponse -> ShowS)
-> (DescribeTunnelResponse -> String)
-> ([DescribeTunnelResponse] -> ShowS)
-> Show DescribeTunnelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTunnelResponse] -> ShowS
$cshowList :: [DescribeTunnelResponse] -> ShowS
show :: DescribeTunnelResponse -> String
$cshow :: DescribeTunnelResponse -> String
showsPrec :: Int -> DescribeTunnelResponse -> ShowS
$cshowsPrec :: Int -> DescribeTunnelResponse -> ShowS
Prelude.Show, (forall x. DescribeTunnelResponse -> Rep DescribeTunnelResponse x)
-> (forall x.
Rep DescribeTunnelResponse x -> DescribeTunnelResponse)
-> Generic DescribeTunnelResponse
forall x. Rep DescribeTunnelResponse x -> DescribeTunnelResponse
forall x. DescribeTunnelResponse -> Rep DescribeTunnelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeTunnelResponse x -> DescribeTunnelResponse
$cfrom :: forall x. DescribeTunnelResponse -> Rep DescribeTunnelResponse x
Prelude.Generic)
newDescribeTunnelResponse ::
Prelude.Int ->
DescribeTunnelResponse
newDescribeTunnelResponse :: Int -> DescribeTunnelResponse
newDescribeTunnelResponse Int
pHttpStatus_ =
DescribeTunnelResponse' :: Maybe Tunnel -> Int -> DescribeTunnelResponse
DescribeTunnelResponse'
{ $sel:tunnel:DescribeTunnelResponse' :: Maybe Tunnel
tunnel = Maybe Tunnel
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeTunnelResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeTunnelResponse_tunnel :: Lens.Lens' DescribeTunnelResponse (Prelude.Maybe Tunnel)
describeTunnelResponse_tunnel :: (Maybe Tunnel -> f (Maybe Tunnel))
-> DescribeTunnelResponse -> f DescribeTunnelResponse
describeTunnelResponse_tunnel = (DescribeTunnelResponse -> Maybe Tunnel)
-> (DescribeTunnelResponse
-> Maybe Tunnel -> DescribeTunnelResponse)
-> Lens
DescribeTunnelResponse
DescribeTunnelResponse
(Maybe Tunnel)
(Maybe Tunnel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTunnelResponse' {Maybe Tunnel
tunnel :: Maybe Tunnel
$sel:tunnel:DescribeTunnelResponse' :: DescribeTunnelResponse -> Maybe Tunnel
tunnel} -> Maybe Tunnel
tunnel) (\s :: DescribeTunnelResponse
s@DescribeTunnelResponse' {} Maybe Tunnel
a -> DescribeTunnelResponse
s {$sel:tunnel:DescribeTunnelResponse' :: Maybe Tunnel
tunnel = Maybe Tunnel
a} :: DescribeTunnelResponse)
describeTunnelResponse_httpStatus :: Lens.Lens' DescribeTunnelResponse Prelude.Int
describeTunnelResponse_httpStatus :: (Int -> f Int)
-> DescribeTunnelResponse -> f DescribeTunnelResponse
describeTunnelResponse_httpStatus = (DescribeTunnelResponse -> Int)
-> (DescribeTunnelResponse -> Int -> DescribeTunnelResponse)
-> Lens DescribeTunnelResponse DescribeTunnelResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTunnelResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeTunnelResponse' :: DescribeTunnelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeTunnelResponse
s@DescribeTunnelResponse' {} Int
a -> DescribeTunnelResponse
s {$sel:httpStatus:DescribeTunnelResponse' :: Int
httpStatus = Int
a} :: DescribeTunnelResponse)
instance Prelude.NFData DescribeTunnelResponse