{-# 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.SSO.ListAccountRoles
(
ListAccountRoles (..),
newListAccountRoles,
listAccountRoles_maxResults,
listAccountRoles_nextToken,
listAccountRoles_accessToken,
listAccountRoles_accountId,
ListAccountRolesResponse (..),
newListAccountRolesResponse,
listAccountRolesResponse_nextToken,
listAccountRolesResponse_roleList,
listAccountRolesResponse_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.SSO.Types
data ListAccountRoles = ListAccountRoles'
{
ListAccountRoles -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListAccountRoles -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListAccountRoles -> Sensitive Text
accessToken :: Data.Sensitive Prelude.Text,
ListAccountRoles -> Text
accountId :: Prelude.Text
}
deriving (ListAccountRoles -> ListAccountRoles -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccountRoles -> ListAccountRoles -> Bool
$c/= :: ListAccountRoles -> ListAccountRoles -> Bool
== :: ListAccountRoles -> ListAccountRoles -> Bool
$c== :: ListAccountRoles -> ListAccountRoles -> Bool
Prelude.Eq, Int -> ListAccountRoles -> ShowS
[ListAccountRoles] -> ShowS
ListAccountRoles -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccountRoles] -> ShowS
$cshowList :: [ListAccountRoles] -> ShowS
show :: ListAccountRoles -> String
$cshow :: ListAccountRoles -> String
showsPrec :: Int -> ListAccountRoles -> ShowS
$cshowsPrec :: Int -> ListAccountRoles -> ShowS
Prelude.Show, forall x. Rep ListAccountRoles x -> ListAccountRoles
forall x. ListAccountRoles -> Rep ListAccountRoles x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAccountRoles x -> ListAccountRoles
$cfrom :: forall x. ListAccountRoles -> Rep ListAccountRoles x
Prelude.Generic)
newListAccountRoles ::
Prelude.Text ->
Prelude.Text ->
ListAccountRoles
newListAccountRoles :: Text -> Text -> ListAccountRoles
newListAccountRoles Text
pAccessToken_ Text
pAccountId_ =
ListAccountRoles'
{ $sel:maxResults:ListAccountRoles' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListAccountRoles' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:accessToken:ListAccountRoles' :: Sensitive Text
accessToken = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pAccessToken_,
$sel:accountId:ListAccountRoles' :: Text
accountId = Text
pAccountId_
}
listAccountRoles_maxResults :: Lens.Lens' ListAccountRoles (Prelude.Maybe Prelude.Natural)
listAccountRoles_maxResults :: Lens' ListAccountRoles (Maybe Natural)
listAccountRoles_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountRoles' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListAccountRoles' :: ListAccountRoles -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListAccountRoles
s@ListAccountRoles' {} Maybe Natural
a -> ListAccountRoles
s {$sel:maxResults:ListAccountRoles' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListAccountRoles)
listAccountRoles_nextToken :: Lens.Lens' ListAccountRoles (Prelude.Maybe Prelude.Text)
listAccountRoles_nextToken :: Lens' ListAccountRoles (Maybe Text)
listAccountRoles_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountRoles' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAccountRoles' :: ListAccountRoles -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAccountRoles
s@ListAccountRoles' {} Maybe Text
a -> ListAccountRoles
s {$sel:nextToken:ListAccountRoles' :: Maybe Text
nextToken = Maybe Text
a} :: ListAccountRoles)
listAccountRoles_accessToken :: Lens.Lens' ListAccountRoles Prelude.Text
listAccountRoles_accessToken :: Lens' ListAccountRoles Text
listAccountRoles_accessToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountRoles' {Sensitive Text
accessToken :: Sensitive Text
$sel:accessToken:ListAccountRoles' :: ListAccountRoles -> Sensitive Text
accessToken} -> Sensitive Text
accessToken) (\s :: ListAccountRoles
s@ListAccountRoles' {} Sensitive Text
a -> ListAccountRoles
s {$sel:accessToken:ListAccountRoles' :: Sensitive Text
accessToken = Sensitive Text
a} :: ListAccountRoles) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive
listAccountRoles_accountId :: Lens.Lens' ListAccountRoles Prelude.Text
listAccountRoles_accountId :: Lens' ListAccountRoles Text
listAccountRoles_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountRoles' {Text
accountId :: Text
$sel:accountId:ListAccountRoles' :: ListAccountRoles -> Text
accountId} -> Text
accountId) (\s :: ListAccountRoles
s@ListAccountRoles' {} Text
a -> ListAccountRoles
s {$sel:accountId:ListAccountRoles' :: Text
accountId = Text
a} :: ListAccountRoles)
instance Core.AWSPager ListAccountRoles where
page :: ListAccountRoles
-> AWSResponse ListAccountRoles -> Maybe ListAccountRoles
page ListAccountRoles
rq AWSResponse ListAccountRoles
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListAccountRoles
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAccountRolesResponse (Maybe Text)
listAccountRolesResponse_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 ListAccountRoles
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAccountRolesResponse (Maybe [RoleInfo])
listAccountRolesResponse_roleList
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.$ ListAccountRoles
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListAccountRoles (Maybe Text)
listAccountRoles_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAccountRoles
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAccountRolesResponse (Maybe Text)
listAccountRolesResponse_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 ListAccountRoles where
type
AWSResponse ListAccountRoles =
ListAccountRolesResponse
request :: (Service -> Service)
-> ListAccountRoles -> Request ListAccountRoles
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListAccountRoles
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListAccountRoles)))
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 [RoleInfo] -> Int -> ListAccountRolesResponse
ListAccountRolesResponse'
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
"roleList" 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 ListAccountRoles where
hashWithSalt :: Int -> ListAccountRoles -> Int
hashWithSalt Int
_salt ListAccountRoles' {Maybe Natural
Maybe Text
Text
Sensitive Text
accountId :: Text
accessToken :: Sensitive Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:accountId:ListAccountRoles' :: ListAccountRoles -> Text
$sel:accessToken:ListAccountRoles' :: ListAccountRoles -> Sensitive Text
$sel:nextToken:ListAccountRoles' :: ListAccountRoles -> Maybe Text
$sel:maxResults:ListAccountRoles' :: ListAccountRoles -> 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` Sensitive Text
accessToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
accountId
instance Prelude.NFData ListAccountRoles where
rnf :: ListAccountRoles -> ()
rnf ListAccountRoles' {Maybe Natural
Maybe Text
Text
Sensitive Text
accountId :: Text
accessToken :: Sensitive Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:accountId:ListAccountRoles' :: ListAccountRoles -> Text
$sel:accessToken:ListAccountRoles' :: ListAccountRoles -> Sensitive Text
$sel:nextToken:ListAccountRoles' :: ListAccountRoles -> Maybe Text
$sel:maxResults:ListAccountRoles' :: ListAccountRoles -> 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 Sensitive Text
accessToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
accountId
instance Data.ToHeaders ListAccountRoles where
toHeaders :: ListAccountRoles -> ResponseHeaders
toHeaders ListAccountRoles' {Maybe Natural
Maybe Text
Text
Sensitive Text
accountId :: Text
accessToken :: Sensitive Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:accountId:ListAccountRoles' :: ListAccountRoles -> Text
$sel:accessToken:ListAccountRoles' :: ListAccountRoles -> Sensitive Text
$sel:nextToken:ListAccountRoles' :: ListAccountRoles -> Maybe Text
$sel:maxResults:ListAccountRoles' :: ListAccountRoles -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"x-amz-sso_bearer_token" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Sensitive Text
accessToken,
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"application/x-amz-json-1.1" :: Prelude.ByteString)
]
instance Data.ToPath ListAccountRoles where
toPath :: ListAccountRoles -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/assignment/roles"
instance Data.ToQuery ListAccountRoles where
toQuery :: ListAccountRoles -> QueryString
toQuery ListAccountRoles' {Maybe Natural
Maybe Text
Text
Sensitive Text
accountId :: Text
accessToken :: Sensitive Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:accountId:ListAccountRoles' :: ListAccountRoles -> Text
$sel:accessToken:ListAccountRoles' :: ListAccountRoles -> Sensitive Text
$sel:nextToken:ListAccountRoles' :: ListAccountRoles -> Maybe Text
$sel:maxResults:ListAccountRoles' :: ListAccountRoles -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"max_result" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"next_token" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken,
ByteString
"account_id" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
accountId
]
data ListAccountRolesResponse = ListAccountRolesResponse'
{
ListAccountRolesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListAccountRolesResponse -> Maybe [RoleInfo]
roleList :: Prelude.Maybe [RoleInfo],
ListAccountRolesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListAccountRolesResponse -> ListAccountRolesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccountRolesResponse -> ListAccountRolesResponse -> Bool
$c/= :: ListAccountRolesResponse -> ListAccountRolesResponse -> Bool
== :: ListAccountRolesResponse -> ListAccountRolesResponse -> Bool
$c== :: ListAccountRolesResponse -> ListAccountRolesResponse -> Bool
Prelude.Eq, ReadPrec [ListAccountRolesResponse]
ReadPrec ListAccountRolesResponse
Int -> ReadS ListAccountRolesResponse
ReadS [ListAccountRolesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAccountRolesResponse]
$creadListPrec :: ReadPrec [ListAccountRolesResponse]
readPrec :: ReadPrec ListAccountRolesResponse
$creadPrec :: ReadPrec ListAccountRolesResponse
readList :: ReadS [ListAccountRolesResponse]
$creadList :: ReadS [ListAccountRolesResponse]
readsPrec :: Int -> ReadS ListAccountRolesResponse
$creadsPrec :: Int -> ReadS ListAccountRolesResponse
Prelude.Read, Int -> ListAccountRolesResponse -> ShowS
[ListAccountRolesResponse] -> ShowS
ListAccountRolesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccountRolesResponse] -> ShowS
$cshowList :: [ListAccountRolesResponse] -> ShowS
show :: ListAccountRolesResponse -> String
$cshow :: ListAccountRolesResponse -> String
showsPrec :: Int -> ListAccountRolesResponse -> ShowS
$cshowsPrec :: Int -> ListAccountRolesResponse -> ShowS
Prelude.Show, forall x.
Rep ListAccountRolesResponse x -> ListAccountRolesResponse
forall x.
ListAccountRolesResponse -> Rep ListAccountRolesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAccountRolesResponse x -> ListAccountRolesResponse
$cfrom :: forall x.
ListAccountRolesResponse -> Rep ListAccountRolesResponse x
Prelude.Generic)
newListAccountRolesResponse ::
Prelude.Int ->
ListAccountRolesResponse
newListAccountRolesResponse :: Int -> ListAccountRolesResponse
newListAccountRolesResponse Int
pHttpStatus_ =
ListAccountRolesResponse'
{ $sel:nextToken:ListAccountRolesResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:roleList:ListAccountRolesResponse' :: Maybe [RoleInfo]
roleList = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListAccountRolesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listAccountRolesResponse_nextToken :: Lens.Lens' ListAccountRolesResponse (Prelude.Maybe Prelude.Text)
listAccountRolesResponse_nextToken :: Lens' ListAccountRolesResponse (Maybe Text)
listAccountRolesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountRolesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAccountRolesResponse' :: ListAccountRolesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAccountRolesResponse
s@ListAccountRolesResponse' {} Maybe Text
a -> ListAccountRolesResponse
s {$sel:nextToken:ListAccountRolesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAccountRolesResponse)
listAccountRolesResponse_roleList :: Lens.Lens' ListAccountRolesResponse (Prelude.Maybe [RoleInfo])
listAccountRolesResponse_roleList :: Lens' ListAccountRolesResponse (Maybe [RoleInfo])
listAccountRolesResponse_roleList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountRolesResponse' {Maybe [RoleInfo]
roleList :: Maybe [RoleInfo]
$sel:roleList:ListAccountRolesResponse' :: ListAccountRolesResponse -> Maybe [RoleInfo]
roleList} -> Maybe [RoleInfo]
roleList) (\s :: ListAccountRolesResponse
s@ListAccountRolesResponse' {} Maybe [RoleInfo]
a -> ListAccountRolesResponse
s {$sel:roleList:ListAccountRolesResponse' :: Maybe [RoleInfo]
roleList = Maybe [RoleInfo]
a} :: ListAccountRolesResponse) 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
listAccountRolesResponse_httpStatus :: Lens.Lens' ListAccountRolesResponse Prelude.Int
listAccountRolesResponse_httpStatus :: Lens' ListAccountRolesResponse Int
listAccountRolesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountRolesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListAccountRolesResponse' :: ListAccountRolesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListAccountRolesResponse
s@ListAccountRolesResponse' {} Int
a -> ListAccountRolesResponse
s {$sel:httpStatus:ListAccountRolesResponse' :: Int
httpStatus = Int
a} :: ListAccountRolesResponse)
instance Prelude.NFData ListAccountRolesResponse where
rnf :: ListAccountRolesResponse -> ()
rnf ListAccountRolesResponse' {Int
Maybe [RoleInfo]
Maybe Text
httpStatus :: Int
roleList :: Maybe [RoleInfo]
nextToken :: Maybe Text
$sel:httpStatus:ListAccountRolesResponse' :: ListAccountRolesResponse -> Int
$sel:roleList:ListAccountRolesResponse' :: ListAccountRolesResponse -> Maybe [RoleInfo]
$sel:nextToken:ListAccountRolesResponse' :: ListAccountRolesResponse -> 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 [RoleInfo]
roleList
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus