{-# 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.ListAccountPermissions
(
ListAccountPermissions (..),
newListAccountPermissions,
listAccountPermissions_maxResults,
listAccountPermissions_nextToken,
listAccountPermissions_service,
ListAccountPermissionsResponse (..),
newListAccountPermissionsResponse,
listAccountPermissionsResponse_nextToken,
listAccountPermissionsResponse_httpStatus,
listAccountPermissionsResponse_permissions,
)
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 ListAccountPermissions = ListAccountPermissions'
{
ListAccountPermissions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListAccountPermissions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListAccountPermissions -> Maybe Service
service :: Prelude.Maybe Service
}
deriving (ListAccountPermissions -> ListAccountPermissions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccountPermissions -> ListAccountPermissions -> Bool
$c/= :: ListAccountPermissions -> ListAccountPermissions -> Bool
== :: ListAccountPermissions -> ListAccountPermissions -> Bool
$c== :: ListAccountPermissions -> ListAccountPermissions -> Bool
Prelude.Eq, ReadPrec [ListAccountPermissions]
ReadPrec ListAccountPermissions
Int -> ReadS ListAccountPermissions
ReadS [ListAccountPermissions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAccountPermissions]
$creadListPrec :: ReadPrec [ListAccountPermissions]
readPrec :: ReadPrec ListAccountPermissions
$creadPrec :: ReadPrec ListAccountPermissions
readList :: ReadS [ListAccountPermissions]
$creadList :: ReadS [ListAccountPermissions]
readsPrec :: Int -> ReadS ListAccountPermissions
$creadsPrec :: Int -> ReadS ListAccountPermissions
Prelude.Read, Int -> ListAccountPermissions -> ShowS
[ListAccountPermissions] -> ShowS
ListAccountPermissions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccountPermissions] -> ShowS
$cshowList :: [ListAccountPermissions] -> ShowS
show :: ListAccountPermissions -> String
$cshow :: ListAccountPermissions -> String
showsPrec :: Int -> ListAccountPermissions -> ShowS
$cshowsPrec :: Int -> ListAccountPermissions -> ShowS
Prelude.Show, forall x. Rep ListAccountPermissions x -> ListAccountPermissions
forall x. ListAccountPermissions -> Rep ListAccountPermissions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAccountPermissions x -> ListAccountPermissions
$cfrom :: forall x. ListAccountPermissions -> Rep ListAccountPermissions x
Prelude.Generic)
newListAccountPermissions ::
ListAccountPermissions
newListAccountPermissions :: ListAccountPermissions
newListAccountPermissions =
ListAccountPermissions'
{ $sel:maxResults:ListAccountPermissions' :: Maybe Natural
maxResults =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListAccountPermissions' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:service:ListAccountPermissions' :: Maybe Service
service = forall a. Maybe a
Prelude.Nothing
}
listAccountPermissions_maxResults :: Lens.Lens' ListAccountPermissions (Prelude.Maybe Prelude.Natural)
listAccountPermissions_maxResults :: Lens' ListAccountPermissions (Maybe Natural)
listAccountPermissions_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountPermissions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListAccountPermissions' :: ListAccountPermissions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListAccountPermissions
s@ListAccountPermissions' {} Maybe Natural
a -> ListAccountPermissions
s {$sel:maxResults:ListAccountPermissions' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListAccountPermissions)
listAccountPermissions_nextToken :: Lens.Lens' ListAccountPermissions (Prelude.Maybe Prelude.Text)
listAccountPermissions_nextToken :: Lens' ListAccountPermissions (Maybe Text)
listAccountPermissions_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountPermissions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAccountPermissions' :: ListAccountPermissions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAccountPermissions
s@ListAccountPermissions' {} Maybe Text
a -> ListAccountPermissions
s {$sel:nextToken:ListAccountPermissions' :: Maybe Text
nextToken = Maybe Text
a} :: ListAccountPermissions)
listAccountPermissions_service :: Lens.Lens' ListAccountPermissions (Prelude.Maybe Service)
listAccountPermissions_service :: Lens' ListAccountPermissions (Maybe Service)
listAccountPermissions_service = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountPermissions' {Maybe Service
service :: Maybe Service
$sel:service:ListAccountPermissions' :: ListAccountPermissions -> Maybe Service
service} -> Maybe Service
service) (\s :: ListAccountPermissions
s@ListAccountPermissions' {} Maybe Service
a -> ListAccountPermissions
s {$sel:service:ListAccountPermissions' :: Maybe Service
service = Maybe Service
a} :: ListAccountPermissions)
instance Core.AWSPager ListAccountPermissions where
page :: ListAccountPermissions
-> AWSResponse ListAccountPermissions
-> Maybe ListAccountPermissions
page ListAccountPermissions
rq AWSResponse ListAccountPermissions
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListAccountPermissions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAccountPermissionsResponse (Maybe Text)
listAccountPermissionsResponse_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 ListAccountPermissions
rs
forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListAccountPermissionsResponse [Permission]
listAccountPermissionsResponse_permissions
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListAccountPermissions
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListAccountPermissions (Maybe Text)
listAccountPermissions_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAccountPermissions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAccountPermissionsResponse (Maybe Text)
listAccountPermissionsResponse_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 ListAccountPermissions where
type
AWSResponse ListAccountPermissions =
ListAccountPermissionsResponse
request :: (Service -> Service)
-> ListAccountPermissions -> Request ListAccountPermissions
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 ListAccountPermissions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListAccountPermissions)))
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 -> [Permission] -> ListAccountPermissionsResponse
ListAccountPermissionsResponse'
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
"permissions" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListAccountPermissions where
hashWithSalt :: Int -> ListAccountPermissions -> Int
hashWithSalt Int
_salt ListAccountPermissions' {Maybe Natural
Maybe Text
Maybe Service
service :: Maybe Service
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:service:ListAccountPermissions' :: ListAccountPermissions -> Maybe Service
$sel:nextToken:ListAccountPermissions' :: ListAccountPermissions -> Maybe Text
$sel:maxResults:ListAccountPermissions' :: ListAccountPermissions -> 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 Service
service
instance Prelude.NFData ListAccountPermissions where
rnf :: ListAccountPermissions -> ()
rnf ListAccountPermissions' {Maybe Natural
Maybe Text
Maybe Service
service :: Maybe Service
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:service:ListAccountPermissions' :: ListAccountPermissions -> Maybe Service
$sel:nextToken:ListAccountPermissions' :: ListAccountPermissions -> Maybe Text
$sel:maxResults:ListAccountPermissions' :: ListAccountPermissions -> 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 Service
service
instance Data.ToHeaders ListAccountPermissions where
toHeaders :: ListAccountPermissions -> 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 ListAccountPermissions where
toJSON :: ListAccountPermissions -> Value
toJSON ListAccountPermissions' {Maybe Natural
Maybe Text
Maybe Service
service :: Maybe Service
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:service:ListAccountPermissions' :: ListAccountPermissions -> Maybe Service
$sel:nextToken:ListAccountPermissions' :: ListAccountPermissions -> Maybe Text
$sel:maxResults:ListAccountPermissions' :: ListAccountPermissions -> 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
"service" 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 Service
service
]
)
instance Data.ToPath ListAccountPermissions where
toPath :: ListAccountPermissions -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/accountpermissions/list"
instance Data.ToQuery ListAccountPermissions where
toQuery :: ListAccountPermissions -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListAccountPermissionsResponse = ListAccountPermissionsResponse'
{
ListAccountPermissionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListAccountPermissionsResponse -> Int
httpStatus :: Prelude.Int,
ListAccountPermissionsResponse -> [Permission]
permissions :: [Permission]
}
deriving (ListAccountPermissionsResponse
-> ListAccountPermissionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccountPermissionsResponse
-> ListAccountPermissionsResponse -> Bool
$c/= :: ListAccountPermissionsResponse
-> ListAccountPermissionsResponse -> Bool
== :: ListAccountPermissionsResponse
-> ListAccountPermissionsResponse -> Bool
$c== :: ListAccountPermissionsResponse
-> ListAccountPermissionsResponse -> Bool
Prelude.Eq, ReadPrec [ListAccountPermissionsResponse]
ReadPrec ListAccountPermissionsResponse
Int -> ReadS ListAccountPermissionsResponse
ReadS [ListAccountPermissionsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAccountPermissionsResponse]
$creadListPrec :: ReadPrec [ListAccountPermissionsResponse]
readPrec :: ReadPrec ListAccountPermissionsResponse
$creadPrec :: ReadPrec ListAccountPermissionsResponse
readList :: ReadS [ListAccountPermissionsResponse]
$creadList :: ReadS [ListAccountPermissionsResponse]
readsPrec :: Int -> ReadS ListAccountPermissionsResponse
$creadsPrec :: Int -> ReadS ListAccountPermissionsResponse
Prelude.Read, Int -> ListAccountPermissionsResponse -> ShowS
[ListAccountPermissionsResponse] -> ShowS
ListAccountPermissionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccountPermissionsResponse] -> ShowS
$cshowList :: [ListAccountPermissionsResponse] -> ShowS
show :: ListAccountPermissionsResponse -> String
$cshow :: ListAccountPermissionsResponse -> String
showsPrec :: Int -> ListAccountPermissionsResponse -> ShowS
$cshowsPrec :: Int -> ListAccountPermissionsResponse -> ShowS
Prelude.Show, forall x.
Rep ListAccountPermissionsResponse x
-> ListAccountPermissionsResponse
forall x.
ListAccountPermissionsResponse
-> Rep ListAccountPermissionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAccountPermissionsResponse x
-> ListAccountPermissionsResponse
$cfrom :: forall x.
ListAccountPermissionsResponse
-> Rep ListAccountPermissionsResponse x
Prelude.Generic)
newListAccountPermissionsResponse ::
Prelude.Int ->
ListAccountPermissionsResponse
newListAccountPermissionsResponse :: Int -> ListAccountPermissionsResponse
newListAccountPermissionsResponse Int
pHttpStatus_ =
ListAccountPermissionsResponse'
{ $sel:nextToken:ListAccountPermissionsResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListAccountPermissionsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:permissions:ListAccountPermissionsResponse' :: [Permission]
permissions = forall a. Monoid a => a
Prelude.mempty
}
listAccountPermissionsResponse_nextToken :: Lens.Lens' ListAccountPermissionsResponse (Prelude.Maybe Prelude.Text)
listAccountPermissionsResponse_nextToken :: Lens' ListAccountPermissionsResponse (Maybe Text)
listAccountPermissionsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountPermissionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAccountPermissionsResponse' :: ListAccountPermissionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAccountPermissionsResponse
s@ListAccountPermissionsResponse' {} Maybe Text
a -> ListAccountPermissionsResponse
s {$sel:nextToken:ListAccountPermissionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAccountPermissionsResponse)
listAccountPermissionsResponse_httpStatus :: Lens.Lens' ListAccountPermissionsResponse Prelude.Int
listAccountPermissionsResponse_httpStatus :: Lens' ListAccountPermissionsResponse Int
listAccountPermissionsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountPermissionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListAccountPermissionsResponse' :: ListAccountPermissionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListAccountPermissionsResponse
s@ListAccountPermissionsResponse' {} Int
a -> ListAccountPermissionsResponse
s {$sel:httpStatus:ListAccountPermissionsResponse' :: Int
httpStatus = Int
a} :: ListAccountPermissionsResponse)
listAccountPermissionsResponse_permissions :: Lens.Lens' ListAccountPermissionsResponse [Permission]
listAccountPermissionsResponse_permissions :: Lens' ListAccountPermissionsResponse [Permission]
listAccountPermissionsResponse_permissions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountPermissionsResponse' {[Permission]
permissions :: [Permission]
$sel:permissions:ListAccountPermissionsResponse' :: ListAccountPermissionsResponse -> [Permission]
permissions} -> [Permission]
permissions) (\s :: ListAccountPermissionsResponse
s@ListAccountPermissionsResponse' {} [Permission]
a -> ListAccountPermissionsResponse
s {$sel:permissions:ListAccountPermissionsResponse' :: [Permission]
permissions = [Permission]
a} :: ListAccountPermissionsResponse) 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
ListAccountPermissionsResponse
where
rnf :: ListAccountPermissionsResponse -> ()
rnf ListAccountPermissionsResponse' {Int
[Permission]
Maybe Text
permissions :: [Permission]
httpStatus :: Int
nextToken :: Maybe Text
$sel:permissions:ListAccountPermissionsResponse' :: ListAccountPermissionsResponse -> [Permission]
$sel:httpStatus:ListAccountPermissionsResponse' :: ListAccountPermissionsResponse -> Int
$sel:nextToken:ListAccountPermissionsResponse' :: ListAccountPermissionsResponse -> 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 [Permission]
permissions