{-# 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.Grafana.ListPermissions
-- 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 the users and groups who have the Grafana @Admin@ and @Editor@
-- roles in this workspace. If you use this operation without specifying
-- @userId@ or @groupId@, the operation returns the roles of all users and
-- groups. If you specify a @userId@ or a @groupId@, only the roles for
-- that user or group are returned. If you do this, you can specify only
-- one @userId@ or one @groupId@.
--
-- This operation returns paginated results.
module Amazonka.Grafana.ListPermissions
  ( -- * Creating a Request
    ListPermissions (..),
    newListPermissions,

    -- * Request Lenses
    listPermissions_userId,
    listPermissions_nextToken,
    listPermissions_groupId,
    listPermissions_maxResults,
    listPermissions_userType,
    listPermissions_workspaceId,

    -- * Destructuring the Response
    ListPermissionsResponse (..),
    newListPermissionsResponse,

    -- * Response Lenses
    listPermissionsResponse_nextToken,
    listPermissionsResponse_httpStatus,
    listPermissionsResponse_permissions,
  )
where

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

-- | /See:/ 'newListPermissions' smart constructor.
data ListPermissions = ListPermissions'
  { -- | (Optional) Limits the results to only the user that matches this ID.
    ListPermissions -> Maybe Text
userId :: Prelude.Maybe Prelude.Text,
    -- | The token to use when requesting the next set of results. You received
    -- this token from a previous @ListPermissions@ operation.
    ListPermissions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | (Optional) Limits the results to only the group that matches this ID.
    ListPermissions -> Maybe Text
groupId :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to include in the response.
    ListPermissions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | (Optional) If you specify @SSO_USER@, then only the permissions of
    -- Amazon Web Services SSO users are returned. If you specify @SSO_GROUP@,
    -- only the permissions of Amazon Web Services SSO groups are returned.
    ListPermissions -> Maybe UserType
userType :: Prelude.Maybe UserType,
    -- | The ID of the workspace to list permissions for. This parameter is
    -- required.
    ListPermissions -> Text
workspaceId :: Prelude.Text
  }
  deriving (ListPermissions -> ListPermissions -> Bool
(ListPermissions -> ListPermissions -> Bool)
-> (ListPermissions -> ListPermissions -> Bool)
-> Eq ListPermissions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPermissions -> ListPermissions -> Bool
$c/= :: ListPermissions -> ListPermissions -> Bool
== :: ListPermissions -> ListPermissions -> Bool
$c== :: ListPermissions -> ListPermissions -> Bool
Prelude.Eq, ReadPrec [ListPermissions]
ReadPrec ListPermissions
Int -> ReadS ListPermissions
ReadS [ListPermissions]
(Int -> ReadS ListPermissions)
-> ReadS [ListPermissions]
-> ReadPrec ListPermissions
-> ReadPrec [ListPermissions]
-> Read ListPermissions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPermissions]
$creadListPrec :: ReadPrec [ListPermissions]
readPrec :: ReadPrec ListPermissions
$creadPrec :: ReadPrec ListPermissions
readList :: ReadS [ListPermissions]
$creadList :: ReadS [ListPermissions]
readsPrec :: Int -> ReadS ListPermissions
$creadsPrec :: Int -> ReadS ListPermissions
Prelude.Read, Int -> ListPermissions -> ShowS
[ListPermissions] -> ShowS
ListPermissions -> String
(Int -> ListPermissions -> ShowS)
-> (ListPermissions -> String)
-> ([ListPermissions] -> ShowS)
-> Show ListPermissions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPermissions] -> ShowS
$cshowList :: [ListPermissions] -> ShowS
show :: ListPermissions -> String
$cshow :: ListPermissions -> String
showsPrec :: Int -> ListPermissions -> ShowS
$cshowsPrec :: Int -> ListPermissions -> ShowS
Prelude.Show, (forall x. ListPermissions -> Rep ListPermissions x)
-> (forall x. Rep ListPermissions x -> ListPermissions)
-> Generic ListPermissions
forall x. Rep ListPermissions x -> ListPermissions
forall x. ListPermissions -> Rep ListPermissions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPermissions x -> ListPermissions
$cfrom :: forall x. ListPermissions -> Rep ListPermissions x
Prelude.Generic)

-- |
-- Create a value of 'ListPermissions' 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:
--
-- 'userId', 'listPermissions_userId' - (Optional) Limits the results to only the user that matches this ID.
--
-- 'nextToken', 'listPermissions_nextToken' - The token to use when requesting the next set of results. You received
-- this token from a previous @ListPermissions@ operation.
--
-- 'groupId', 'listPermissions_groupId' - (Optional) Limits the results to only the group that matches this ID.
--
-- 'maxResults', 'listPermissions_maxResults' - The maximum number of results to include in the response.
--
-- 'userType', 'listPermissions_userType' - (Optional) If you specify @SSO_USER@, then only the permissions of
-- Amazon Web Services SSO users are returned. If you specify @SSO_GROUP@,
-- only the permissions of Amazon Web Services SSO groups are returned.
--
-- 'workspaceId', 'listPermissions_workspaceId' - The ID of the workspace to list permissions for. This parameter is
-- required.
newListPermissions ::
  -- | 'workspaceId'
  Prelude.Text ->
  ListPermissions
newListPermissions :: Text -> ListPermissions
newListPermissions Text
pWorkspaceId_ =
  ListPermissions' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe UserType
-> Text
-> ListPermissions
ListPermissions'
    { $sel:userId:ListPermissions' :: Maybe Text
userId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListPermissions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:groupId:ListPermissions' :: Maybe Text
groupId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListPermissions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:userType:ListPermissions' :: Maybe UserType
userType = Maybe UserType
forall a. Maybe a
Prelude.Nothing,
      $sel:workspaceId:ListPermissions' :: Text
workspaceId = Text
pWorkspaceId_
    }

-- | (Optional) Limits the results to only the user that matches this ID.
listPermissions_userId :: Lens.Lens' ListPermissions (Prelude.Maybe Prelude.Text)
listPermissions_userId :: (Maybe Text -> f (Maybe Text))
-> ListPermissions -> f ListPermissions
listPermissions_userId = (ListPermissions -> Maybe Text)
-> (ListPermissions -> Maybe Text -> ListPermissions)
-> Lens ListPermissions ListPermissions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissions' {Maybe Text
userId :: Maybe Text
$sel:userId:ListPermissions' :: ListPermissions -> Maybe Text
userId} -> Maybe Text
userId) (\s :: ListPermissions
s@ListPermissions' {} Maybe Text
a -> ListPermissions
s {$sel:userId:ListPermissions' :: Maybe Text
userId = Maybe Text
a} :: ListPermissions)

-- | The token to use when requesting the next set of results. You received
-- this token from a previous @ListPermissions@ operation.
listPermissions_nextToken :: Lens.Lens' ListPermissions (Prelude.Maybe Prelude.Text)
listPermissions_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListPermissions -> f ListPermissions
listPermissions_nextToken = (ListPermissions -> Maybe Text)
-> (ListPermissions -> Maybe Text -> ListPermissions)
-> Lens ListPermissions ListPermissions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPermissions' :: ListPermissions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPermissions
s@ListPermissions' {} Maybe Text
a -> ListPermissions
s {$sel:nextToken:ListPermissions' :: Maybe Text
nextToken = Maybe Text
a} :: ListPermissions)

