{-# 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.ListPagesByContact
(
ListPagesByContact (..),
newListPagesByContact,
listPagesByContact_maxResults,
listPagesByContact_nextToken,
listPagesByContact_contactId,
ListPagesByContactResponse (..),
newListPagesByContactResponse,
listPagesByContactResponse_nextToken,
listPagesByContactResponse_httpStatus,
listPagesByContactResponse_pages,
)
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 ListPagesByContact = ListPagesByContact'
{
ListPagesByContact -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListPagesByContact -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListPagesByContact -> Text
contactId :: Prelude.Text
}
deriving (ListPagesByContact -> ListPagesByContact -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPagesByContact -> ListPagesByContact -> Bool
$c/= :: ListPagesByContact -> ListPagesByContact -> Bool
== :: ListPagesByContact -> ListPagesByContact -> Bool
$c== :: ListPagesByContact -> ListPagesByContact -> Bool
Prelude.Eq, ReadPrec [ListPagesByContact]
ReadPrec ListPagesByContact
Int -> ReadS ListPagesByContact
ReadS [ListPagesByContact]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPagesByContact]
$creadListPrec :: ReadPrec [ListPagesByContact]
readPrec :: ReadPrec ListPagesByContact
$creadPrec :: ReadPrec ListPagesByContact
readList :: ReadS [ListPagesByContact]
$creadList :: ReadS [ListPagesByContact]
readsPrec :: Int -> ReadS ListPagesByContact
$creadsPrec :: Int -> ReadS ListPagesByContact
Prelude.Read, Int -> ListPagesByContact -> ShowS
[ListPagesByContact] -> ShowS
ListPagesByContact -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPagesByContact] -> ShowS
$cshowList :: [ListPagesByContact] -> ShowS
show :: ListPagesByContact -> String
$cshow :: ListPagesByContact -> String
showsPrec :: Int -> ListPagesByContact -> ShowS
$cshowsPrec :: Int -> ListPagesByContact -> ShowS
Prelude.Show, forall x. Rep ListPagesByContact x -> ListPagesByContact
forall x. ListPagesByContact -> Rep ListPagesByContact x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPagesByContact x -> ListPagesByContact
$cfrom :: forall x. ListPagesByContact -> Rep ListPagesByContact x
Prelude.Generic)
newListPagesByContact ::
Prelude.Text ->
ListPagesByContact
newListPagesByContact :: Text -> ListPagesByContact
newListPagesByContact Text
pContactId_ =
ListPagesByContact'
{ $sel:maxResults:ListPagesByContact' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListPagesByContact' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:contactId:ListPagesByContact' :: Text
contactId = Text
pContactId_
}
listPagesByContact_maxResults :: Lens.Lens' ListPagesByContact (Prelude.Maybe Prelude.Natural)
listPagesByContact_maxResults :: Lens' ListPagesByContact (Maybe Natural)
listPagesByContact_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPagesByContact' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListPagesByContact' :: ListPagesByContact -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListPagesByContact
s@ListPagesByContact' {} Maybe Natural
a -> ListPagesByContact
s {$sel:maxResults:ListPagesByContact' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListPagesByContact)
listPagesByContact_nextToken :: Lens.Lens' ListPagesByContact (Prelude.Maybe Prelude.Text)
listPagesByContact_nextToken :: Lens' ListPagesByContact (Maybe Text)
listPagesByContact_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPagesByContact' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPagesByContact' :: ListPagesByContact -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPagesByContact
s@ListPagesByContact' {} Maybe Text
a -> ListPagesByContact
s {$sel:nextToken:ListPagesByContact' :: Maybe Text
nextToken = Maybe Text
a} :: ListPagesByContact)
listPagesByContact_contactId :: Lens.Lens' ListPagesByContact Prelude.Text
listPagesByContact_contactId :: Lens' ListPagesByContact Text
listPagesByContact_contactId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPagesByContact' {Text
contactId :: Text
$sel:contactId:ListPagesByContact' :: ListPagesByContact -> Text
contactId} -> Text
contactId) (\s :: ListPagesByContact
s@ListPagesByContact' {} Text
a -> ListPagesByContact
s {$sel:contactId:ListPagesByContact' :: Text
contactId = Text
a} :: ListPagesByContact)
instance Core.AWSPager ListPagesByContact where
page :: ListPagesByContact
-> AWSResponse ListPagesByContact -> Maybe ListPagesByContact
page ListPagesByContact
rq AWSResponse ListPagesByContact
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListPagesByContact
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPagesByContactResponse (Maybe Text)
listPagesByContactResponse_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 ListPagesByContact
rs forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListPagesByContactResponse [Page]
listPagesByContactResponse_pages) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListPagesByContact
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListPagesByContact (Maybe Text)
listPagesByContact_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListPagesByContact
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPagesByContactResponse (Maybe Text)
listPagesByContactResponse_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 ListPagesByContact where
type
AWSResponse ListPagesByContact =
ListPagesByContactResponse
request :: (Service -> Service)
-> ListPagesByContact -> Request ListPagesByContact
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 ListPagesByContact
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListPagesByContact)))
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 -> [Page] -> ListPagesByContactResponse
ListPagesByContactResponse'
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
"Pages" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListPagesByContact where
hashWithSalt :: Int -> ListPagesByContact -> Int
hashWithSalt Int
_salt ListPagesByContact' {Maybe Natural
Maybe Text
Text
contactId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:contactId:ListPagesByContact' :: ListPagesByContact -> Text
$sel:nextToken:ListPagesByContact' :: ListPagesByContact -> Maybe Text
$sel:maxResults:ListPagesByContact' :: ListPagesByContact -> 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
contactId
instance Prelude.NFData ListPagesByContact where
rnf :: ListPagesByContact -> ()
rnf ListPagesByContact' {Maybe Natural
Maybe Text
Text
contactId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:contactId:ListPagesByContact' :: ListPagesByContact -> Text
$sel:nextToken:ListPagesByContact' :: ListPagesByContact -> Maybe Text
$sel:maxResults:ListPagesByContact' :: ListPagesByContact -> 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
contactId
instance Data.ToHeaders ListPagesByContact where
toHeaders :: ListPagesByContact -> 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.ListPagesByContact" ::
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 ListPagesByContact where
toJSON :: ListPagesByContact -> Value
toJSON ListPagesByContact' {Maybe Natural
Maybe Text
Text
contactId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:contactId:ListPagesByContact' :: ListPagesByContact -> Text
$sel:nextToken:ListPagesByContact' :: ListPagesByContact -> Maybe Text
$sel:maxResults:ListPagesByContact' :: ListPagesByContact -> 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
"ContactId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
contactId)
]
)
instance Data.ToPath ListPagesByContact where
toPath :: ListPagesByContact -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListPagesByContact where
toQuery :: ListPagesByContact -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListPagesByContactResponse = ListPagesByContactResponse'
{
ListPagesByContactResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListPagesByContactResponse -> Int
httpStatus :: Prelude.Int,
ListPagesByContactResponse -> [Page]
pages :: [Page]
}
deriving (ListPagesByContactResponse -> ListPagesByContactResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPagesByContactResponse -> ListPagesByContactResponse -> Bool
$c/= :: ListPagesByContactResponse -> ListPagesByContactResponse -> Bool
== :: ListPagesByContactResponse -> ListPagesByContactResponse -> Bool
$c== :: ListPagesByContactResponse -> ListPagesByContactResponse -> Bool
Prelude.Eq, ReadPrec [ListPagesByContactResponse]
ReadPrec ListPagesByContactResponse
Int -> ReadS ListPagesByContactResponse
ReadS [ListPagesByContactResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPagesByContactResponse]
$creadListPrec :: ReadPrec [ListPagesByContactResponse]
readPrec :: ReadPrec ListPagesByContactResponse
$creadPrec :: ReadPrec ListPagesByContactResponse
readList :: ReadS [ListPagesByContactResponse]
$creadList :: ReadS [ListPagesByContactResponse]
readsPrec :: Int -> ReadS ListPagesByContactResponse
$creadsPrec :: Int -> ReadS ListPagesByContactResponse
Prelude.Read, Int -> ListPagesByContactResponse -> ShowS
[ListPagesByContactResponse] -> ShowS
ListPagesByContactResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPagesByContactResponse] -> ShowS
$cshowList :: [ListPagesByContactResponse] -> ShowS
show :: ListPagesByContactResponse -> String
$cshow :: ListPagesByContactResponse -> String
showsPrec :: Int -> ListPagesByContactResponse -> ShowS
$cshowsPrec :: Int -> ListPagesByContactResponse -> ShowS
Prelude.Show, forall x.
Rep ListPagesByContactResponse x -> ListPagesByContactResponse
forall x.
ListPagesByContactResponse -> Rep ListPagesByContactResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPagesByContactResponse x -> ListPagesByContactResponse
$cfrom :: forall x.
ListPagesByContactResponse -> Rep ListPagesByContactResponse x
Prelude.Generic)
newListPagesByContactResponse ::
Prelude.Int ->
ListPagesByContactResponse
newListPagesByContactResponse :: Int -> ListPagesByContactResponse
newListPagesByContactResponse Int
pHttpStatus_ =
ListPagesByContactResponse'
{ $sel:nextToken:ListPagesByContactResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListPagesByContactResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:pages:ListPagesByContactResponse' :: [Page]
pages = forall a. Monoid a => a
Prelude.mempty
}
listPagesByContactResponse_nextToken :: Lens.Lens' ListPagesByContactResponse (Prelude.Maybe Prelude.Text)
listPagesByContactResponse_nextToken :: Lens' ListPagesByContactResponse (Maybe Text)
listPagesByContactResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPagesByContactResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPagesByContactResponse' :: ListPagesByContactResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPagesByContactResponse
s@ListPagesByContactResponse' {} Maybe Text
a -> ListPagesByContactResponse
s {$sel:nextToken:ListPagesByContactResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListPagesByContactResponse)
listPagesByContactResponse_httpStatus :: Lens.Lens' ListPagesByContactResponse Prelude.Int
listPagesByContactResponse_httpStatus :: Lens' ListPagesByContactResponse Int
listPagesByContactResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPagesByContactResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListPagesByContactResponse' :: ListPagesByContactResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListPagesByContactResponse
s@ListPagesByContactResponse' {} Int
a -> ListPagesByContactResponse
s {$sel:httpStatus:ListPagesByContactResponse' :: Int
httpStatus = Int
a} :: ListPagesByContactResponse)
listPagesByContactResponse_pages :: Lens.Lens' ListPagesByContactResponse [Page]
listPagesByContactResponse_pages :: Lens' ListPagesByContactResponse [Page]
listPagesByContactResponse_pages = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPagesByContactResponse' {[Page]
pages :: [Page]
$sel:pages:ListPagesByContactResponse' :: ListPagesByContactResponse -> [Page]
pages} -> [Page]
pages) (\s :: ListPagesByContactResponse
s@ListPagesByContactResponse' {} [Page]
a -> ListPagesByContactResponse
s {$sel:pages:ListPagesByContactResponse' :: [Page]
pages = [Page]
a} :: ListPagesByContactResponse) 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 ListPagesByContactResponse where
rnf :: ListPagesByContactResponse -> ()
rnf ListPagesByContactResponse' {Int
[Page]
Maybe Text
pages :: [Page]
httpStatus :: Int
nextToken :: Maybe Text
$sel:pages:ListPagesByContactResponse' :: ListPagesByContactResponse -> [Page]
$sel:httpStatus:ListPagesByContactResponse' :: ListPagesByContactResponse -> Int
$sel:nextToken:ListPagesByContactResponse' :: ListPagesByContactResponse -> 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 [Page]
pages