{-# 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.Inspector2.ListMembers
(
ListMembers (..),
newListMembers,
listMembers_maxResults,
listMembers_nextToken,
listMembers_onlyAssociated,
ListMembersResponse (..),
newListMembersResponse,
listMembersResponse_members,
listMembersResponse_nextToken,
listMembersResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Inspector2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListMembers = ListMembers'
{
ListMembers -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListMembers -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListMembers -> Maybe Bool
onlyAssociated :: Prelude.Maybe Prelude.Bool
}
deriving (ListMembers -> ListMembers -> Bool
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]
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
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. 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 ::
ListMembers
newListMembers :: ListMembers
newListMembers =
ListMembers'
{ $sel:maxResults:ListMembers' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListMembers' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:onlyAssociated:ListMembers' :: Maybe Bool
onlyAssociated = forall a. Maybe a
Prelude.Nothing
}
listMembers_maxResults :: Lens.Lens' ListMembers (Prelude.Maybe Prelude.Natural)
listMembers_maxResults :: Lens' ListMembers (Maybe Natural)
listMembers_maxResults = 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_nextToken :: Lens.Lens' ListMembers (Prelude.Maybe Prelude.Text)
listMembers_nextToken :: Lens' ListMembers (Maybe Text)
listMembers_nextToken = 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_onlyAssociated :: Lens.Lens' ListMembers (Prelude.Maybe Prelude.Bool)
listMembers_onlyAssociated :: Lens' ListMembers (Maybe Bool)
listMembers_onlyAssociated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMembers' {Maybe Bool
onlyAssociated :: Maybe Bool
$sel:onlyAssociated:ListMembers' :: ListMembers -> Maybe Bool
onlyAssociated} -> Maybe Bool
onlyAssociated) (\s :: ListMembers
s@ListMembers' {} Maybe Bool
a -> ListMembers
s {$sel:onlyAssociated:ListMembers' :: Maybe Bool
onlyAssociated = Maybe Bool
a} :: ListMembers)
instance Core.AWSPager ListMembers where
page :: ListMembers -> AWSResponse ListMembers -> Maybe ListMembers
page ListMembers
rq AWSResponse ListMembers
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListMembers
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListMembersResponse (Maybe Text)
listMembersResponse_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 ListMembers
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListMembersResponse (Maybe [Member])
listMembersResponse_members
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.$ ListMembers
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListMembers (Maybe Text)
listMembers_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListMembers
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListMembersResponse (Maybe Text)
listMembersResponse_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 ListMembers where
type AWSResponse ListMembers = ListMembersResponse
request :: (Service -> Service) -> ListMembers -> Request ListMembers
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 ListMembers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListMembers)))
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 [Member] -> Maybe Text -> Int -> ListMembersResponse
ListMembersResponse'
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
"members" 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.<*> (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))
)
instance Prelude.Hashable ListMembers where
hashWithSalt :: Int -> ListMembers -> Int
hashWithSalt Int
_salt ListMembers' {Maybe Bool
Maybe Natural
Maybe Text
onlyAssociated :: Maybe Bool
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:onlyAssociated:ListMembers' :: ListMembers -> Maybe Bool
$sel:nextToken:ListMembers' :: ListMembers -> Maybe Text
$sel:maxResults:ListMembers' :: ListMembers -> 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` Maybe Bool
onlyAssociated
instance Prelude.NFData ListMembers where
rnf :: ListMembers -> ()
rnf ListMembers' {Maybe Bool
Maybe Natural
Maybe Text
onlyAssociated :: Maybe Bool
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:onlyAssociated:ListMembers' :: ListMembers -> Maybe Bool
$sel:nextToken:ListMembers' :: ListMembers -> Maybe Text
$sel:maxResults:ListMembers' :: ListMembers -> 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 Maybe Bool
onlyAssociated
instance Data.ToHeaders ListMembers where
toHeaders :: ListMembers -> 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 ListMembers where
toJSON :: ListMembers -> Value
toJSON ListMembers' {Maybe Bool
Maybe Natural
Maybe Text
onlyAssociated :: Maybe Bool
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:onlyAssociated:ListMembers' :: ListMembers -> Maybe Bool
$sel:nextToken:ListMembers' :: ListMembers -> Maybe Text
$sel:maxResults:ListMembers' :: ListMembers -> 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,
(Key
"onlyAssociated" 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 Bool
onlyAssociated
]
)
instance Data.ToPath ListMembers where
toPath :: ListMembers -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/members/list"
instance Data.ToQuery ListMembers where
toQuery :: ListMembers -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListMembersResponse = ListMembersResponse'
{
ListMembersResponse -> Maybe [Member]
members :: Prelude.Maybe [Member],
ListMembersResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListMembersResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListMembersResponse -> ListMembersResponse -> Bool
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]
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
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. 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'
{ $sel:members:ListMembersResponse' :: Maybe [Member]
members = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListMembersResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListMembersResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listMembersResponse_members :: Lens.Lens' ListMembersResponse (Prelude.Maybe [Member])
listMembersResponse_members :: Lens' ListMembersResponse (Maybe [Member])
listMembersResponse_members = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMembersResponse' {Maybe [Member]
members :: Maybe [Member]
$sel:members:ListMembersResponse' :: ListMembersResponse -> Maybe [Member]
members} -> Maybe [Member]
members) (\s :: ListMembersResponse
s@ListMembersResponse' {} Maybe [Member]
a -> ListMembersResponse
s {$sel:members:ListMembersResponse' :: Maybe [Member]
members = Maybe [Member]
a} :: ListMembersResponse) 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
listMembersResponse_nextToken :: Lens.Lens' ListMembersResponse (Prelude.Maybe Prelude.Text)
listMembersResponse_nextToken :: Lens' ListMembersResponse (Maybe Text)
listMembersResponse_nextToken = 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 :: Lens' ListMembersResponse Int
listMembersResponse_httpStatus = 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 where
rnf :: ListMembersResponse -> ()
rnf ListMembersResponse' {Int
Maybe [Member]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
members :: Maybe [Member]
$sel:httpStatus:ListMembersResponse' :: ListMembersResponse -> Int
$sel:nextToken:ListMembersResponse' :: ListMembersResponse -> Maybe Text
$sel:members:ListMembersResponse' :: ListMembersResponse -> Maybe [Member]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Member]
members
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 Int
httpStatus