-- | (Optional) Limits the results to only the group that matches this ID.
listPermissions_groupId :: Lens.Lens' ListPermissions (Prelude.Maybe Prelude.Text)
listPermissions_groupId :: (Maybe Text -> f (Maybe Text))
-> ListPermissions -> f ListPermissions
listPermissions_groupId = (ListPermissions -> Maybe Text)
-> (ListPermissions -> Maybe Text -> ListPermissions)
-> Lens ListPermissions ListPermissions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissions' {Maybe Text
groupId :: Maybe Text
$sel:groupId:ListPermissions' :: ListPermissions -> Maybe Text
groupId} -> Maybe Text
groupId) (\s :: ListPermissions
s@ListPermissions' {} Maybe Text
a -> ListPermissions
s {$sel:groupId:ListPermissions' :: Maybe Text
groupId = Maybe Text
a} :: ListPermissions)

-- | The maximum number of results to include in the response.
listPermissions_maxResults :: Lens.Lens' ListPermissions (Prelude.Maybe Prelude.Natural)
listPermissions_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListPermissions -> f ListPermissions
listPermissions_maxResults = (ListPermissions -> Maybe Natural)
-> (ListPermissions -> Maybe Natural -> ListPermissions)
-> Lens
     ListPermissions ListPermissions (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListPermissions' :: ListPermissions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListPermissions
s@ListPermissions' {} Maybe Natural
a -> ListPermissions
s {$sel:maxResults:ListPermissions' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListPermissions)

-- | (Optional) If you specify @SSO_USER@, then only the permissions of
-- Amazon Web Services SSO users are returned. If you specify @SSO_GROUP@,
-- only the permissions of Amazon Web Services SSO groups are returned.
listPermissions_userType :: Lens.Lens' ListPermissions (Prelude.Maybe UserType)
listPermissions_userType :: (Maybe UserType -> f (Maybe UserType))
-> ListPermissions -> f ListPermissions
listPermissions_userType = (ListPermissions -> Maybe UserType)
-> (ListPermissions -> Maybe UserType -> ListPermissions)
-> Lens
     ListPermissions ListPermissions (Maybe UserType) (Maybe UserType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissions' {Maybe UserType
userType :: Maybe UserType
$sel:userType:ListPermissions' :: ListPermissions -> Maybe UserType
userType} -> Maybe UserType
userType) (\s :: ListPermissions
s@ListPermissions' {} Maybe UserType
a -> ListPermissions
s {$sel:userType:ListPermissions' :: Maybe UserType
userType = Maybe UserType
a} :: ListPermissions)

-- | The ID of the workspace to list permissions for. This parameter is
-- required.
listPermissions_workspaceId :: Lens.Lens' ListPermissions Prelude.Text
listPermissions_workspaceId :: (Text -> f Text) -> ListPermissions -> f ListPermissions
listPermissions_workspaceId = (ListPermissions -> Text)
-> (ListPermissions -> Text -> ListPermissions)
-> Lens ListPermissions ListPermissions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissions' {Text
workspaceId :: Text
$sel:workspaceId:ListPermissions' :: ListPermissions -> Text
workspaceId} -> Text
workspaceId) (\s :: ListPermissions
s@ListPermissions' {} Text
a -> ListPermissions
s {$sel:workspaceId:ListPermissions' :: Text
workspaceId = Text
a} :: ListPermissions)

instance Core.AWSPager ListPermissions where
  page :: ListPermissions
-> AWSResponse ListPermissions -> Maybe ListPermissions
page ListPermissions
rq AWSResponse ListPermissions
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListPermissions
ListPermissionsResponse
rs
            ListPermissionsResponse
-> Getting (First Text) ListPermissionsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListPermissionsResponse
-> Const (First Text) ListPermissionsResponse
Lens' ListPermissionsResponse (Maybe Text)
listPermissionsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListPermissionsResponse
 -> Const (First Text) ListPermissionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListPermissionsResponse 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 ListPermissions
forall a. Maybe a
Prelude.Nothing
    | [PermissionEntry] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        (AWSResponse ListPermissions
ListPermissionsResponse
rs ListPermissionsResponse
-> Getting
     [PermissionEntry] ListPermissionsResponse [PermissionEntry]
-> [PermissionEntry]
forall s a. s -> Getting a s a -> a
Lens.^. Getting [PermissionEntry] ListPermissionsResponse [PermissionEntry]
Lens' ListPermissionsResponse [PermissionEntry]
listPermissionsResponse_permissions) =
      Maybe ListPermissions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListPermissions -> Maybe ListPermissions
forall a. a -> Maybe a
Prelude.Just (ListPermissions -> Maybe ListPermissions)
-> ListPermissions -> Maybe ListPermissions
forall a b. (a -> b) -> a -> b
Prelude.$
        ListPermissions
rq
          ListPermissions
-> (ListPermissions -> ListPermissions) -> ListPermissions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListPermissions -> Identity ListPermissions
Lens ListPermissions ListPermissions (Maybe Text) (Maybe Text)
listPermissions_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListPermissions -> Identity ListPermissions)
-> Maybe Text -> ListPermissions -> ListPermissions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListPermissions
ListPermissionsResponse
rs
          ListPermissionsResponse
-> Getting (First Text) ListPermissionsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListPermissionsResponse
-> Const (First Text) ListPermissionsResponse
Lens' ListPermissionsResponse (Maybe Text)
listPermissionsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListPermissionsResponse
 -> Const (First Text) ListPermissionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListPermissionsResponse 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 ListPermissions where
  type
    AWSResponse ListPermissions =
      ListPermissionsResponse
  request :: ListPermissions -> Request ListPermissions
request = Service -> ListPermissions -> Request ListPermissions
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListPermissions
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListPermissions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListPermissions))
-> Logger
-> Service
-> Proxy ListPermissions
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListPermissions)))
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 Text -> Int -> [PermissionEntry] -> ListPermissionsResponse
ListPermissionsResponse'
            (Maybe Text -> Int -> [PermissionEntry] -> ListPermissionsResponse)
-> Either String (Maybe Text)
-> Either
     String (Int -> [PermissionEntry] -> ListPermissionsResponse)
forall (f :: * -> *) a b. Functor 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 -> [PermissionEntry] -> ListPermissionsResponse)
-> Either String Int
-> Either String ([PermissionEntry] -> ListPermissionsResponse)
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))
            Either String ([PermissionEntry] -> ListPermissionsResponse)
-> Either String [PermissionEntry]
-> Either String ListPermissionsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [PermissionEntry])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"permissions" Either String (Maybe [PermissionEntry])
-> [PermissionEntry] -> Either String [PermissionEntry]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [PermissionEntry]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ListPermissions

instance Prelude.NFData ListPermissions

instance Core.ToHeaders ListPermissions where
  toHeaders :: ListPermissions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListPermissions -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 ListPermissions where
  toPath :: ListPermissions -> ByteString
toPath ListPermissions' {Maybe Natural
Maybe Text
Maybe UserType
Text
workspaceId :: Text
userType :: Maybe UserType
maxResults :: Maybe Natural
groupId :: Maybe Text
nextToken :: Maybe Text
userId :: Maybe Text
$sel:workspaceId:ListPermissions' :: ListPermissions -> Text
$sel:userType:ListPermissions' :: ListPermissions -> Maybe UserType
$sel:maxResults:ListPermissions' :: ListPermissions -> Maybe Natural
$sel:groupId:ListPermissions' :: ListPermissions -> Maybe Text
$sel:nextToken:ListPermissions' :: ListPermissions -> Maybe Text
$sel:userId:ListPermissions' :: ListPermissions -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/workspaces/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
workspaceId,
        ByteString
"/permissions"
      ]

instance Core.ToQuery ListPermissions where
  toQuery :: ListPermissions -> QueryString
toQuery ListPermissions' {Maybe Natural
Maybe Text
Maybe UserType
Text
workspaceId :: Text
userType :: Maybe UserType
maxResults :: Maybe Natural
groupId :: Maybe Text
nextToken :: Maybe Text
userId :: Maybe Text
$sel:workspaceId:ListPermissions' :: ListPermissions -> Text
$sel:userType:ListPermissions' :: ListPermissions -> Maybe UserType
$sel:maxResults:ListPermissions' :: ListPermissions -> Maybe Natural
$sel:groupId:ListPermissions' :: ListPermissions -> Maybe Text
$sel:nextToken:ListPermissions' :: ListPermissions -> Maybe Text
$sel:userId:ListPermissions' :: ListPermissions -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"userId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
userId,
        ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"groupId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
groupId,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults,
        ByteString
"userType" ByteString -> Maybe UserType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe UserType
userType
      ]

-- | /See:/ 'newListPermissionsResponse' smart constructor.
data ListPermissionsResponse = ListPermissionsResponse'
  { -- | The token to use in a subsequent @ListPermissions@ operation to return
    -- the next set of results.
    ListPermissionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListPermissionsResponse -> Int
httpStatus :: Prelude.Int,
    -- | The permissions returned by the operation.
    ListPermissionsResponse -> [PermissionEntry]
permissions :: [PermissionEntry]
  }
  deriving (ListPermissionsResponse -> ListPermissionsResponse -> Bool
(ListPermissionsResponse -> ListPermissionsResponse -> Bool)
-> (ListPermissionsResponse -> ListPermissionsResponse -> Bool)
-> Eq ListPermissionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPermissionsResponse -> ListPermissionsResponse -> Bool
$c/= :: ListPermissionsResponse -> ListPermissionsResponse -> Bool
== :: ListPermissionsResponse -> ListPermissionsResponse -> Bool
$c== :: ListPermissionsResponse -> ListPermissionsResponse -> Bool
Prelude.Eq, ReadPrec [ListPermissionsResponse]
ReadPrec ListPermissionsResponse
Int -> ReadS ListPermissionsResponse
ReadS [ListPermissionsResponse]
(Int -> ReadS ListPermissionsResponse)
-> ReadS [ListPermissionsResponse]
-> ReadPrec ListPermissionsResponse
-> ReadPrec [ListPermissionsResponse]
-> Read ListPermissionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPermissionsResponse]
$creadListPrec :: ReadPrec [ListPermissionsResponse]
readPrec :: ReadPrec ListPermissionsResponse
$creadPrec :: ReadPrec ListPermissionsResponse
readList :: ReadS [ListPermissionsResponse]
$creadList :: ReadS [ListPermissionsResponse]
readsPrec :: Int -> ReadS ListPermissionsResponse
$creadsPrec :: Int -> ReadS ListPermissionsResponse
Prelude.Read, Int -> ListPermissionsResponse -> ShowS
[ListPermissionsResponse] -> ShowS
ListPermissionsResponse -> String
(Int -> ListPermissionsResponse -> ShowS)
-> (ListPermissionsResponse -> String)
-> ([ListPermissionsResponse] -> ShowS)
-> Show ListPermissionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPermissionsResponse] -> ShowS
$cshowList :: [ListPermissionsResponse] -> ShowS
show :: ListPermissionsResponse -> String
$cshow :: ListPermissionsResponse -> String
showsPrec :: Int -> ListPermissionsResponse -> ShowS
$cshowsPrec :: Int -> ListPermissionsResponse -> ShowS
Prelude.Show, (forall x.
 ListPermissionsResponse -> Rep ListPermissionsResponse x)
-> (forall x.
    Rep ListPermissionsResponse x -> ListPermissionsResponse)
