{-# 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.WorkMail.ListImpersonationRoles
(
ListImpersonationRoles (..),
newListImpersonationRoles,
listImpersonationRoles_maxResults,
listImpersonationRoles_nextToken,
listImpersonationRoles_organizationId,
ListImpersonationRolesResponse (..),
newListImpersonationRolesResponse,
listImpersonationRolesResponse_nextToken,
listImpersonationRolesResponse_roles,
listImpersonationRolesResponse_httpStatus,
)
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.WorkMail.Types
data ListImpersonationRoles = ListImpersonationRoles'
{
ListImpersonationRoles -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListImpersonationRoles -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListImpersonationRoles -> Text
organizationId :: Prelude.Text
}
deriving (ListImpersonationRoles -> ListImpersonationRoles -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListImpersonationRoles -> ListImpersonationRoles -> Bool
$c/= :: ListImpersonationRoles -> ListImpersonationRoles -> Bool
== :: ListImpersonationRoles -> ListImpersonationRoles -> Bool
$c== :: ListImpersonationRoles -> ListImpersonationRoles -> Bool
Prelude.Eq, ReadPrec [ListImpersonationRoles]
ReadPrec ListImpersonationRoles
Int -> ReadS ListImpersonationRoles
ReadS [ListImpersonationRoles]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListImpersonationRoles]
$creadListPrec :: ReadPrec [ListImpersonationRoles]
readPrec :: ReadPrec ListImpersonationRoles
$creadPrec :: ReadPrec ListImpersonationRoles
readList :: ReadS [ListImpersonationRoles]
$creadList :: ReadS [ListImpersonationRoles]
readsPrec :: Int -> ReadS ListImpersonationRoles
$creadsPrec :: Int -> ReadS ListImpersonationRoles
Prelude.Read, Int -> ListImpersonationRoles -> ShowS
[ListImpersonationRoles] -> ShowS
ListImpersonationRoles -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListImpersonationRoles] -> ShowS
$cshowList :: [ListImpersonationRoles] -> ShowS
show :: ListImpersonationRoles -> String
$cshow :: ListImpersonationRoles -> String
showsPrec :: Int -> ListImpersonationRoles -> ShowS
$cshowsPrec :: Int -> ListImpersonationRoles -> ShowS
Prelude.Show, forall x. Rep ListImpersonationRoles x -> ListImpersonationRoles
forall x. ListImpersonationRoles -> Rep ListImpersonationRoles x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListImpersonationRoles x -> ListImpersonationRoles
$cfrom :: forall x. ListImpersonationRoles -> Rep ListImpersonationRoles x
Prelude.Generic)
newListImpersonationRoles ::
Prelude.Text ->
ListImpersonationRoles
newListImpersonationRoles :: Text -> ListImpersonationRoles
newListImpersonationRoles Text
pOrganizationId_ =
ListImpersonationRoles'
{ $sel:maxResults:ListImpersonationRoles' :: Maybe Natural
maxResults =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListImpersonationRoles' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:organizationId:ListImpersonationRoles' :: Text
organizationId = Text
pOrganizationId_
}
listImpersonationRoles_maxResults :: Lens.Lens' ListImpersonationRoles (Prelude.Maybe Prelude.Natural)
listImpersonationRoles_maxResults :: Lens' ListImpersonationRoles (Maybe Natural)
listImpersonationRoles_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListImpersonationRoles' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListImpersonationRoles' :: ListImpersonationRoles -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListImpersonationRoles
s@ListImpersonationRoles' {} Maybe Natural
a -> ListImpersonationRoles
s {$sel:maxResults:ListImpersonationRoles' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListImpersonationRoles)
listImpersonationRoles_nextToken :: Lens.Lens' ListImpersonationRoles (Prelude.Maybe Prelude.Text)
listImpersonationRoles_nextToken :: Lens' ListImpersonationRoles (Maybe Text)
listImpersonationRoles_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListImpersonationRoles' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListImpersonationRoles' :: ListImpersonationRoles -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListImpersonationRoles
s@ListImpersonationRoles' {} Maybe Text
a -> ListImpersonationRoles
s {$sel:nextToken:ListImpersonationRoles' :: Maybe Text
nextToken = Maybe Text
a} :: ListImpersonationRoles)
listImpersonationRoles_organizationId :: Lens.Lens' ListImpersonationRoles Prelude.Text
listImpersonationRoles_organizationId :: Lens' ListImpersonationRoles Text
listImpersonationRoles_organizationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListImpersonationRoles' {Text
organizationId :: Text
$sel:organizationId:ListImpersonationRoles' :: ListImpersonationRoles -> Text
organizationId} -> Text
organizationId) (\s :: ListImpersonationRoles
s@ListImpersonationRoles' {} Text
a -> ListImpersonationRoles
s {$sel:organizationId:ListImpersonationRoles' :: Text
organizationId = Text
a} :: ListImpersonationRoles)
instance Core.AWSRequest ListImpersonationRoles where
type
AWSResponse ListImpersonationRoles =
ListImpersonationRolesResponse
request :: (Service -> Service)
-> ListImpersonationRoles -> Request ListImpersonationRoles
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 ListImpersonationRoles
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListImpersonationRoles)))
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
-> Maybe [ImpersonationRole]
-> Int
-> ListImpersonationRolesResponse
ListImpersonationRolesResponse'
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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Roles" 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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListImpersonationRoles where
hashWithSalt :: Int -> ListImpersonationRoles -> Int
hashWithSalt Int
_salt ListImpersonationRoles' {Maybe Natural
Maybe Text
Text
organizationId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:organizationId:ListImpersonationRoles' :: ListImpersonationRoles -> Text
$sel:nextToken:ListImpersonationRoles' :: ListImpersonationRoles -> Maybe Text
$sel:maxResults:ListImpersonationRoles' :: ListImpersonationRoles -> 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
organizationId
instance Prelude.NFData ListImpersonationRoles where
rnf :: ListImpersonationRoles -> ()
rnf ListImpersonationRoles' {Maybe Natural
Maybe Text
Text
organizationId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:organizationId:ListImpersonationRoles' :: ListImpersonationRoles -> Text
$sel:nextToken:ListImpersonationRoles' :: ListImpersonationRoles -> Maybe Text
$sel:maxResults:ListImpersonationRoles' :: ListImpersonationRoles -> 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
organizationId
instance Data.ToHeaders ListImpersonationRoles where
toHeaders :: ListImpersonationRoles -> 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
"WorkMailService.ListImpersonationRoles" ::
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 ListImpersonationRoles where
toJSON :: ListImpersonationRoles -> Value
toJSON ListImpersonationRoles' {Maybe Natural
Maybe Text
Text
organizationId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:organizationId:ListImpersonationRoles' :: ListImpersonationRoles -> Text
$sel:nextToken:ListImpersonationRoles' :: ListImpersonationRoles -> Maybe Text
$sel:maxResults:ListImpersonationRoles' :: ListImpersonationRoles -> 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
"OrganizationId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
organizationId)
]
)
instance Data.ToPath ListImpersonationRoles where
toPath :: ListImpersonationRoles -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListImpersonationRoles where
toQuery :: ListImpersonationRoles -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListImpersonationRolesResponse = ListImpersonationRolesResponse'
{
ListImpersonationRolesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListImpersonationRolesResponse -> Maybe [ImpersonationRole]
roles :: Prelude.Maybe [ImpersonationRole],
ListImpersonationRolesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListImpersonationRolesResponse
-> ListImpersonationRolesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListImpersonationRolesResponse
-> ListImpersonationRolesResponse -> Bool
$c/= :: ListImpersonationRolesResponse
-> ListImpersonationRolesResponse -> Bool
== :: ListImpersonationRolesResponse
-> ListImpersonationRolesResponse -> Bool
$c== :: ListImpersonationRolesResponse
-> ListImpersonationRolesResponse -> Bool
Prelude.Eq, ReadPrec [ListImpersonationRolesResponse]
ReadPrec ListImpersonationRolesResponse
Int -> ReadS ListImpersonationRolesResponse
ReadS [ListImpersonationRolesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListImpersonationRolesResponse]
$creadListPrec :: ReadPrec [ListImpersonationRolesResponse]
readPrec :: ReadPrec ListImpersonationRolesResponse
$creadPrec :: ReadPrec ListImpersonationRolesResponse
readList :: ReadS [ListImpersonationRolesResponse]
$creadList :: ReadS [ListImpersonationRolesResponse]
readsPrec :: Int -> ReadS ListImpersonationRolesResponse
$creadsPrec :: Int -> ReadS ListImpersonationRolesResponse
Prelude.Read, Int -> ListImpersonationRolesResponse -> ShowS
[ListImpersonationRolesResponse] -> ShowS
ListImpersonationRolesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListImpersonationRolesResponse] -> ShowS
$cshowList :: [ListImpersonationRolesResponse] -> ShowS
show :: ListImpersonationRolesResponse -> String
$cshow :: ListImpersonationRolesResponse -> String
showsPrec :: Int -> ListImpersonationRolesResponse -> ShowS
$cshowsPrec :: Int -> ListImpersonationRolesResponse -> ShowS
Prelude.Show, forall x.
Rep ListImpersonationRolesResponse x
-> ListImpersonationRolesResponse
forall x.
ListImpersonationRolesResponse
-> Rep ListImpersonationRolesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListImpersonationRolesResponse x
-> ListImpersonationRolesResponse
$cfrom :: forall x.
ListImpersonationRolesResponse
-> Rep ListImpersonationRolesResponse x
Prelude.Generic)
newListImpersonationRolesResponse ::
Prelude.Int ->
ListImpersonationRolesResponse
newListImpersonationRolesResponse :: Int -> ListImpersonationRolesResponse
newListImpersonationRolesResponse Int
pHttpStatus_ =
ListImpersonationRolesResponse'
{ $sel:nextToken:ListImpersonationRolesResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:roles:ListImpersonationRolesResponse' :: Maybe [ImpersonationRole]
roles = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListImpersonationRolesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listImpersonationRolesResponse_nextToken :: Lens.Lens' ListImpersonationRolesResponse (Prelude.Maybe Prelude.Text)
listImpersonationRolesResponse_nextToken :: Lens' ListImpersonationRolesResponse (Maybe Text)
listImpersonationRolesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListImpersonationRolesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListImpersonationRolesResponse' :: ListImpersonationRolesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListImpersonationRolesResponse
s@ListImpersonationRolesResponse' {} Maybe Text
a -> ListImpersonationRolesResponse
s {$sel:nextToken:ListImpersonationRolesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListImpersonationRolesResponse)
listImpersonationRolesResponse_roles :: Lens.Lens' ListImpersonationRolesResponse (Prelude.Maybe [ImpersonationRole])
listImpersonationRolesResponse_roles :: Lens' ListImpersonationRolesResponse (Maybe [ImpersonationRole])
listImpersonationRolesResponse_roles = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListImpersonationRolesResponse' {Maybe [ImpersonationRole]
roles :: Maybe [ImpersonationRole]
$sel:roles:ListImpersonationRolesResponse' :: ListImpersonationRolesResponse -> Maybe [ImpersonationRole]
roles} -> Maybe [ImpersonationRole]
roles) (\s :: ListImpersonationRolesResponse
s@ListImpersonationRolesResponse' {} Maybe [ImpersonationRole]
a -> ListImpersonationRolesResponse
s {$sel:roles:ListImpersonationRolesResponse' :: Maybe [ImpersonationRole]
roles = Maybe [ImpersonationRole]
a} :: ListImpersonationRolesResponse) 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
listImpersonationRolesResponse_httpStatus :: Lens.Lens' ListImpersonationRolesResponse Prelude.Int
listImpersonationRolesResponse_httpStatus :: Lens' ListImpersonationRolesResponse Int
listImpersonationRolesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListImpersonationRolesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListImpersonationRolesResponse' :: ListImpersonationRolesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListImpersonationRolesResponse
s@ListImpersonationRolesResponse' {} Int
a -> ListImpersonationRolesResponse
s {$sel:httpStatus:ListImpersonationRolesResponse' :: Int
httpStatus = Int
a} :: ListImpersonationRolesResponse)
instance
Prelude.NFData
ListImpersonationRolesResponse
where
rnf :: ListImpersonationRolesResponse -> ()
rnf ListImpersonationRolesResponse' {Int
Maybe [ImpersonationRole]
Maybe Text
httpStatus :: Int
roles :: Maybe [ImpersonationRole]
nextToken :: Maybe Text
$sel:httpStatus:ListImpersonationRolesResponse' :: ListImpersonationRolesResponse -> Int
$sel:roles:ListImpersonationRolesResponse' :: ListImpersonationRolesResponse -> Maybe [ImpersonationRole]
$sel:nextToken:ListImpersonationRolesResponse' :: ListImpersonationRolesResponse -> 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 Maybe [ImpersonationRole]
roles
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus