{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SSO.ListAccountRoles
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists all roles that are assigned to the user for a given AWS account.
--
-- This operation returns paginated results.
module Amazonka.SSO.ListAccountRoles
  ( -- * Creating a Request
    ListAccountRoles (..),
    newListAccountRoles,

    -- * Request Lenses
    listAccountRoles_nextToken,
    listAccountRoles_maxResults,
    listAccountRoles_accessToken,
    listAccountRoles_accountId,

    -- * Destructuring the Response
    ListAccountRolesResponse (..),
    newListAccountRolesResponse,

    -- * Response Lenses
    listAccountRolesResponse_roleList,
    listAccountRolesResponse_nextToken,
    listAccountRolesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SSO.Types

-- | /See:/ 'newListAccountRoles' smart constructor.
data ListAccountRoles = ListAccountRoles'
  { -- | The page token from the previous response output when you request
    -- subsequent pages.
    ListAccountRoles -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The number of items that clients can request per page.
    ListAccountRoles -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token issued by the @CreateToken@ API call. For more information,
    -- see
    -- <https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html CreateToken>
    -- in the /AWS SSO OIDC API Reference Guide/.
    ListAccountRoles -> Sensitive Text
accessToken :: Core.Sensitive Prelude.Text,
    -- | The identifier for the AWS account that is assigned to the user.
    ListAccountRoles -> Text
accountId :: Prelude.Text
  }
  deriving (ListAccountRoles -> ListAccountRoles -> Bool
(ListAccountRoles -> ListAccountRoles -> Bool)
-> (ListAccountRoles -> ListAccountRoles -> Bool)
-> Eq ListAccountRoles
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
(Int -> ListAccountRoles -> ShowS)
-> (ListAccountRoles -> String)
-> ([ListAccountRoles] -> ShowS)
-> Show ListAccountRoles
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. ListAccountRoles -> Rep ListAccountRoles x)
-> (forall x. Rep ListAccountRoles x -> ListAccountRoles)
-> Generic ListAccountRoles
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)

-- |
-- Create a value of 'ListAccountRoles' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'listAccountRoles_nextToken' - The page token from the previous response output when you request
-- subsequent pages.
--
-- 'maxResults', 'listAccountRoles_maxResults' - The number of items that clients can request per page.
--
-- 'accessToken', 'listAccountRoles_accessToken' - The token issued by the @CreateToken@ API call. For more information,
-- see
-- <https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html CreateToken>
-- in the /AWS SSO OIDC API Reference Guide/.
--
-- 'accountId', 'listAccountRoles_accountId' - The identifier for the AWS account that is assigned to the user.
newListAccountRoles ::
  -- | 'accessToken'
  Prelude.Text ->
  -- | 'accountId'
  Prelude.Text ->
  ListAccountRoles
newListAccountRoles :: Text -> Text -> ListAccountRoles
newListAccountRoles Text
pAccessToken_ Text
pAccountId_ =
  ListAccountRoles' :: Maybe Text
-> Maybe Natural -> Sensitive Text -> Text -> ListAccountRoles
ListAccountRoles'
    { $sel:nextToken:ListAccountRoles' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListAccountRoles' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:accessToken:ListAccountRoles' :: Sensitive Text
accessToken = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pAccessToken_,
      $sel:accountId:ListAccountRoles' :: Text
accountId = Text
pAccountId_
    }

-- | The page token from the previous response output when you request
-- subsequent pages.
listAccountRoles_nextToken :: Lens.Lens' ListAccountRoles (Prelude.Maybe Prelude.Text)
listAccountRoles_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAccountRoles -> f ListAccountRoles
listAccountRoles_nextToken = (ListAccountRoles -> Maybe Text)
-> (ListAccountRoles -> Maybe Text -> ListAccountRoles)
-> Lens ListAccountRoles ListAccountRoles (Maybe Text) (Maybe Text)
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)

-- | The number of items that clients can request per page.
listAccountRoles_maxResults :: Lens.Lens' ListAccountRoles (Prelude.Maybe Prelude.Natural)
listAccountRoles_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListAccountRoles -> f ListAccountRoles
listAccountRoles_maxResults = (ListAccountRoles -> Maybe Natural)
-> (ListAccountRoles -> Maybe Natural -> ListAccountRoles)
-> Lens
     ListAccountRoles ListAccountRoles (Maybe Natural) (Maybe Natural)
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)

-- | The token issued by the @CreateToken@ API call. For more information,
-- see
-- <https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html CreateToken>
-- in the /AWS SSO OIDC API Reference Guide/.
listAccountRoles_accessToken :: Lens.Lens' ListAccountRoles Prelude.Text
listAccountRoles_accessToken :: (Text -> f Text) -> ListAccountRoles -> f ListAccountRoles
listAccountRoles_accessToken = (ListAccountRoles -> Sensitive Text)
-> (ListAccountRoles -> Sensitive Text -> ListAccountRoles)
-> Lens
     ListAccountRoles ListAccountRoles (Sensitive Text) (Sensitive Text)
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) ((Sensitive Text -> f (Sensitive Text))
 -> ListAccountRoles -> f ListAccountRoles)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> ListAccountRoles
-> f ListAccountRoles
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The identifier for the AWS account that is assigned to the user.
listAccountRoles_accountId :: Lens.Lens' ListAccountRoles Prelude.Text
listAccountRoles_accountId :: (Text -> f Text) -> ListAccountRoles -> f ListAccountRoles
listAccountRoles_accountId = (ListAccountRoles -> Text)
-> (ListAccountRoles -> Text -> ListAccountRoles)
-> Lens ListAccountRoles ListAccountRoles Text Text
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
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAccountRoles
ListAccountRolesResponse
rs
            ListAccountRolesResponse
-> Getting (First Text) ListAccountRolesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListAccountRolesResponse
-> Const (First Text) ListAccountRolesResponse
Lens' ListAccountRolesResponse (Maybe Text)
listAccountRolesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListAccountRolesResponse
 -> Const (First Text) ListAccountRolesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListAccountRolesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListAccountRoles
forall a. Maybe a
Prelude.Nothing
    | Maybe [RoleInfo] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAccountRoles
ListAccountRolesResponse
rs
            ListAccountRolesResponse
-> Getting (First [RoleInfo]) ListAccountRolesResponse [RoleInfo]
-> Maybe [RoleInfo]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [RoleInfo] -> Const (First [RoleInfo]) (Maybe [RoleInfo]))
-> ListAccountRolesResponse
-> Const (First [RoleInfo]) ListAccountRolesResponse
Lens' ListAccountRolesResponse (Maybe [RoleInfo])
listAccountRolesResponse_roleList
              ((Maybe [RoleInfo] -> Const (First [RoleInfo]) (Maybe [RoleInfo]))
 -> ListAccountRolesResponse
 -> Const (First [RoleInfo]) ListAccountRolesResponse)
-> (([RoleInfo] -> Const (First [RoleInfo]) [RoleInfo])
    -> Maybe [RoleInfo] -> Const (First [RoleInfo]) (Maybe [RoleInfo]))
-> Getting (First [RoleInfo]) ListAccountRolesResponse [RoleInfo]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([RoleInfo] -> Const (First [RoleInfo]) [RoleInfo])
-> Maybe [RoleInfo] -> Const (First [RoleInfo]) (Maybe [RoleInfo])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListAccountRoles
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListAccountRoles -> Maybe ListAccountRoles
forall a. a -> Maybe a
Prelude.Just (ListAccountRoles -> Maybe ListAccountRoles)
-> ListAccountRoles -> Maybe ListAccountRoles
forall a b. (a -> b) -> a -> b
Prelude.$
        ListAccountRoles
rq
          ListAccountRoles
-> (ListAccountRoles -> ListAccountRoles) -> ListAccountRoles
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListAccountRoles -> Identity ListAccountRoles
Lens ListAccountRoles ListAccountRoles (Maybe Text) (Maybe Text)
listAccountRoles_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListAccountRoles -> Identity ListAccountRoles)
-> Maybe Text -> ListAccountRoles -> ListAccountRoles
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAccountRoles
ListAccountRolesResponse
rs
          ListAccountRolesResponse
-> Getting (First Text) ListAccountRolesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListAccountRolesResponse
-> Const (First Text) ListAccountRolesResponse
Lens' ListAccountRolesResponse (Maybe Text)
listAccountRolesResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListAccountRolesResponse
 -> Const (First Text) ListAccountRolesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListAccountRolesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListAccountRoles where
  type
    AWSResponse ListAccountRoles =
      ListAccountRolesResponse
  request :: ListAccountRoles -> Request ListAccountRoles
request = Service -> ListAccountRoles -> Request ListAccountRoles
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListAccountRoles
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListAccountRoles)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListAccountRoles))
-> Logger
-> Service
-> Proxy ListAccountRoles
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListAccountRoles)))
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 [RoleInfo] -> Maybe Text -> Int -> ListAccountRolesResponse
ListAccountRolesResponse'
            (Maybe [RoleInfo] -> Maybe Text -> Int -> ListAccountRolesResponse)
-> Either String (Maybe [RoleInfo])
-> Either String (Maybe Text -> Int -> ListAccountRolesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [RoleInfo]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"roleList" Either String (Maybe (Maybe [RoleInfo]))
-> Maybe [RoleInfo] -> Either String (Maybe [RoleInfo])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [RoleInfo]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> ListAccountRolesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListAccountRolesResponse)
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 -> ListAccountRolesResponse)
-> Either String Int -> Either String ListAccountRolesResponse
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 ListAccountRoles

instance Prelude.NFData ListAccountRoles

instance Core.ToHeaders ListAccountRoles where
  toHeaders :: ListAccountRoles -> ResponseHeaders
toHeaders ListAccountRoles' {Maybe Natural
Maybe Text
Text
Sensitive Text
accountId :: Text
accessToken :: Sensitive Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:accountId:ListAccountRoles' :: ListAccountRoles -> Text
$sel:accessToken:ListAccountRoles' :: ListAccountRoles -> Sensitive Text
$sel:maxResults:ListAccountRoles' :: ListAccountRoles -> Maybe Natural
$sel:nextToken:ListAccountRoles' :: ListAccountRoles -> Maybe Text
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"x-amz-sso_bearer_token" HeaderName -> Sensitive Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Sensitive Text
accessToken,
        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.ToPath ListAccountRoles where
  toPath :: ListAccountRoles -> ByteString
toPath = ByteString -> ListAccountRoles -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/assignment/roles"

instance Core.ToQuery ListAccountRoles where
  toQuery :: ListAccountRoles -> QueryString
toQuery ListAccountRoles' {Maybe Natural
Maybe Text
Text
Sensitive Text
accountId :: Text
accessToken :: Sensitive Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:accountId:ListAccountRoles' :: ListAccountRoles -> Text
$sel:accessToken:ListAccountRoles' :: ListAccountRoles -> Sensitive Text
$sel:maxResults:ListAccountRoles' :: ListAccountRoles -> Maybe Natural
$sel:nextToken:ListAccountRoles' :: ListAccountRoles -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"next_token" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"max_result" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults,
        ByteString
"account_id" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
accountId
      ]

-- | /See:/ 'newListAccountRolesResponse' smart constructor.
data ListAccountRolesResponse = ListAccountRolesResponse'
  { -- | A paginated response with the list of roles and the next token if more
    -- results are available.
    ListAccountRolesResponse -> Maybe [RoleInfo]
roleList :: Prelude.Maybe [RoleInfo],
    -- | The page token client that is used to retrieve the list of accounts.
    ListAccountRolesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListAccountRolesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListAccountRolesResponse -> ListAccountRolesResponse -> Bool
(ListAccountRolesResponse -> ListAccountRolesResponse -> Bool)
-> (ListAccountRolesResponse -> ListAccountRolesResponse -> Bool)
-> Eq ListAccountRolesResponse
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]
(Int -> ReadS ListAccountRolesResponse)
-> ReadS [ListAccountRolesResponse]
-> ReadPrec ListAccountRolesResponse
-> ReadPrec [ListAccountRolesResponse]
-> Read 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
(Int -> ListAccountRolesResponse -> ShowS)
-> (ListAccountRolesResponse -> String)
-> ([ListAccountRolesResponse] -> ShowS)
-> Show ListAccountRolesResponse
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.
 ListAccountRolesResponse -> Rep ListAccountRolesResponse x)
