{-# 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.ApiGatewayV2.GetRoutes
(
GetRoutes (..),
newGetRoutes,
getRoutes_maxResults,
getRoutes_nextToken,
getRoutes_apiId,
GetRoutesResponse (..),
newGetRoutesResponse,
getRoutesResponse_items,
getRoutesResponse_nextToken,
getRoutesResponse_httpStatus,
)
where
import Amazonka.ApiGatewayV2.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetRoutes = GetRoutes'
{
GetRoutes -> Maybe Text
maxResults :: Prelude.Maybe Prelude.Text,
GetRoutes -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetRoutes -> Text
apiId :: Prelude.Text
}
deriving (GetRoutes -> GetRoutes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRoutes -> GetRoutes -> Bool
$c/= :: GetRoutes -> GetRoutes -> Bool
== :: GetRoutes -> GetRoutes -> Bool
$c== :: GetRoutes -> GetRoutes -> Bool
Prelude.Eq, ReadPrec [GetRoutes]
ReadPrec GetRoutes
Int -> ReadS GetRoutes
ReadS [GetRoutes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRoutes]
$creadListPrec :: ReadPrec [GetRoutes]
readPrec :: ReadPrec GetRoutes
$creadPrec :: ReadPrec GetRoutes
readList :: ReadS [GetRoutes]
$creadList :: ReadS [GetRoutes]
readsPrec :: Int -> ReadS GetRoutes
$creadsPrec :: Int -> ReadS GetRoutes
Prelude.Read, Int -> GetRoutes -> ShowS
[GetRoutes] -> ShowS
GetRoutes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRoutes] -> ShowS
$cshowList :: [GetRoutes] -> ShowS
show :: GetRoutes -> String
$cshow :: GetRoutes -> String
showsPrec :: Int -> GetRoutes -> ShowS
$cshowsPrec :: Int -> GetRoutes -> ShowS
Prelude.Show, forall x. Rep GetRoutes x -> GetRoutes
forall x. GetRoutes -> Rep GetRoutes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRoutes x -> GetRoutes
$cfrom :: forall x. GetRoutes -> Rep GetRoutes x
Prelude.Generic)
newGetRoutes ::
Prelude.Text ->
GetRoutes
newGetRoutes :: Text -> GetRoutes
newGetRoutes Text
pApiId_ =
GetRoutes'
{ $sel:maxResults:GetRoutes' :: Maybe Text
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetRoutes' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:apiId:GetRoutes' :: Text
apiId = Text
pApiId_
}
getRoutes_maxResults :: Lens.Lens' GetRoutes (Prelude.Maybe Prelude.Text)
getRoutes_maxResults :: Lens' GetRoutes (Maybe Text)
getRoutes_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRoutes' {Maybe Text
maxResults :: Maybe Text
$sel:maxResults:GetRoutes' :: GetRoutes -> Maybe Text
maxResults} -> Maybe Text
maxResults) (\s :: GetRoutes
s@GetRoutes' {} Maybe Text
a -> GetRoutes
s {$sel:maxResults:GetRoutes' :: Maybe Text
maxResults = Maybe Text
a} :: GetRoutes)
getRoutes_nextToken :: Lens.Lens' GetRoutes (Prelude.Maybe Prelude.Text)
getRoutes_nextToken :: Lens' GetRoutes (Maybe Text)
getRoutes_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRoutes' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetRoutes' :: GetRoutes -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetRoutes
s@GetRoutes' {} Maybe Text
a -> GetRoutes
s {$sel:nextToken:GetRoutes' :: Maybe Text
nextToken = Maybe Text
a} :: GetRoutes)
getRoutes_apiId :: Lens.Lens' GetRoutes Prelude.Text
getRoutes_apiId :: Lens' GetRoutes Text
getRoutes_apiId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRoutes' {Text
apiId :: Text
$sel:apiId:GetRoutes' :: GetRoutes -> Text
apiId} -> Text
apiId) (\s :: GetRoutes
s@GetRoutes' {} Text
a -> GetRoutes
s {$sel:apiId:GetRoutes' :: Text
apiId = Text
a} :: GetRoutes)
instance Core.AWSPager GetRoutes where
page :: GetRoutes -> AWSResponse GetRoutes -> Maybe GetRoutes
page GetRoutes
rq AWSResponse GetRoutes
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetRoutes
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetRoutesResponse (Maybe Text)
getRoutesResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetRoutes
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetRoutesResponse (Maybe [Route])
getRoutesResponse_items
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ GetRoutes
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' GetRoutes (Maybe Text)
getRoutes_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetRoutes
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetRoutesResponse (Maybe Text)
getRoutesResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest GetRoutes where
type AWSResponse GetRoutes = GetRoutesResponse
request :: (Service -> Service) -> GetRoutes -> Request GetRoutes
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetRoutes
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRoutes)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [Route] -> Maybe Text -> Int -> GetRoutesResponse
GetRoutesResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"items" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetRoutes where
hashWithSalt :: Int -> GetRoutes -> Int
hashWithSalt Int
_salt GetRoutes' {Maybe Text
Text
apiId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Text
$sel:apiId:GetRoutes' :: GetRoutes -> Text
$sel:nextToken:GetRoutes' :: GetRoutes -> Maybe Text
$sel:maxResults:GetRoutes' :: GetRoutes -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
apiId
instance Prelude.NFData GetRoutes where
rnf :: GetRoutes -> ()
rnf GetRoutes' {Maybe Text
Text
apiId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Text
$sel:apiId:GetRoutes' :: GetRoutes -> Text
$sel:nextToken:GetRoutes' :: GetRoutes -> Maybe Text
$sel:maxResults:GetRoutes' :: GetRoutes -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
apiId
instance Data.ToHeaders GetRoutes where
toHeaders :: GetRoutes -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath GetRoutes where
toPath :: GetRoutes -> ByteString
toPath GetRoutes' {Maybe Text
Text
apiId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Text
$sel:apiId:GetRoutes' :: GetRoutes -> Text
$sel:nextToken:GetRoutes' :: GetRoutes -> Maybe Text
$sel:maxResults:GetRoutes' :: GetRoutes -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/v2/apis/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
apiId, ByteString
"/routes"]
instance Data.ToQuery GetRoutes where
toQuery :: GetRoutes -> QueryString
toQuery GetRoutes' {Maybe Text
Text
apiId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Text
$sel:apiId:GetRoutes' :: GetRoutes -> Text
$sel:nextToken:GetRoutes' :: GetRoutes -> Maybe Text
$sel:maxResults:GetRoutes' :: GetRoutes -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
maxResults,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data GetRoutesResponse = GetRoutesResponse'
{
GetRoutesResponse -> Maybe [Route]
items :: Prelude.Maybe [Route],
GetRoutesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetRoutesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetRoutesResponse -> GetRoutesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRoutesResponse -> GetRoutesResponse -> Bool
$c/= :: GetRoutesResponse -> GetRoutesResponse -> Bool
== :: GetRoutesResponse -> GetRoutesResponse -> Bool
$c== :: GetRoutesResponse -> GetRoutesResponse -> Bool
Prelude.Eq, ReadPrec [GetRoutesResponse]
ReadPrec GetRoutesResponse
Int -> ReadS GetRoutesResponse
ReadS [GetRoutesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRoutesResponse]
$creadListPrec :: ReadPrec [GetRoutesResponse]
readPrec :: ReadPrec GetRoutesResponse
$creadPrec :: ReadPrec GetRoutesResponse
readList :: ReadS [GetRoutesResponse]
$creadList :: ReadS [GetRoutesResponse]
readsPrec :: Int -> ReadS GetRoutesResponse
$creadsPrec :: Int -> ReadS GetRoutesResponse
Prelude.Read, Int -> GetRoutesResponse -> ShowS
[GetRoutesResponse] -> ShowS
GetRoutesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRoutesResponse] -> ShowS
$cshowList :: [GetRoutesResponse] -> ShowS
show :: GetRoutesResponse -> String
$cshow :: GetRoutesResponse -> String
showsPrec :: Int -> GetRoutesResponse -> ShowS
$cshowsPrec :: Int -> GetRoutesResponse -> ShowS
Prelude.Show, forall x. Rep GetRoutesResponse x -> GetRoutesResponse
forall x. GetRoutesResponse -> Rep GetRoutesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRoutesResponse x -> GetRoutesResponse
$cfrom :: forall x. GetRoutesResponse -> Rep GetRoutesResponse x
Prelude.Generic)
newGetRoutesResponse ::
Prelude.Int ->
GetRoutesResponse
newGetRoutesResponse :: Int -> GetRoutesResponse
newGetRoutesResponse Int
pHttpStatus_ =
GetRoutesResponse'
{ $sel:items:GetRoutesResponse' :: Maybe [Route]
items = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetRoutesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetRoutesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getRoutesResponse_items :: Lens.Lens' GetRoutesResponse (Prelude.Maybe [Route])
getRoutesResponse_items :: Lens' GetRoutesResponse (Maybe [Route])
getRoutesResponse_items = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRoutesResponse' {Maybe [Route]
items :: Maybe [Route]
$sel:items:GetRoutesResponse' :: GetRoutesResponse -> Maybe [Route]
items} -> Maybe [Route]
items) (\s :: GetRoutesResponse
s@GetRoutesResponse' {} Maybe [Route]
a -> GetRoutesResponse
s {$sel:items:GetRoutesResponse' :: Maybe [Route]
items = Maybe [Route]
a} :: GetRoutesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getRoutesResponse_nextToken :: Lens.Lens' GetRoutesResponse (Prelude.Maybe Prelude.Text)
getRoutesResponse_nextToken :: Lens' GetRoutesResponse (Maybe Text)
getRoutesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRoutesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetRoutesResponse' :: GetRoutesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetRoutesResponse
s@GetRoutesResponse' {} Maybe Text
a -> GetRoutesResponse
s {$sel:nextToken:GetRoutesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetRoutesResponse)
getRoutesResponse_httpStatus :: Lens.Lens' GetRoutesResponse Prelude.Int
getRoutesResponse_httpStatus :: Lens' GetRoutesResponse Int
getRoutesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRoutesResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetRoutesResponse' :: GetRoutesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetRoutesResponse
s@GetRoutesResponse' {} Int
a -> GetRoutesResponse
s {$sel:httpStatus:GetRoutesResponse' :: Int
httpStatus = Int
a} :: GetRoutesResponse)
instance Prelude.NFData GetRoutesResponse where
rnf :: GetRoutesResponse -> ()
rnf GetRoutesResponse' {Int
Maybe [Route]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
items :: Maybe [Route]
$sel:httpStatus:GetRoutesResponse' :: GetRoutesResponse -> Int
$sel:nextToken:GetRoutesResponse' :: GetRoutesResponse -> Maybe Text
$sel:items:GetRoutesResponse' :: GetRoutesResponse -> Maybe [Route]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Route]
items
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus