{-# 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.ListSinks
(
ListSinks (..),
newListSinks,
listSinks_maxResults,
listSinks_nextToken,
ListSinksResponse (..),
newListSinksResponse,
listSinksResponse_nextToken,
listSinksResponse_httpStatus,
listSinksResponse_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 ListSinks = ListSinks'
{
ListSinks -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListSinks -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListSinks -> ListSinks -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSinks -> ListSinks -> Bool
$c/= :: ListSinks -> ListSinks -> Bool
== :: ListSinks -> ListSinks -> Bool
$c== :: ListSinks -> ListSinks -> Bool
Prelude.Eq, ReadPrec [ListSinks]
ReadPrec ListSinks
Int -> ReadS ListSinks
ReadS [ListSinks]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSinks]
$creadListPrec :: ReadPrec [ListSinks]
readPrec :: ReadPrec ListSinks
$creadPrec :: ReadPrec ListSinks
readList :: ReadS [ListSinks]
$creadList :: ReadS [ListSinks]
readsPrec :: Int -> ReadS ListSinks
$creadsPrec :: Int -> ReadS ListSinks
Prelude.Read, Int -> ListSinks -> ShowS
[ListSinks] -> ShowS
ListSinks -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSinks] -> ShowS
$cshowList :: [ListSinks] -> ShowS
show :: ListSinks -> String
$cshow :: ListSinks -> String
showsPrec :: Int -> ListSinks -> ShowS
$cshowsPrec :: Int -> ListSinks -> ShowS
Prelude.Show, forall x. Rep ListSinks x -> ListSinks
forall x. ListSinks -> Rep ListSinks x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSinks x -> ListSinks
$cfrom :: forall x. ListSinks -> Rep ListSinks x
Prelude.Generic)
newListSinks ::
ListSinks
newListSinks :: ListSinks
newListSinks =
ListSinks'
{ $sel:maxResults:ListSinks' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListSinks' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listSinks_maxResults :: Lens.Lens' ListSinks (Prelude.Maybe Prelude.Natural)
listSinks_maxResults :: Lens' ListSinks (Maybe Natural)
listSinks_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSinks' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListSinks' :: ListSinks -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListSinks
s@ListSinks' {} Maybe Natural
a -> ListSinks
s {$sel:maxResults:ListSinks' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListSinks)
listSinks_nextToken :: Lens.Lens' ListSinks (Prelude.Maybe Prelude.Text)
listSinks_nextToken :: Lens' ListSinks (Maybe Text)
listSinks_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSinks' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSinks' :: ListSinks -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSinks
s@ListSinks' {} Maybe Text
a -> ListSinks
s {$sel:nextToken:ListSinks' :: Maybe Text
nextToken = Maybe Text
a} :: ListSinks)
instance Core.AWSPager ListSinks where
page :: ListSinks -> AWSResponse ListSinks -> Maybe ListSinks
page ListSinks
rq AWSResponse ListSinks
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListSinks
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListSinksResponse (Maybe Text)
listSinksResponse_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 ListSinks
rs forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListSinksResponse [ListSinksItem]
listSinksResponse_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.$ ListSinks
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListSinks (Maybe Text)
listSinks_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListSinks
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListSinksResponse (Maybe Text)
listSinksResponse_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 ListSinks where
type AWSResponse ListSinks = ListSinksResponse
request :: (Service -> Service) -> ListSinks -> Request ListSinks
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 ListSinks
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListSinks)))
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 -> [ListSinksItem] -> ListSinksResponse
ListSinksResponse'
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 ListSinks where
hashWithSalt :: Int -> ListSinks -> Int
hashWithSalt Int
_salt ListSinks' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListSinks' :: ListSinks -> Maybe Text
$sel:maxResults:ListSinks' :: ListSinks -> 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 ListSinks where
rnf :: ListSinks -> ()
rnf ListSinks' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListSinks' :: ListSinks -> Maybe Text
$sel:maxResults:ListSinks' :: ListSinks -> 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 ListSinks where
toHeaders :: ListSinks -> 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 ListSinks where
toJSON :: ListSinks -> Value
toJSON ListSinks' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListSinks' :: ListSinks -> Maybe Text
$sel:maxResults:ListSinks' :: ListSinks -> 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 ListSinks where
toPath :: ListSinks -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/ListSinks"
instance Data.ToQuery ListSinks where
toQuery :: ListSinks -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListSinksResponse = ListSinksResponse'
{
ListSinksResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListSinksResponse -> Int
httpStatus :: Prelude.Int,
ListSinksResponse -> [ListSinksItem]
items :: [ListSinksItem]
}
deriving (ListSinksResponse -> ListSinksResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSinksResponse -> ListSinksResponse -> Bool
$c/= :: ListSinksResponse -> ListSinksResponse -> Bool
== :: ListSinksResponse -> ListSinksResponse -> Bool
$c== :: ListSinksResponse -> ListSinksResponse -> Bool
Prelude.Eq, ReadPrec [ListSinksResponse]
ReadPrec ListSinksResponse
Int -> ReadS ListSinksResponse
ReadS [ListSinksResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSinksResponse]
$creadListPrec :: ReadPrec [ListSinksResponse]
readPrec :: ReadPrec ListSinksResponse
$creadPrec :: ReadPrec ListSinksResponse
readList :: ReadS [ListSinksResponse]
$creadList :: ReadS [ListSinksResponse]
readsPrec :: Int -> ReadS ListSinksResponse
$creadsPrec :: Int -> ReadS ListSinksResponse
Prelude.Read, Int -> ListSinksResponse -> ShowS
[ListSinksResponse] -> ShowS
ListSinksResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSinksResponse] -> ShowS
$cshowList :: [ListSinksResponse] -> ShowS
show :: ListSinksResponse -> String
$cshow :: ListSinksResponse -> String
showsPrec :: Int -> ListSinksResponse -> ShowS
$cshowsPrec :: Int -> ListSinksResponse -> ShowS
Prelude.Show, forall x. Rep ListSinksResponse x -> ListSinksResponse
forall x. ListSinksResponse -> Rep ListSinksResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSinksResponse x -> ListSinksResponse
$cfrom :: forall x. ListSinksResponse -> Rep ListSinksResponse x
Prelude.Generic)
newListSinksResponse ::
Prelude.Int ->
ListSinksResponse
newListSinksResponse :: Int -> ListSinksResponse
newListSinksResponse Int
pHttpStatus_ =
ListSinksResponse'
{ $sel:nextToken:ListSinksResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListSinksResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:items:ListSinksResponse' :: [ListSinksItem]
items = forall a. Monoid a => a
Prelude.mempty
}
listSinksResponse_nextToken :: Lens.Lens' ListSinksResponse (Prelude.Maybe Prelude.Text)
listSinksResponse_nextToken :: Lens' ListSinksResponse (Maybe Text)
listSinksResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSinksResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSinksResponse' :: ListSinksResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSinksResponse
s@ListSinksResponse' {} Maybe Text
a -> ListSinksResponse
s {$sel:nextToken:ListSinksResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListSinksResponse)
listSinksResponse_httpStatus :: Lens.Lens' ListSinksResponse Prelude.Int
listSinksResponse_httpStatus :: Lens' ListSinksResponse Int
listSinksResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSinksResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListSinksResponse' :: ListSinksResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListSinksResponse
s@ListSinksResponse' {} Int
a -> ListSinksResponse
s {$sel:httpStatus:ListSinksResponse' :: Int
httpStatus = Int
a} :: ListSinksResponse)
listSinksResponse_items :: Lens.Lens' ListSinksResponse [ListSinksItem]
listSinksResponse_items :: Lens' ListSinksResponse [ListSinksItem]
listSinksResponse_items = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSinksResponse' {[ListSinksItem]
items :: [ListSinksItem]
$sel:items:ListSinksResponse' :: ListSinksResponse -> [ListSinksItem]
items} -> [ListSinksItem]
items) (\s :: ListSinksResponse
s@ListSinksResponse' {} [ListSinksItem]
a -> ListSinksResponse
s {$sel:items:ListSinksResponse' :: [ListSinksItem]
items = [ListSinksItem]
a} :: ListSinksResponse) 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 ListSinksResponse where
rnf :: ListSinksResponse -> ()
rnf ListSinksResponse' {Int
[ListSinksItem]
Maybe Text
items :: [ListSinksItem]
httpStatus :: Int
nextToken :: Maybe Text
$sel:items:ListSinksResponse' :: ListSinksResponse -> [ListSinksItem]
$sel:httpStatus:ListSinksResponse' :: ListSinksResponse -> Int
$sel:nextToken:ListSinksResponse' :: ListSinksResponse -> 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 [ListSinksItem]
items