{-# 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.SSMContacts.ListPageReceipts
(
ListPageReceipts (..),
newListPageReceipts,
listPageReceipts_maxResults,
listPageReceipts_nextToken,
listPageReceipts_pageId,
ListPageReceiptsResponse (..),
newListPageReceiptsResponse,
listPageReceiptsResponse_nextToken,
listPageReceiptsResponse_receipts,
listPageReceiptsResponse_httpStatus,
)
where
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
import Amazonka.SSMContacts.Types
data =
{
:: Prelude.Maybe Prelude.Natural,
:: Prelude.Maybe Prelude.Text,
:: Prelude.Text
}
deriving (ListPageReceipts -> ListPageReceipts -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPageReceipts -> ListPageReceipts -> Bool
$c/= :: ListPageReceipts -> ListPageReceipts -> Bool
== :: ListPageReceipts -> ListPageReceipts -> Bool
$c== :: ListPageReceipts -> ListPageReceipts -> Bool
Prelude.Eq, ReadPrec [ListPageReceipts]
ReadPrec ListPageReceipts
Int -> ReadS ListPageReceipts
ReadS [ListPageReceipts]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPageReceipts]
$creadListPrec :: ReadPrec [ListPageReceipts]
readPrec :: ReadPrec ListPageReceipts
$creadPrec :: ReadPrec ListPageReceipts
readList :: ReadS [ListPageReceipts]
$creadList :: ReadS [ListPageReceipts]
readsPrec :: Int -> ReadS ListPageReceipts
$creadsPrec :: Int -> ReadS ListPageReceipts
Prelude.Read, Int -> ListPageReceipts -> ShowS
[ListPageReceipts] -> ShowS
ListPageReceipts -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPageReceipts] -> ShowS
$cshowList :: [ListPageReceipts] -> ShowS
show :: ListPageReceipts -> String
$cshow :: ListPageReceipts -> String
showsPrec :: Int -> ListPageReceipts -> ShowS
$cshowsPrec :: Int -> ListPageReceipts -> ShowS
Prelude.Show, forall x. Rep ListPageReceipts x -> ListPageReceipts
forall x. ListPageReceipts -> Rep ListPageReceipts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPageReceipts x -> ListPageReceipts
$cfrom :: forall x. ListPageReceipts -> Rep ListPageReceipts x
Prelude.Generic)
newListPageReceipts ::
Prelude.Text ->
ListPageReceipts
Text
pPageId_ =
ListPageReceipts'
{ $sel:maxResults:ListPageReceipts' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListPageReceipts' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:pageId:ListPageReceipts' :: Text
pageId = Text
pPageId_
}
listPageReceipts_maxResults :: Lens.Lens' ListPageReceipts (Prelude.Maybe Prelude.Natural)
= forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPageReceipts' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListPageReceipts' :: ListPageReceipts -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListPageReceipts
s@ListPageReceipts' {} Maybe Natural
a -> ListPageReceipts
s {$sel:maxResults:ListPageReceipts' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListPageReceipts)
listPageReceipts_nextToken :: Lens.Lens' ListPageReceipts (Prelude.Maybe Prelude.Text)
= forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPageReceipts' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPageReceipts' :: ListPageReceipts -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPageReceipts
s@ListPageReceipts' {} Maybe Text
a -> ListPageReceipts
s {$sel:nextToken:ListPageReceipts' :: Maybe Text
nextToken = Maybe Text
a} :: ListPageReceipts)
listPageReceipts_pageId :: Lens.Lens' ListPageReceipts Prelude.Text
= forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPageReceipts' {Text
pageId :: Text
$sel:pageId:ListPageReceipts' :: ListPageReceipts -> Text
pageId} -> Text
pageId) (\s :: ListPageReceipts
s@ListPageReceipts' {} Text
a -> ListPageReceipts
s {$sel:pageId:ListPageReceipts' :: Text
pageId = Text
a} :: ListPageReceipts)
instance Core.AWSPager ListPageReceipts where
page :: ListPageReceipts
-> AWSResponse ListPageReceipts -> Maybe ListPageReceipts
page ListPageReceipts
rq AWSResponse ListPageReceipts
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListPageReceipts
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPageReceiptsResponse (Maybe Text)
listPageReceiptsResponse_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 ListPageReceipts
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPageReceiptsResponse (Maybe [Receipt])
listPageReceiptsResponse_receipts
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.$ ListPageReceipts
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListPageReceipts (Maybe Text)
listPageReceipts_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListPageReceipts
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPageReceiptsResponse (Maybe Text)
listPageReceiptsResponse_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 ListPageReceipts where
type
AWSResponse ListPageReceipts =
ListPageReceiptsResponse
request :: (Service -> Service)
-> ListPageReceipts -> Request ListPageReceipts
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 ListPageReceipts
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListPageReceipts)))
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 -> Maybe [Receipt] -> Int -> ListPageReceiptsResponse
ListPageReceiptsResponse'
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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Receipts" 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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListPageReceipts where
hashWithSalt :: Int -> ListPageReceipts -> Int
hashWithSalt Int
_salt ListPageReceipts' {Maybe Natural
Maybe Text
Text
pageId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:pageId:ListPageReceipts' :: ListPageReceipts -> Text
$sel:nextToken:ListPageReceipts' :: ListPageReceipts -> Maybe Text
$sel:maxResults:ListPageReceipts' :: ListPageReceipts -> 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
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
pageId
instance Prelude.NFData ListPageReceipts where
rnf :: ListPageReceipts -> ()
rnf ListPageReceipts' {Maybe Natural
Maybe Text
Text
pageId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:pageId:ListPageReceipts' :: ListPageReceipts -> Text
$sel:nextToken:ListPageReceipts' :: ListPageReceipts -> Maybe Text
$sel:maxResults:ListPageReceipts' :: ListPageReceipts -> 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
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
pageId
instance Data.ToHeaders ListPageReceipts where
toHeaders :: ListPageReceipts -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"SSMContacts.ListPageReceipts" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListPageReceipts where
toJSON :: ListPageReceipts -> Value
toJSON ListPageReceipts' {Maybe Natural
Maybe Text
Text
pageId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:pageId:ListPageReceipts' :: ListPageReceipts -> Text
$sel:nextToken:ListPageReceipts' :: ListPageReceipts -> Maybe Text
$sel:maxResults:ListPageReceipts' :: ListPageReceipts -> 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,
forall a. a -> Maybe a
Prelude.Just (Key
"PageId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
pageId)
]
)
instance Data.ToPath ListPageReceipts where
toPath :: ListPageReceipts -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListPageReceipts where
toQuery :: ListPageReceipts -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data =
{
:: Prelude.Maybe Prelude.Text,
:: Prelude.Maybe [Receipt],
:: Prelude.Int
}
deriving (ListPageReceiptsResponse -> ListPageReceiptsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPageReceiptsResponse -> ListPageReceiptsResponse -> Bool
$c/= :: ListPageReceiptsResponse -> ListPageReceiptsResponse -> Bool
== :: ListPageReceiptsResponse -> ListPageReceiptsResponse -> Bool
$c== :: ListPageReceiptsResponse -> ListPageReceiptsResponse -> Bool
Prelude.Eq, ReadPrec [ListPageReceiptsResponse]
ReadPrec ListPageReceiptsResponse
Int -> ReadS ListPageReceiptsResponse
ReadS [ListPageReceiptsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPageReceiptsResponse]
$creadListPrec :: ReadPrec [ListPageReceiptsResponse]
readPrec :: ReadPrec ListPageReceiptsResponse
$creadPrec :: ReadPrec ListPageReceiptsResponse
readList :: ReadS [ListPageReceiptsResponse]
$creadList :: ReadS [ListPageReceiptsResponse]
readsPrec :: Int -> ReadS ListPageReceiptsResponse
$creadsPrec :: Int -> ReadS ListPageReceiptsResponse
Prelude.Read, Int -> ListPageReceiptsResponse -> ShowS
[ListPageReceiptsResponse] -> ShowS
ListPageReceiptsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPageReceiptsResponse] -> ShowS
$cshowList :: [ListPageReceiptsResponse] -> ShowS
show :: ListPageReceiptsResponse -> String
$cshow :: ListPageReceiptsResponse -> String
showsPrec :: Int -> ListPageReceiptsResponse -> ShowS
$cshowsPrec :: Int -> ListPageReceiptsResponse -> ShowS
Prelude.Show, forall x.
Rep ListPageReceiptsResponse x -> ListPageReceiptsResponse
forall x.
ListPageReceiptsResponse -> Rep ListPageReceiptsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPageReceiptsResponse x -> ListPageReceiptsResponse
$cfrom :: forall x.
ListPageReceiptsResponse -> Rep ListPageReceiptsResponse x
Prelude.Generic)
newListPageReceiptsResponse ::
Prelude.Int ->
ListPageReceiptsResponse
Int
pHttpStatus_ =
ListPageReceiptsResponse'
{ $sel:nextToken:ListPageReceiptsResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:receipts:ListPageReceiptsResponse' :: Maybe [Receipt]
receipts = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListPageReceiptsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listPageReceiptsResponse_nextToken :: Lens.Lens' ListPageReceiptsResponse (Prelude.Maybe Prelude.Text)
= forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPageReceiptsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPageReceiptsResponse' :: ListPageReceiptsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPageReceiptsResponse
s@ListPageReceiptsResponse' {} Maybe Text
a -> ListPageReceiptsResponse
s {$sel:nextToken:ListPageReceiptsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListPageReceiptsResponse)
listPageReceiptsResponse_receipts :: Lens.Lens' ListPageReceiptsResponse (Prelude.Maybe [Receipt])
= forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPageReceiptsResponse' {Maybe [Receipt]
receipts :: Maybe [Receipt]
$sel:receipts:ListPageReceiptsResponse' :: ListPageReceiptsResponse -> Maybe [Receipt]
receipts} -> Maybe [Receipt]
receipts) (\s :: ListPageReceiptsResponse
s@ListPageReceiptsResponse' {} Maybe [Receipt]
a -> ListPageReceiptsResponse
s {$sel:receipts:ListPageReceiptsResponse' :: Maybe [Receipt]
receipts = Maybe [Receipt]
a} :: ListPageReceiptsResponse) 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
listPageReceiptsResponse_httpStatus :: Lens.Lens' ListPageReceiptsResponse Prelude.Int
= forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPageReceiptsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListPageReceiptsResponse' :: ListPageReceiptsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListPageReceiptsResponse
s@ListPageReceiptsResponse' {} Int
a -> ListPageReceiptsResponse
s {$sel:httpStatus:ListPageReceiptsResponse' :: Int
httpStatus = Int
a} :: ListPageReceiptsResponse)
instance Prelude.NFData ListPageReceiptsResponse where
rnf :: ListPageReceiptsResponse -> ()
rnf ListPageReceiptsResponse' {Int
Maybe [Receipt]
Maybe Text
httpStatus :: Int
receipts :: Maybe [Receipt]
nextToken :: Maybe Text
$sel:httpStatus:ListPageReceiptsResponse' :: ListPageReceiptsResponse -> Int
$sel:receipts:ListPageReceiptsResponse' :: ListPageReceiptsResponse -> Maybe [Receipt]
$sel:nextToken:ListPageReceiptsResponse' :: ListPageReceiptsResponse -> 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 Maybe [Receipt]
receipts
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus