{-# 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.MacieV2.ListInvitations
(
ListInvitations (..),
newListInvitations,
listInvitations_nextToken,
listInvitations_maxResults,
ListInvitationsResponse (..),
newListInvitationsResponse,
listInvitationsResponse_invitations,
listInvitationsResponse_nextToken,
listInvitationsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MacieV2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListInvitations = ListInvitations'
{
ListInvitations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListInvitations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListInvitations -> ListInvitations -> Bool
(ListInvitations -> ListInvitations -> Bool)
-> (ListInvitations -> ListInvitations -> Bool)
-> Eq ListInvitations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListInvitations -> ListInvitations -> Bool
$c/= :: ListInvitations -> ListInvitations -> Bool
== :: ListInvitations -> ListInvitations -> Bool
$c== :: ListInvitations -> ListInvitations -> Bool
Prelude.Eq, ReadPrec [ListInvitations]
ReadPrec ListInvitations
Int -> ReadS ListInvitations
ReadS [ListInvitations]
(Int -> ReadS ListInvitations)
-> ReadS [ListInvitations]
-> ReadPrec ListInvitations
-> ReadPrec [ListInvitations]
-> Read ListInvitations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListInvitations]
$creadListPrec :: ReadPrec [ListInvitations]
readPrec :: ReadPrec ListInvitations
$creadPrec :: ReadPrec ListInvitations
readList :: ReadS [ListInvitations]
$creadList :: ReadS [ListInvitations]
readsPrec :: Int -> ReadS ListInvitations
$creadsPrec :: Int -> ReadS ListInvitations
Prelude.Read, Int -> ListInvitations -> ShowS
[ListInvitations] -> ShowS
ListInvitations -> String
(Int -> ListInvitations -> ShowS)
-> (ListInvitations -> String)
-> ([ListInvitations] -> ShowS)
-> Show ListInvitations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListInvitations] -> ShowS
$cshowList :: [ListInvitations] -> ShowS
show :: ListInvitations -> String
$cshow :: ListInvitations -> String
showsPrec :: Int -> ListInvitations -> ShowS
$cshowsPrec :: Int -> ListInvitations -> ShowS
Prelude.Show, (forall x. ListInvitations -> Rep ListInvitations x)
-> (forall x. Rep ListInvitations x -> ListInvitations)
-> Generic ListInvitations
forall x. Rep ListInvitations x -> ListInvitations
forall x. ListInvitations -> Rep ListInvitations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListInvitations x -> ListInvitations
$cfrom :: forall x. ListInvitations -> Rep ListInvitations x
Prelude.Generic)
newListInvitations ::
ListInvitations
newListInvitations :: ListInvitations
newListInvitations =
ListInvitations' :: Maybe Text -> Maybe Natural -> ListInvitations
ListInvitations'
{ $sel:nextToken:ListInvitations' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListInvitations' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listInvitations_nextToken :: Lens.Lens' ListInvitations (Prelude.Maybe Prelude.Text)
listInvitations_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListInvitations -> f ListInvitations
listInvitations_nextToken = (ListInvitations -> Maybe Text)
-> (ListInvitations -> Maybe Text -> ListInvitations)
-> Lens ListInvitations ListInvitations (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInvitations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListInvitations' :: ListInvitations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListInvitations
s@ListInvitations' {} Maybe Text
a -> ListInvitations
s {$sel:nextToken:ListInvitations' :: Maybe Text
nextToken = Maybe Text
a} :: ListInvitations)
listInvitations_maxResults :: Lens.Lens' ListInvitations (Prelude.Maybe Prelude.Natural)
listInvitations_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListInvitations -> f ListInvitations
listInvitations_maxResults = (ListInvitations -> Maybe Natural)
-> (ListInvitations -> Maybe Natural -> ListInvitations)
-> Lens
ListInvitations ListInvitations (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInvitations' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListInvitations' :: ListInvitations -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListInvitations
s@ListInvitations' {} Maybe Natural
a -> ListInvitations
s {$sel:maxResults:ListInvitations' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListInvitations)
instance Core.AWSPager ListInvitations where
page :: ListInvitations
-> AWSResponse ListInvitations -> Maybe ListInvitations
page ListInvitations
rq AWSResponse ListInvitations
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListInvitations
ListInvitationsResponse
rs
ListInvitationsResponse
-> Getting (First Text) ListInvitationsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListInvitationsResponse
-> Const (First Text) ListInvitationsResponse
Lens' ListInvitationsResponse (Maybe Text)
listInvitationsResponse_nextToken
((Maybe Text -> Const (First Text) (Maybe Text))
-> ListInvitationsResponse
-> Const (First Text) ListInvitationsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListInvitationsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListInvitations
forall a. Maybe a
Prelude.Nothing
| Maybe [Invitation] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListInvitations
ListInvitationsResponse
rs
ListInvitationsResponse
-> Getting
(First [Invitation]) ListInvitationsResponse [Invitation]
-> Maybe [Invitation]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Invitation]
-> Const (First [Invitation]) (Maybe [Invitation]))
-> ListInvitationsResponse
-> Const (First [Invitation]) ListInvitationsResponse
Lens' ListInvitationsResponse (Maybe [Invitation])
listInvitationsResponse_invitations
((Maybe [Invitation]
-> Const (First [Invitation]) (Maybe [Invitation]))
-> ListInvitationsResponse
-> Const (First [Invitation]) ListInvitationsResponse)
-> (([Invitation] -> Const (First [Invitation]) [Invitation])
-> Maybe [Invitation]
-> Const (First [Invitation]) (Maybe [Invitation]))
-> Getting
(First [Invitation]) ListInvitationsResponse [Invitation]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Invitation] -> Const (First [Invitation]) [Invitation])
-> Maybe [Invitation]
-> Const (First [Invitation]) (Maybe [Invitation])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListInvitations
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListInvitations -> Maybe ListInvitations
forall a. a -> Maybe a
Prelude.Just (ListInvitations -> Maybe ListInvitations)
-> ListInvitations -> Maybe ListInvitations
forall a b. (a -> b) -> a -> b
Prelude.$
ListInvitations
rq
ListInvitations
-> (ListInvitations -> ListInvitations) -> ListInvitations
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListInvitations -> Identity ListInvitations
Lens ListInvitations ListInvitations (Maybe Text) (Maybe Text)
listInvitations_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListInvitations -> Identity ListInvitations)
-> Maybe Text -> ListInvitations -> ListInvitations
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListInvitations
ListInvitationsResponse
rs
ListInvitationsResponse
-> Getting (First Text) ListInvitationsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListInvitationsResponse
-> Const (First Text) ListInvitationsResponse
Lens' ListInvitationsResponse (Maybe Text)
listInvitationsResponse_nextToken
((Maybe Text -> Const (First Text) (Maybe Text))
-> ListInvitationsResponse
-> Const (First Text) ListInvitationsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListInvitationsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListInvitations where
type
AWSResponse ListInvitations =
ListInvitationsResponse
request :: ListInvitations -> Request ListInvitations
request = Service -> ListInvitations -> Request ListInvitations
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListInvitations
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListInvitations)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListInvitations))
-> Logger
-> Service
-> Proxy ListInvitations
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListInvitations)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [Invitation] -> Maybe Text -> Int -> ListInvitationsResponse
ListInvitationsResponse'
(Maybe [Invitation]
-> Maybe Text -> Int -> ListInvitationsResponse)
-> Either String (Maybe [Invitation])
-> Either String (Maybe Text -> Int -> ListInvitationsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Invitation]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"invitations" Either String (Maybe (Maybe [Invitation]))
-> Maybe [Invitation] -> Either String (Maybe [Invitation])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Invitation]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> ListInvitationsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListInvitationsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
Either String (Int -> ListInvitationsResponse)
-> Either String Int -> Either String ListInvitationsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListInvitations
instance Prelude.NFData ListInvitations
instance Core.ToHeaders ListInvitations where
toHeaders :: ListInvitations -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListInvitations -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToPath ListInvitations where
toPath :: ListInvitations -> ByteString
toPath = ByteString -> ListInvitations -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/invitations"
instance Core.ToQuery ListInvitations where
toQuery :: ListInvitations -> QueryString
toQuery ListInvitations' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListInvitations' :: ListInvitations -> Maybe Natural
$sel:nextToken:ListInvitations' :: ListInvitations -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
]
data ListInvitationsResponse = ListInvitationsResponse'
{
ListInvitationsResponse -> Maybe [Invitation]
invitations :: Prelude.Maybe [Invitation],
ListInvitationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListInvitationsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListInvitationsResponse -> ListInvitationsResponse -> Bool
(ListInvitationsResponse -> ListInvitationsResponse -> Bool)
-> (ListInvitationsResponse -> ListInvitationsResponse -> Bool)
-> Eq ListInvitationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListInvitationsResponse -> ListInvitationsResponse -> Bool
$c/= :: ListInvitationsResponse -> ListInvitationsResponse -> Bool
== :: ListInvitationsResponse -> ListInvitationsResponse -> Bool
$c== :: ListInvitationsResponse -> ListInvitationsResponse -> Bool
Prelude.Eq, ReadPrec [ListInvitationsResponse]
ReadPrec ListInvitationsResponse
Int -> ReadS ListInvitationsResponse
ReadS [ListInvitationsResponse]
(Int -> ReadS ListInvitationsResponse)
-> ReadS [ListInvitationsResponse]
-> ReadPrec ListInvitationsResponse
-> ReadPrec [ListInvitationsResponse]
-> Read ListInvitationsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListInvitationsResponse]
$creadListPrec :: ReadPrec [ListInvitationsResponse]
readPrec :: ReadPrec ListInvitationsResponse
$creadPrec :: ReadPrec ListInvitationsResponse
readList :: ReadS [ListInvitationsResponse]
$creadList :: ReadS [ListInvitationsResponse]
readsPrec :: Int -> ReadS ListInvitationsResponse
$creadsPrec :: Int -> ReadS ListInvitationsResponse
Prelude.Read, Int -> ListInvitationsResponse -> ShowS
[ListInvitationsResponse] -> ShowS
ListInvitationsResponse -> String
(Int -> ListInvitationsResponse -> ShowS)
-> (ListInvitationsResponse -> String)
-> ([ListInvitationsResponse] -> ShowS)
-> Show ListInvitationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListInvitationsResponse] -> ShowS
$cshowList :: [ListInvitationsResponse] -> ShowS
show :: ListInvitationsResponse -> String
$cshow :: ListInvitationsResponse -> String
showsPrec :: Int -> ListInvitationsResponse -> ShowS
$cshowsPrec :: Int -> ListInvitationsResponse -> ShowS
Prelude.Show, (forall x.
ListInvitationsResponse -> Rep ListInvitationsResponse x)
-> (forall x.
Rep ListInvitationsResponse x -> ListInvitationsResponse)
-> Generic ListInvitationsResponse
forall x. Rep ListInvitationsResponse x -> ListInvitationsResponse
forall x. ListInvitationsResponse -> Rep ListInvitationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListInvitationsResponse x -> ListInvitationsResponse
$cfrom :: forall x. ListInvitationsResponse -> Rep ListInvitationsResponse x
Prelude.Generic)
newListInvitationsResponse ::
Prelude.Int ->
ListInvitationsResponse
newListInvitationsResponse :: Int -> ListInvitationsResponse
newListInvitationsResponse Int
pHttpStatus_ =
ListInvitationsResponse' :: Maybe [Invitation] -> Maybe Text -> Int -> ListInvitationsResponse
ListInvitationsResponse'
{ $sel:invitations:ListInvitationsResponse' :: Maybe [Invitation]
invitations =
Maybe [Invitation]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListInvitationsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListInvitationsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listInvitationsResponse_invitations :: Lens.Lens' ListInvitationsResponse (Prelude.Maybe [Invitation])
listInvitationsResponse_invitations :: (Maybe [Invitation] -> f (Maybe [Invitation]))
-> ListInvitationsResponse -> f ListInvitationsResponse
listInvitationsResponse_invitations = (ListInvitationsResponse -> Maybe [Invitation])
-> (ListInvitationsResponse
-> Maybe [Invitation] -> ListInvitationsResponse)
-> Lens' ListInvitationsResponse (Maybe [Invitation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInvitationsResponse' {Maybe [Invitation]
invitations :: Maybe [Invitation]
$sel:invitations:ListInvitationsResponse' :: ListInvitationsResponse -> Maybe [Invitation]
invitations} -> Maybe [Invitation]
invitations) (\s :: ListInvitationsResponse
s@ListInvitationsResponse' {} Maybe [Invitation]
a -> ListInvitationsResponse
s {$sel:invitations:ListInvitationsResponse' :: Maybe [Invitation]
invitations = Maybe [Invitation]
a} :: ListInvitationsResponse) ((Maybe [Invitation] -> f (Maybe [Invitation]))
-> ListInvitationsResponse -> f ListInvitationsResponse)
-> ((Maybe [Invitation] -> f (Maybe [Invitation]))
-> Maybe [Invitation] -> f (Maybe [Invitation]))
-> (Maybe [Invitation] -> f (Maybe [Invitation]))
-> ListInvitationsResponse
-> f ListInvitationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Invitation] [Invitation] [Invitation] [Invitation]
-> Iso
(Maybe [Invitation])
(Maybe [Invitation])
(Maybe [Invitation])
(Maybe [Invitation])
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 AnIso [Invitation] [Invitation] [Invitation] [Invitation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listInvitationsResponse_nextToken :: Lens.Lens' ListInvitationsResponse (Prelude.Maybe Prelude.Text)
listInvitationsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListInvitationsResponse -> f ListInvitationsResponse
listInvitationsResponse_nextToken = (ListInvitationsResponse -> Maybe Text)
-> (ListInvitationsResponse
-> Maybe Text -> ListInvitationsResponse)
-> Lens' ListInvitationsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInvitationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListInvitationsResponse' :: ListInvitationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListInvitationsResponse
s@ListInvitationsResponse' {} Maybe Text
a -> ListInvitationsResponse
s {$sel:nextToken:ListInvitationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListInvitationsResponse)
listInvitationsResponse_httpStatus :: Lens.Lens' ListInvitationsResponse Prelude.Int
listInvitationsResponse_httpStatus :: (Int -> f Int)
-> ListInvitationsResponse -> f ListInvitationsResponse
listInvitationsResponse_httpStatus = (ListInvitationsResponse -> Int)
-> (ListInvitationsResponse -> Int -> ListInvitationsResponse)
-> Lens ListInvitationsResponse ListInvitationsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInvitationsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListInvitationsResponse' :: ListInvitationsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListInvitationsResponse
s@ListInvitationsResponse' {} Int
a -> ListInvitationsResponse
s {$sel:httpStatus:ListInvitationsResponse' :: Int
httpStatus = Int
a} :: ListInvitationsResponse)
instance Prelude.NFData ListInvitationsResponse