-> Generic ListPermissionsResponse
forall x. Rep ListPermissionsResponse x -> ListPermissionsResponse
forall x. ListPermissionsResponse -> Rep ListPermissionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPermissionsResponse x -> ListPermissionsResponse
$cfrom :: forall x. ListPermissionsResponse -> Rep ListPermissionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListPermissionsResponse' 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', 'listPermissionsResponse_nextToken' - The token to use in a subsequent @ListPermissions@ operation to return
-- the next set of results.
--
-- 'httpStatus', 'listPermissionsResponse_httpStatus' - The response's http status code.
--
-- 'permissions', 'listPermissionsResponse_permissions' - The permissions returned by the operation.
newListPermissionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListPermissionsResponse
newListPermissionsResponse :: Int -> ListPermissionsResponse
newListPermissionsResponse Int
pHttpStatus_ =
  ListPermissionsResponse' :: Maybe Text -> Int -> [PermissionEntry] -> ListPermissionsResponse
ListPermissionsResponse'
    { $sel:nextToken:ListPermissionsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListPermissionsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:permissions:ListPermissionsResponse' :: [PermissionEntry]
permissions = [PermissionEntry]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The token to use in a subsequent @ListPermissions@ operation to return
-- the next set of results.
listPermissionsResponse_nextToken :: Lens.Lens' ListPermissionsResponse (Prelude.Maybe Prelude.Text)
listPermissionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListPermissionsResponse -> f ListPermissionsResponse
listPermissionsResponse_nextToken = (ListPermissionsResponse -> Maybe Text)
-> (ListPermissionsResponse
    -> Maybe Text -> ListPermissionsResponse)
-> Lens' ListPermissionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPermissionsResponse' :: ListPermissionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPermissionsResponse
s@ListPermissionsResponse' {} Maybe Text
a -> ListPermissionsResponse
s {$sel:nextToken:ListPermissionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListPermissionsResponse)

-- | The response's http status code.
listPermissionsResponse_httpStatus :: Lens.Lens' ListPermissionsResponse Prelude.Int
listPermissionsResponse_httpStatus :: (Int -> f Int)
-> ListPermissionsResponse -> f ListPermissionsResponse
listPermissionsResponse_httpStatus = (ListPermissionsResponse -> Int)
-> (ListPermissionsResponse -> Int -> ListPermissionsResponse)
-> Lens ListPermissionsResponse ListPermissionsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListPermissionsResponse' :: ListPermissionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListPermissionsResponse
s@ListPermissionsResponse' {} Int
a -> ListPermissionsResponse
s {$sel:httpStatus:ListPermissionsResponse' :: Int
httpStatus = Int
a} :: ListPermissionsResponse)

-- | The permissions returned by the operation.
listPermissionsResponse_permissions :: Lens.Lens' ListPermissionsResponse [PermissionEntry]
listPermissionsResponse_permissions :: ([PermissionEntry] -> f [PermissionEntry])
-> ListPermissionsResponse -> f ListPermissionsResponse
listPermissionsResponse_permissions = (ListPermissionsResponse -> [PermissionEntry])
-> (ListPermissionsResponse
    -> [PermissionEntry] -> ListPermissionsResponse)
-> Lens' ListPermissionsResponse [PermissionEntry]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissionsResponse' {[PermissionEntry]
permissions :: [PermissionEntry]
$sel:permissions:ListPermissionsResponse' :: ListPermissionsResponse -> [PermissionEntry]
permissions} -> [PermissionEntry]
permissions) (\s :: ListPermissionsResponse
s@ListPermissionsResponse' {} [PermissionEntry]
a -> ListPermissionsResponse
s {$sel:permissions:ListPermissionsResponse' :: [PermissionEntry]
permissions = [PermissionEntry]
a} :: ListPermissionsResponse) (([PermissionEntry] -> f [PermissionEntry])
 -> ListPermissionsResponse -> f ListPermissionsResponse)
-> (([PermissionEntry] -> f [PermissionEntry])
    -> [PermissionEntry] -> f [PermissionEntry])
-> ([PermissionEntry] -> f [PermissionEntry])
-> ListPermissionsResponse
-> f ListPermissionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([PermissionEntry] -> f [PermissionEntry])
-> [PermissionEntry] -> f [PermissionEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData ListPermissionsResponse