-> (forall x.
    Rep ListAccountRolesResponse x -> ListAccountRolesResponse)
-> Generic ListAccountRolesResponse
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)

-- |
-- Create a value of 'ListAccountRolesResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'roleList', 'listAccountRolesResponse_roleList' - A paginated response with the list of roles and the next token if more
-- results are available.
--
-- 'nextToken', 'listAccountRolesResponse_nextToken' - The page token client that is used to retrieve the list of accounts.
--
-- 'httpStatus', 'listAccountRolesResponse_httpStatus' - The response's http status code.
newListAccountRolesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAccountRolesResponse
newListAccountRolesResponse :: Int -> ListAccountRolesResponse
newListAccountRolesResponse Int
pHttpStatus_ =
  ListAccountRolesResponse' :: Maybe [RoleInfo] -> Maybe Text -> Int -> ListAccountRolesResponse
ListAccountRolesResponse'
    { $sel:roleList:ListAccountRolesResponse' :: Maybe [RoleInfo]
roleList =
        Maybe [RoleInfo]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListAccountRolesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAccountRolesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A paginated response with the list of roles and the next token if more
-- results are available.
listAccountRolesResponse_roleList :: Lens.Lens' ListAccountRolesResponse (Prelude.Maybe [RoleInfo])
listAccountRolesResponse_roleList :: (Maybe [RoleInfo] -> f (Maybe [RoleInfo]))
-> ListAccountRolesResponse -> f ListAccountRolesResponse
listAccountRolesResponse_roleList = (ListAccountRolesResponse -> Maybe [RoleInfo])
-> (ListAccountRolesResponse
    -> Maybe [RoleInfo] -> ListAccountRolesResponse)
-> Lens' ListAccountRolesResponse (Maybe [RoleInfo])
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) ((Maybe [RoleInfo] -> f (Maybe [RoleInfo]))
 -> ListAccountRolesResponse -> f ListAccountRolesResponse)
-> ((Maybe [RoleInfo] -> f (Maybe [RoleInfo]))
    -> Maybe [RoleInfo] -> f (Maybe [RoleInfo]))
-> (Maybe [RoleInfo] -> f (Maybe [RoleInfo]))
-> ListAccountRolesResponse
-> f ListAccountRolesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [RoleInfo] [RoleInfo] [RoleInfo] [RoleInfo]
-> Iso
     (Maybe [RoleInfo])
     (Maybe [RoleInfo])
     (Maybe [RoleInfo])
     (Maybe [RoleInfo])
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 [RoleInfo] [RoleInfo] [RoleInfo] [RoleInfo]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The page token client that is used to retrieve the list of accounts.
listAccountRolesResponse_nextToken :: Lens.Lens' ListAccountRolesResponse (Prelude.Maybe Prelude.Text)
listAccountRolesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAccountRolesResponse -> f ListAccountRolesResponse
listAccountRolesResponse_nextToken = (ListAccountRolesResponse -> Maybe Text)
-> (ListAccountRolesResponse
    -> Maybe Text -> ListAccountRolesResponse)
-> Lens' ListAccountRolesResponse (Maybe Text)
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)

-- | The response's http status code.
listAccountRolesResponse_httpStatus :: Lens.Lens' ListAccountRolesResponse Prelude.Int
listAccountRolesResponse_httpStatus :: (Int -> f Int)
-> ListAccountRolesResponse -> f ListAccountRolesResponse
listAccountRolesResponse_httpStatus = (ListAccountRolesResponse -> Int)
-> (ListAccountRolesResponse -> Int -> ListAccountRolesResponse)
-> Lens ListAccountRolesResponse ListAccountRolesResponse Int Int
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