{-# 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.Detective.ListMembers
(
ListMembers (..),
newListMembers,
listMembers_nextToken,
listMembers_maxResults,
listMembers_graphArn,
ListMembersResponse (..),
newListMembersResponse,
listMembersResponse_memberDetails,
listMembersResponse_nextToken,
listMembersResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Detective.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListMembers = ListMembers'
{
ListMembers -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListMembers -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListMembers -> Text
graphArn :: Prelude.Text
}
deriving (ListMembers -> ListMembers -> Bool
(ListMembers -> ListMembers -> Bool)
-> (ListMembers -> ListMembers -> Bool) -> Eq ListMembers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListMembers -> ListMembers -> Bool
$c/= :: ListMembers -> ListMembers -> Bool
== :: ListMembers -> ListMembers -> Bool
$c== :: ListMembers -> ListMembers -> Bool
Prelude.Eq, ReadPrec [ListMembers]
ReadPrec ListMembers
Int -> ReadS ListMembers
ReadS [ListMembers]
(Int -> ReadS ListMembers)
-> ReadS [ListMembers]
-> ReadPrec ListMembers
-> ReadPrec [ListMembers]
-> Read ListMembers
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListMembers]
$creadListPrec :: ReadPrec [ListMembers]
readPrec :: ReadPrec ListMembers
$creadPrec :: ReadPrec ListMembers
readList :: ReadS [ListMembers]
$creadList :: ReadS [ListMembers]
readsPrec :: Int -> ReadS ListMembers
$creadsPrec :: Int -> ReadS ListMembers
Prelude.Read, Int -> ListMembers -> ShowS
[ListMembers] -> ShowS
ListMembers -> String
(Int -> ListMembers -> ShowS)
-> (ListMembers -> String)
-> ([ListMembers] -> ShowS)
-> Show ListMembers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListMembers] -> ShowS
$cshowList :: [ListMembers] -> ShowS
show :: ListMembers -> String
$cshow :: ListMembers -> String
showsPrec :: Int -> ListMembers -> ShowS
$cshowsPrec :: Int -> ListMembers -> ShowS
Prelude.Show, (forall x. ListMembers -> Rep ListMembers x)
-> (forall x. Rep ListMembers x -> ListMembers)
-> Generic ListMembers
forall x. Rep ListMembers x -> ListMembers
forall x. ListMembers -> Rep ListMembers x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListMembers x -> ListMembers
$cfrom :: forall x. ListMembers -> Rep ListMembers x
Prelude.Generic)
newListMembers ::
Prelude.Text ->
ListMembers
newListMembers :: Text -> ListMembers
newListMembers Text
pGraphArn_ =
ListMembers' :: Maybe Text -> Maybe Natural -> Text -> ListMembers
ListMembers'
{ $sel:nextToken:ListMembers' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListMembers' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:graphArn:ListMembers' :: Text
graphArn = Text
pGraphArn_
}
listMembers_nextToken :: Lens.Lens' ListMembers (Prelude.Maybe Prelude.Text)
listMembers_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListMembers -> f ListMembers
listMembers_nextToken = (ListMembers -> Maybe Text)
-> (ListMembers -> Maybe Text -> ListMembers)
-> Lens ListMembers ListMembers (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMembers' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListMembers' :: ListMembers -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListMembers
s@ListMembers' {} Maybe Text
a -> ListMembers
s {$sel:nextToken:ListMembers' :: Maybe Text
nextToken = Maybe Text
a} :: ListMembers)
listMembers_maxResults :: Lens.Lens' ListMembers (Prelude.Maybe Prelude.Natural)
listMembers_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListMembers -> f ListMembers
listMembers_maxResults = (ListMembers -> Maybe Natural)
-> (ListMembers -> Maybe Natural -> ListMembers)
-> Lens ListMembers ListMembers (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMembers' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListMembers' :: ListMembers -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListMembers
s@ListMembers' {} Maybe Natural
a -> ListMembers
s {$sel:maxResults:ListMembers' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListMembers)
listMembers_graphArn :: Lens.Lens' ListMembers Prelude.Text
listMembers_graphArn :: (Text -> f Text) -> ListMembers -> f ListMembers
listMembers_graphArn = (ListMembers -> Text)
-> (ListMembers -> Text -> ListMembers)
-> Lens ListMembers ListMembers Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMembers' {Text
graphArn :: Text
$sel:graphArn:ListMembers' :: ListMembers -> Text
graphArn} -> Text
graphArn) (\s :: ListMembers
s@ListMembers' {} Text
a -> ListMembers
s {$sel:graphArn:ListMembers' :: Text
graphArn = Text
a} :: ListMembers)
instance Core.AWSRequest ListMembers where
type AWSResponse ListMembers = ListMembersResponse
request :: ListMembers -> Request ListMembers
request = Service -> ListMembers -> Request ListMembers
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListMembers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListMembers)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListMembers))
-> Logger
-> Service
-> Proxy ListMembers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListMembers)))
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 [MemberDetail] -> Maybe Text -> Int -> ListMembersResponse
ListMembersResponse'
(Maybe [MemberDetail] -> Maybe Text -> Int -> ListMembersResponse)
-> Either String (Maybe [MemberDetail])
-> Either String (Maybe Text -> Int -> ListMembersResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [MemberDetail]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"MemberDetails" Either String (Maybe (Maybe [MemberDetail]))
-> Maybe [MemberDetail] -> Either String (Maybe [MemberDetail])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [MemberDetail]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> ListMembersResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListMembersResponse)
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 -> ListMembersResponse)
-> Either String Int -> Either String ListMembersResponse
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 ListMembers
instance Prelude.NFData ListMembers
instance Core.ToHeaders ListMembers where
toHeaders :: ListMembers -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListMembers -> 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.ToJSON ListMembers where
toJSON :: ListMembers -> Value
toJSON ListMembers' {Maybe Natural
Maybe Text
Text
graphArn :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:graphArn:ListMembers' :: ListMembers -> Text
$sel:maxResults:ListMembers' :: ListMembers -> Maybe Natural
$sel:nextToken:ListMembers' :: ListMembers -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
(Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"GraphArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
graphArn)
]
)
instance Core.ToPath ListMembers where
toPath :: ListMembers -> ByteString
toPath = ByteString -> ListMembers -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/graph/members/list"
instance Core.ToQuery ListMembers where
toQuery :: ListMembers -> QueryString
toQuery = QueryString -> ListMembers -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListMembersResponse = ListMembersResponse'
{
ListMembersResponse -> Maybe [MemberDetail]
memberDetails :: Prelude.Maybe [MemberDetail],
ListMembersResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListMembersResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListMembersResponse -> ListMembersResponse -> Bool
(ListMembersResponse -> ListMembersResponse -> Bool)
-> (ListMembersResponse -> ListMembersResponse -> Bool)
-> Eq ListMembersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListMembersResponse -> ListMembersResponse -> Bool
$c/= :: ListMembersResponse -> ListMembersResponse -> Bool
== :: ListMembersResponse -> ListMembersResponse -> Bool
$c== :: ListMembersResponse -> ListMembersResponse -> Bool
Prelude.Eq, ReadPrec [ListMembersResponse]
ReadPrec ListMembersResponse
Int -> ReadS ListMembersResponse
ReadS [ListMembersResponse]
(Int -> ReadS ListMembersResponse)
-> ReadS [ListMembersResponse]
-> ReadPrec ListMembersResponse
-> ReadPrec [ListMembersResponse]
-> Read ListMembersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListMembersResponse]
$creadListPrec :: ReadPrec [ListMembersResponse]
readPrec :: ReadPrec ListMembersResponse
$creadPrec :: ReadPrec ListMembersResponse
readList :: ReadS [ListMembersResponse]
$creadList :: ReadS [ListMembersResponse]
readsPrec :: Int -> ReadS ListMembersResponse
$creadsPrec :: Int -> ReadS ListMembersResponse
Prelude.Read, Int -> ListMembersResponse -> ShowS
[ListMembersResponse] -> ShowS
ListMembersResponse -> String
(Int -> ListMembersResponse -> ShowS)
-> (ListMembersResponse -> String)
-> ([ListMembersResponse] -> ShowS)
-> Show ListMembersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListMembersResponse] -> ShowS
$cshowList :: [ListMembersResponse] -> ShowS
show :: ListMembersResponse -> String
$cshow :: ListMembersResponse -> String
showsPrec :: Int -> ListMembersResponse -> ShowS
$cshowsPrec :: Int -> ListMembersResponse -> ShowS
Prelude.Show, (forall x. ListMembersResponse -> Rep ListMembersResponse x)
-> (forall x. Rep ListMembersResponse x -> ListMembersResponse)
-> Generic ListMembersResponse
forall x. Rep ListMembersResponse x -> ListMembersResponse
forall x. ListMembersResponse -> Rep ListMembersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListMembersResponse x -> ListMembersResponse
$cfrom :: forall x. ListMembersResponse -> Rep ListMembersResponse x
Prelude.Generic)
newListMembersResponse ::
Prelude.Int ->
ListMembersResponse
newListMembersResponse :: Int -> ListMembersResponse
newListMembersResponse Int
pHttpStatus_ =
ListMembersResponse' :: Maybe [MemberDetail] -> Maybe Text -> Int -> ListMembersResponse
ListMembersResponse'
{ $sel:memberDetails:ListMembersResponse' :: Maybe [MemberDetail]
memberDetails =
Maybe [MemberDetail]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListMembersResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListMembersResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listMembersResponse_memberDetails :: Lens.Lens' ListMembersResponse (Prelude.Maybe [MemberDetail])
listMembersResponse_memberDetails :: (Maybe [MemberDetail] -> f (Maybe [MemberDetail]))
-> ListMembersResponse -> f ListMembersResponse
listMembersResponse_memberDetails = (ListMembersResponse -> Maybe [MemberDetail])
-> (ListMembersResponse
-> Maybe [MemberDetail] -> ListMembersResponse)
-> Lens
ListMembersResponse
ListMembersResponse
(Maybe [MemberDetail])
(Maybe [MemberDetail])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMembersResponse' {Maybe [MemberDetail]
memberDetails :: Maybe [MemberDetail]
$sel:memberDetails:ListMembersResponse' :: ListMembersResponse -> Maybe [MemberDetail]
memberDetails} -> Maybe [MemberDetail]
memberDetails) (\s :: ListMembersResponse
s@ListMembersResponse' {} Maybe [MemberDetail]
a -> ListMembersResponse
s {$sel:memberDetails:ListMembersResponse' :: Maybe [MemberDetail]
memberDetails = Maybe [MemberDetail]
a} :: ListMembersResponse) ((Maybe [MemberDetail] -> f (Maybe [MemberDetail]))
-> ListMembersResponse -> f ListMembersResponse)
-> ((Maybe [MemberDetail] -> f (Maybe [MemberDetail]))
-> Maybe [MemberDetail] -> f (Maybe [MemberDetail]))
-> (Maybe [MemberDetail] -> f (Maybe [MemberDetail]))
-> ListMembersResponse
-> f ListMembersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [MemberDetail] [MemberDetail] [MemberDetail] [MemberDetail]
-> Iso
(Maybe [MemberDetail])
(Maybe [MemberDetail])
(Maybe [MemberDetail])
(Maybe [MemberDetail])
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 [MemberDetail] [MemberDetail] [MemberDetail] [MemberDetail]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listMembersResponse_nextToken :: Lens.Lens' ListMembersResponse (Prelude.Maybe Prelude.Text)
listMembersResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListMembersResponse -> f ListMembersResponse
listMembersResponse_nextToken = (ListMembersResponse -> Maybe Text)
-> (ListMembersResponse -> Maybe Text -> ListMembersResponse)
-> Lens
ListMembersResponse ListMembersResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMembersResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListMembersResponse' :: ListMembersResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListMembersResponse
s@ListMembersResponse' {} Maybe Text
a -> ListMembersResponse
s {$sel:nextToken:ListMembersResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListMembersResponse)
listMembersResponse_httpStatus :: Lens.Lens' ListMembersResponse Prelude.Int
listMembersResponse_httpStatus :: (Int -> f Int) -> ListMembersResponse -> f ListMembersResponse
listMembersResponse_httpStatus = (ListMembersResponse -> Int)
-> (ListMembersResponse -> Int -> ListMembersResponse)
-> Lens ListMembersResponse ListMembersResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMembersResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListMembersResponse' :: ListMembersResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListMembersResponse
s@ListMembersResponse' {} Int
a -> ListMembersResponse
s {$sel:httpStatus:ListMembersResponse' :: Int
httpStatus = Int
a} :: ListMembersResponse)
instance Prelude.NFData ListMembersResponse