{-# 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.ListTunnels
(
ListTunnels (..),
newListTunnels,
listTunnels_nextToken,
listTunnels_thingName,
listTunnels_maxResults,
ListTunnelsResponse (..),
newListTunnelsResponse,
listTunnelsResponse_nextToken,
listTunnelsResponse_tunnelSummaries,
listTunnelsResponse_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 ListTunnels = ListTunnels'
{
ListTunnels -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListTunnels -> Maybe Text
thingName :: Prelude.Maybe Prelude.Text,
ListTunnels -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListTunnels -> ListTunnels -> Bool
(ListTunnels -> ListTunnels -> Bool)
-> (ListTunnels -> ListTunnels -> Bool) -> Eq ListTunnels
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTunnels -> ListTunnels -> Bool
$c/= :: ListTunnels -> ListTunnels -> Bool
== :: ListTunnels -> ListTunnels -> Bool
$c== :: ListTunnels -> ListTunnels -> Bool
Prelude.Eq, ReadPrec [ListTunnels]
ReadPrec ListTunnels
Int -> ReadS ListTunnels
ReadS [ListTunnels]
(Int -> ReadS ListTunnels)
-> ReadS [ListTunnels]
-> ReadPrec ListTunnels
-> ReadPrec [ListTunnels]
-> Read ListTunnels
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTunnels]
$creadListPrec :: ReadPrec [ListTunnels]
readPrec :: ReadPrec ListTunnels
$creadPrec :: ReadPrec ListTunnels
readList :: ReadS [ListTunnels]
$creadList :: ReadS [ListTunnels]
readsPrec :: Int -> ReadS ListTunnels
$creadsPrec :: Int -> ReadS ListTunnels
Prelude.Read, Int -> ListTunnels -> ShowS
[ListTunnels] -> ShowS
ListTunnels -> String
(Int -> ListTunnels -> ShowS)
-> (ListTunnels -> String)
-> ([ListTunnels] -> ShowS)
-> Show ListTunnels
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTunnels] -> ShowS
$cshowList :: [ListTunnels] -> ShowS
show :: ListTunnels -> String
$cshow :: ListTunnels -> String
showsPrec :: Int -> ListTunnels -> ShowS
$cshowsPrec :: Int -> ListTunnels -> ShowS
Prelude.Show, (forall x. ListTunnels -> Rep ListTunnels x)
-> (forall x. Rep ListTunnels x -> ListTunnels)
-> Generic ListTunnels
forall x. Rep ListTunnels x -> ListTunnels
forall x. ListTunnels -> Rep ListTunnels x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListTunnels x -> ListTunnels
$cfrom :: forall x. ListTunnels -> Rep ListTunnels x
Prelude.Generic)
newListTunnels ::
ListTunnels
newListTunnels :: ListTunnels
newListTunnels =
ListTunnels' :: Maybe Text -> Maybe Text -> Maybe Natural -> ListTunnels
ListTunnels'
{ $sel:nextToken:ListTunnels' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:thingName:ListTunnels' :: Maybe Text
thingName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListTunnels' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listTunnels_nextToken :: Lens.Lens' ListTunnels (Prelude.Maybe Prelude.Text)
listTunnels_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListTunnels -> f ListTunnels
listTunnels_nextToken = (ListTunnels -> Maybe Text)
-> (ListTunnels -> Maybe Text -> ListTunnels)
-> Lens ListTunnels ListTunnels (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTunnels' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListTunnels' :: ListTunnels -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListTunnels
s@ListTunnels' {} Maybe Text
a -> ListTunnels
s {$sel:nextToken:ListTunnels' :: Maybe Text
nextToken = Maybe Text
a} :: ListTunnels)
listTunnels_thingName :: Lens.Lens' ListTunnels (Prelude.Maybe Prelude.Text)
listTunnels_thingName :: (Maybe Text -> f (Maybe Text)) -> ListTunnels -> f ListTunnels
listTunnels_thingName = (ListTunnels -> Maybe Text)
-> (ListTunnels -> Maybe Text -> ListTunnels)
-> Lens ListTunnels ListTunnels (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTunnels' {Maybe Text
thingName :: Maybe Text
$sel:thingName:ListTunnels' :: ListTunnels -> Maybe Text
thingName} -> Maybe Text
thingName) (\s :: ListTunnels
s@ListTunnels' {} Maybe Text
a -> ListTunnels
s {$sel:thingName:ListTunnels' :: Maybe Text
thingName = Maybe Text
a} :: ListTunnels)
listTunnels_maxResults :: Lens.Lens' ListTunnels (Prelude.Maybe Prelude.Natural)
listTunnels_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListTunnels -> f ListTunnels
listTunnels_maxResults = (ListTunnels -> Maybe Natural)
-> (ListTunnels -> Maybe Natural -> ListTunnels)
-> Lens ListTunnels ListTunnels (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTunnels' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListTunnels' :: ListTunnels -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListTunnels
s@ListTunnels' {} Maybe Natural
a -> ListTunnels
s {$sel:maxResults:ListTunnels' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListTunnels)
instance Core.AWSRequest ListTunnels where
type AWSResponse ListTunnels = ListTunnelsResponse
request :: ListTunnels -> Request ListTunnels
request = Service -> ListTunnels -> Request ListTunnels
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListTunnels
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListTunnels)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListTunnels))
-> Logger
-> Service
-> Proxy ListTunnels
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListTunnels)))
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 Text -> Maybe [TunnelSummary] -> Int -> ListTunnelsResponse
ListTunnelsResponse'
(Maybe Text -> Maybe [TunnelSummary] -> Int -> ListTunnelsResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe [TunnelSummary] -> Int -> ListTunnelsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
Either String (Maybe [TunnelSummary] -> Int -> ListTunnelsResponse)
-> Either String (Maybe [TunnelSummary])
-> Either String (Int -> ListTunnelsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe (Maybe [TunnelSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"tunnelSummaries"
Either String (Maybe (Maybe [TunnelSummary]))
-> Maybe [TunnelSummary] -> Either String (Maybe [TunnelSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [TunnelSummary]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> ListTunnelsResponse)
-> Either String Int -> Either String ListTunnelsResponse
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 ListTunnels
instance Prelude.NFData ListTunnels
instance Core.ToHeaders ListTunnels where
toHeaders :: ListTunnels -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListTunnels -> 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.ListTunnels" ::
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 ListTunnels where
toJSON :: ListTunnels -> Value
toJSON ListTunnels' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
thingName :: Maybe Text
nextToken :: Maybe Text
$sel:maxResults:ListTunnels' :: ListTunnels -> Maybe Natural
$sel:thingName:ListTunnels' :: ListTunnels -> Maybe Text
$sel:nextToken:ListTunnels' :: ListTunnels -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"nextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
(Text
"thingName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
thingName,
(Text
"maxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
]
)
instance Core.ToPath ListTunnels where
toPath :: ListTunnels -> ByteString
toPath = ByteString -> ListTunnels -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListTunnels where
toQuery :: ListTunnels -> QueryString
toQuery = QueryString -> ListTunnels -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListTunnelsResponse = ListTunnelsResponse'
{
ListTunnelsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListTunnelsResponse -> Maybe [TunnelSummary]
tunnelSummaries :: Prelude.Maybe [TunnelSummary],
ListTunnelsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListTunnelsResponse -> ListTunnelsResponse -> Bool
(ListTunnelsResponse -> ListTunnelsResponse -> Bool)
-> (ListTunnelsResponse -> ListTunnelsResponse -> Bool)
-> Eq ListTunnelsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTunnelsResponse -> ListTunnelsResponse -> Bool
$c/= :: ListTunnelsResponse -> ListTunnelsResponse -> Bool
== :: ListTunnelsResponse -> ListTunnelsResponse -> Bool
$c== :: ListTunnelsResponse -> ListTunnelsResponse -> Bool
Prelude.Eq, ReadPrec [ListTunnelsResponse]
ReadPrec ListTunnelsResponse
Int -> ReadS ListTunnelsResponse
ReadS [ListTunnelsResponse]
(Int -> ReadS ListTunnelsResponse)
-> ReadS [ListTunnelsResponse]
-> ReadPrec ListTunnelsResponse
-> ReadPrec [ListTunnelsResponse]
-> Read ListTunnelsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTunnelsResponse]
$creadListPrec :: ReadPrec [ListTunnelsResponse]
readPrec :: ReadPrec ListTunnelsResponse
$creadPrec :: ReadPrec ListTunnelsResponse
readList :: ReadS [ListTunnelsResponse]
$creadList :: ReadS [ListTunnelsResponse]
readsPrec :: Int -> ReadS ListTunnelsResponse
$creadsPrec :: Int -> ReadS ListTunnelsResponse
Prelude.Read, Int -> ListTunnelsResponse -> ShowS
[ListTunnelsResponse] -> ShowS
ListTunnelsResponse -> String
(Int -> ListTunnelsResponse -> ShowS)
-> (ListTunnelsResponse -> String)
-> ([ListTunnelsResponse] -> ShowS)
-> Show ListTunnelsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTunnelsResponse] -> ShowS
$cshowList :: [ListTunnelsResponse] -> ShowS
show :: ListTunnelsResponse -> String
$cshow :: ListTunnelsResponse -> String
showsPrec :: Int -> ListTunnelsResponse -> ShowS
$cshowsPrec :: Int -> ListTunnelsResponse -> ShowS
Prelude.Show, (forall x. ListTunnelsResponse -> Rep ListTunnelsResponse x)
-> (forall x. Rep ListTunnelsResponse x -> ListTunnelsResponse)
-> Generic ListTunnelsResponse
forall x. Rep ListTunnelsResponse x -> ListTunnelsResponse
forall x. ListTunnelsResponse -> Rep ListTunnelsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListTunnelsResponse x -> ListTunnelsResponse
$cfrom :: forall x. ListTunnelsResponse -> Rep ListTunnelsResponse x
Prelude.Generic)
newListTunnelsResponse ::
Prelude.Int ->
ListTunnelsResponse
newListTunnelsResponse :: Int -> ListTunnelsResponse
newListTunnelsResponse Int
pHttpStatus_ =
ListTunnelsResponse' :: Maybe Text -> Maybe [TunnelSummary] -> Int -> ListTunnelsResponse
ListTunnelsResponse'
{ $sel:nextToken:ListTunnelsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tunnelSummaries:ListTunnelsResponse' :: Maybe [TunnelSummary]
tunnelSummaries = Maybe [TunnelSummary]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListTunnelsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listTunnelsResponse_nextToken :: Lens.Lens' ListTunnelsResponse (Prelude.Maybe Prelude.Text)
listTunnelsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListTunnelsResponse -> f ListTunnelsResponse
listTunnelsResponse_nextToken = (ListTunnelsResponse -> Maybe Text)
-> (ListTunnelsResponse -> Maybe Text -> ListTunnelsResponse)
-> Lens
ListTunnelsResponse ListTunnelsResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTunnelsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListTunnelsResponse' :: ListTunnelsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListTunnelsResponse
s@ListTunnelsResponse' {} Maybe Text
a -> ListTunnelsResponse
s {$sel:nextToken:ListTunnelsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListTunnelsResponse)
listTunnelsResponse_tunnelSummaries :: Lens.Lens' ListTunnelsResponse (Prelude.Maybe [TunnelSummary])
listTunnelsResponse_tunnelSummaries :: (Maybe [TunnelSummary] -> f (Maybe [TunnelSummary]))
-> ListTunnelsResponse -> f ListTunnelsResponse
listTunnelsResponse_tunnelSummaries = (ListTunnelsResponse -> Maybe [TunnelSummary])
-> (ListTunnelsResponse
-> Maybe [TunnelSummary] -> ListTunnelsResponse)
-> Lens
ListTunnelsResponse
ListTunnelsResponse
(Maybe [TunnelSummary])
(Maybe [TunnelSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTunnelsResponse' {Maybe [TunnelSummary]
tunnelSummaries :: Maybe [TunnelSummary]
$sel:tunnelSummaries:ListTunnelsResponse' :: ListTunnelsResponse -> Maybe [TunnelSummary]
tunnelSummaries} -> Maybe [TunnelSummary]
tunnelSummaries) (\s :: ListTunnelsResponse
s@ListTunnelsResponse' {} Maybe [TunnelSummary]
a -> ListTunnelsResponse
s {$sel:tunnelSummaries:ListTunnelsResponse' :: Maybe [TunnelSummary]
tunnelSummaries = Maybe [TunnelSummary]
a} :: ListTunnelsResponse) ((Maybe [TunnelSummary] -> f (Maybe [TunnelSummary]))
-> ListTunnelsResponse -> f ListTunnelsResponse)
-> ((Maybe [TunnelSummary] -> f (Maybe [TunnelSummary]))
-> Maybe [TunnelSummary] -> f (Maybe [TunnelSummary]))
-> (Maybe [TunnelSummary] -> f (Maybe [TunnelSummary]))
-> ListTunnelsResponse
-> f ListTunnelsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[TunnelSummary] [TunnelSummary] [TunnelSummary] [TunnelSummary]
-> Iso
(Maybe [TunnelSummary])
(Maybe [TunnelSummary])
(Maybe [TunnelSummary])
(Maybe [TunnelSummary])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[TunnelSummary] [TunnelSummary] [TunnelSummary] [TunnelSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listTunnelsResponse_httpStatus :: Lens.Lens' ListTunnelsResponse Prelude.Int
listTunnelsResponse_httpStatus :: (Int -> f Int) -> ListTunnelsResponse -> f ListTunnelsResponse
listTunnelsResponse_httpStatus = (ListTunnelsResponse -> Int)
-> (ListTunnelsResponse -> Int -> ListTunnelsResponse)
-> Lens ListTunnelsResponse ListTunnelsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTunnelsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListTunnelsResponse' :: ListTunnelsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListTunnelsResponse
s@ListTunnelsResponse' {} Int
a -> ListTunnelsResponse
s {$sel:httpStatus:ListTunnelsResponse' :: Int
httpStatus = Int
a} :: ListTunnelsResponse)
instance Prelude.NFData ListTunnelsResponse