{-# 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.OAM.ListLinks
(
ListLinks (..),
newListLinks,
listLinks_maxResults,
listLinks_nextToken,
ListLinksResponse (..),
newListLinksResponse,
listLinksResponse_nextToken,
listLinksResponse_httpStatus,
listLinksResponse_items,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.OAM.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListLinks = ListLinks'
{
ListLinks -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListLinks -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListLinks -> ListLinks -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListLinks -> ListLinks -> Bool
$c/= :: ListLinks -> ListLinks -> Bool
== :: ListLinks -> ListLinks -> Bool
$c== :: ListLinks -> ListLinks -> Bool
Prelude.Eq, ReadPrec [ListLinks]
ReadPrec ListLinks
Int -> ReadS ListLinks
ReadS [ListLinks]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListLinks]
$creadListPrec :: ReadPrec [ListLinks]
readPrec :: ReadPrec ListLinks
$creadPrec :: ReadPrec ListLinks
readList :: ReadS [ListLinks]
$creadList :: ReadS [ListLinks]
readsPrec :: Int -> ReadS ListLinks
$creadsPrec :: Int -> ReadS ListLinks
Prelude.Read, Int -> ListLinks -> ShowS
[ListLinks] -> ShowS
ListLinks -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListLinks] -> ShowS
$cshowList :: [ListLinks] -> ShowS
show :: ListLinks -> String
$cshow :: ListLinks -> String
showsPrec :: Int -> ListLinks -> ShowS
$cshowsPrec :: Int -> ListLinks -> ShowS
Prelude.Show, forall x. Rep ListLinks x -> ListLinks
forall x. ListLinks -> Rep ListLinks x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListLinks x -> ListLinks
$cfrom :: forall x. ListLinks -> Rep ListLinks x
Prelude.Generic)
newListLinks ::
ListLinks
newListLinks :: ListLinks
newListLinks =
ListLinks'
{ $sel:maxResults:ListLinks' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListLinks' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listLinks_maxResults :: Lens.Lens' ListLinks (Prelude.Maybe Prelude.Natural)
listLinks_maxResults :: Lens' ListLinks (Maybe Natural)
listLinks_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLinks' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListLinks' :: ListLinks -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListLinks
s@ListLinks' {} Maybe Natural
a -> ListLinks
s {$sel:maxResults:ListLinks' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListLinks)
listLinks_nextToken :: Lens.Lens' ListLinks (Prelude.Maybe Prelude.Text)
listLinks_nextToken :: Lens' ListLinks (Maybe Text)
listLinks_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLinks' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListLinks' :: ListLinks -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListLinks
s@ListLinks' {} Maybe Text
a -> ListLinks
s {$sel:nextToken:ListLinks' :: Maybe Text
nextToken = Maybe Text
a} :: ListLinks)
instance Core.AWSPager ListLinks where
page :: ListLinks -> AWSResponse ListLinks -> Maybe ListLinks
page ListLinks
rq AWSResponse ListLinks
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListLinks
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListLinksResponse (Maybe Text)
listLinksResponse_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 ListLinks
rs forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListLinksResponse [ListLinksItem]
listLinksResponse_items) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListLinks
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListLinks (Maybe Text)
listLinks_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListLinks
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListLinksResponse (Maybe Text)
listLinksResponse_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 ListLinks where
type AWSResponse ListLinks = ListLinksResponse
request :: (Service -> Service) -> ListLinks -> Request ListLinks
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListLinks
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListLinks)))
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 Text -> Int -> [ListLinksItem] -> ListLinksResponse
ListLinksResponse'
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
"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))
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
"Items" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListLinks where
hashWithSalt :: Int -> ListLinks -> Int
hashWithSalt Int
_salt ListLinks' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListLinks' :: ListLinks -> Maybe Text
$sel:maxResults:ListLinks' :: ListLinks -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListLinks where
rnf :: ListLinks -> ()
rnf ListLinks' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListLinks' :: ListLinks -> Maybe Text
$sel:maxResults:ListLinks' :: ListLinks -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
instance Data.ToHeaders ListLinks where
toHeaders :: ListLinks -> 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.ToJSON ListLinks where
toJSON :: ListLinks -> Value
toJSON ListLinks' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListLinks' :: ListLinks -> Maybe Text
$sel:maxResults:ListLinks' :: ListLinks -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
(Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken
]
)
instance Data.ToPath ListLinks where
toPath :: ListLinks -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/ListLinks"
instance Data.ToQuery ListLinks where
toQuery :: ListLinks -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListLinksResponse = ListLinksResponse'
{
ListLinksResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListLinksResponse -> Int
httpStatus :: Prelude.Int,
ListLinksResponse -> [ListLinksItem]
items :: [ListLinksItem]
}
deriving (ListLinksResponse -> ListLinksResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListLinksResponse -> ListLinksResponse -> Bool
$c/= :: ListLinksResponse -> ListLinksResponse -> Bool
== :: ListLinksResponse -> ListLinksResponse -> Bool
$c== :: ListLinksResponse -> ListLinksResponse -> Bool
Prelude.Eq, ReadPrec [ListLinksResponse]
ReadPrec ListLinksResponse
Int -> ReadS ListLinksResponse
ReadS [ListLinksResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListLinksResponse]
$creadListPrec :: ReadPrec [ListLinksResponse]
readPrec :: ReadPrec ListLinksResponse
$creadPrec :: ReadPrec ListLinksResponse
readList :: ReadS [ListLinksResponse]
$creadList :: ReadS [ListLinksResponse]
readsPrec :: Int -> ReadS ListLinksResponse
$creadsPrec :: Int -> ReadS ListLinksResponse
Prelude.Read, Int -> ListLinksResponse -> ShowS
[ListLinksResponse] -> ShowS
ListLinksResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListLinksResponse] -> ShowS
$cshowList :: [ListLinksResponse] -> ShowS
show :: ListLinksResponse -> String
$cshow :: ListLinksResponse -> String
showsPrec :: Int -> ListLinksResponse -> ShowS
$cshowsPrec :: Int -> ListLinksResponse -> ShowS
Prelude.Show, forall x. Rep ListLinksResponse x -> ListLinksResponse
forall x. ListLinksResponse -> Rep ListLinksResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListLinksResponse x -> ListLinksResponse
$cfrom :: forall x. ListLinksResponse -> Rep ListLinksResponse x
Prelude.Generic)
newListLinksResponse ::
Prelude.Int ->
ListLinksResponse
newListLinksResponse :: Int -> ListLinksResponse
newListLinksResponse Int
pHttpStatus_ =
ListLinksResponse'
{ $sel:nextToken:ListLinksResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListLinksResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:items:ListLinksResponse' :: [ListLinksItem]
items = forall a. Monoid a => a
Prelude.mempty
}
listLinksResponse_nextToken :: Lens.Lens' ListLinksResponse (Prelude.Maybe Prelude.Text)
listLinksResponse_nextToken :: Lens' ListLinksResponse (Maybe Text)
listLinksResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLinksResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListLinksResponse' :: ListLinksResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListLinksResponse
s@ListLinksResponse' {} Maybe Text
a -> ListLinksResponse
s {$sel:nextToken:ListLinksResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListLinksResponse)
listLinksResponse_httpStatus :: Lens.Lens' ListLinksResponse Prelude.Int
listLinksResponse_httpStatus :: Lens' ListLinksResponse Int
listLinksResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLinksResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListLinksResponse' :: ListLinksResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListLinksResponse
s@ListLinksResponse' {} Int
a -> ListLinksResponse
s {$sel:httpStatus:ListLinksResponse' :: Int
httpStatus = Int
a} :: ListLinksResponse)
listLinksResponse_items :: Lens.Lens' ListLinksResponse [ListLinksItem]
listLinksResponse_items :: Lens' ListLinksResponse [ListLinksItem]
listLinksResponse_items = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLinksResponse' {[ListLinksItem]
items :: [ListLinksItem]
$sel:items:ListLinksResponse' :: ListLinksResponse -> [ListLinksItem]
items} -> [ListLinksItem]
items) (\s :: ListLinksResponse
s@ListLinksResponse' {} [ListLinksItem]
a -> ListLinksResponse
s {$sel:items:ListLinksResponse' :: [ListLinksItem]
items = [ListLinksItem]
a} :: ListLinksResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListLinksResponse where
rnf :: ListLinksResponse -> ()
rnf ListLinksResponse' {Int
[ListLinksItem]
Maybe Text
items :: [ListLinksItem]
httpStatus :: Int
nextToken :: Maybe Text
$sel:items:ListLinksResponse' :: ListLinksResponse -> [ListLinksItem]
$sel:httpStatus:ListLinksResponse' :: ListLinksResponse -> Int
$sel:nextToken:ListLinksResponse' :: ListLinksResponse -> Maybe Text
..} =
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
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [ListLinksItem]
items