{-# 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.LakeFormation.ListPermissions
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns a list of the principal permissions on the resource, filtered by
-- the permissions of the caller. For example, if you are granted an ALTER
-- permission, you are able to see only the principal permissions for
-- ALTER.
--
-- This operation returns only those permissions that have been explicitly
-- granted.
--
-- For information about permissions, see
-- <https://docs-aws.amazon.com/lake-formation/latest/dg/security-data-access.html Security and Access Control to Metadata and Data>.
module Amazonka.LakeFormation.ListPermissions
  ( -- * Creating a Request
    ListPermissions (..),
    newListPermissions,

    -- * Request Lenses
    listPermissions_catalogId,
    listPermissions_includeRelated,
    listPermissions_maxResults,
    listPermissions_nextToken,
    listPermissions_principal,
    listPermissions_resource,
    listPermissions_resourceType,

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

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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LakeFormation.Types
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'
  { -- | The identifier for the Data Catalog. By default, the account ID. The
    -- Data Catalog is the persistent metadata store. It contains database
    -- definitions, table definitions, and other control information to manage
    -- your Lake Formation environment.
    ListPermissions -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
    -- | Indicates that related permissions should be included in the results.
    ListPermissions -> Maybe Text
includeRelated :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return.
    ListPermissions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | A continuation token, if this is not the first call to retrieve this
    -- list.
    ListPermissions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Specifies a principal to filter the permissions returned.
    ListPermissions -> Maybe DataLakePrincipal
principal :: Prelude.Maybe DataLakePrincipal,
    -- | A resource where you will get a list of the principal permissions.
    --
    -- This operation does not support getting privileges on a table with
    -- columns. Instead, call this operation on the table, and the operation
    -- returns the table and the table w columns.
    ListPermissions -> Maybe Resource
resource :: Prelude.Maybe Resource,
    -- | Specifies a resource type to filter the permissions returned.
    ListPermissions -> Maybe DataLakeResourceType
resourceType :: Prelude.Maybe DataLakeResourceType
  }
  deriving (ListPermissions -> ListPermissions -> Bool
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]
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
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. 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:
--
-- 'catalogId', 'listPermissions_catalogId' - The identifier for the Data Catalog. By default, the account ID. The
-- Data Catalog is the persistent metadata store. It contains database
-- definitions, table definitions, and other control information to manage
-- your Lake Formation environment.
--
-- 'includeRelated', 'listPermissions_includeRelated' - Indicates that related permissions should be included in the results.
--
-- 'maxResults', 'listPermissions_maxResults' - The maximum number of results to return.
--
-- 'nextToken', 'listPermissions_nextToken' - A continuation token, if this is not the first call to retrieve this
-- list.
--
-- 'principal', 'listPermissions_principal' - Specifies a principal to filter the permissions returned.
--
-- 'resource', 'listPermissions_resource' - A resource where you will get a list of the principal permissions.
--
-- This operation does not support getting privileges on a table with
-- columns. Instead, call this operation on the table, and the operation
-- returns the table and the table w columns.
--
-- 'resourceType', 'listPermissions_resourceType' - Specifies a resource type to filter the permissions returned.
newListPermissions ::
  ListPermissions
newListPermissions :: ListPermissions
newListPermissions =
  ListPermissions'
    { $sel:catalogId:ListPermissions' :: Maybe Text
catalogId = forall a. Maybe a
Prelude.Nothing,
      $sel:includeRelated:ListPermissions' :: Maybe Text
includeRelated = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListPermissions' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListPermissions' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:principal:ListPermissions' :: Maybe DataLakePrincipal
principal = forall a. Maybe a
Prelude.Nothing,
      $sel:resource:ListPermissions' :: Maybe Resource
resource = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:ListPermissions' :: Maybe DataLakeResourceType
resourceType = forall a. Maybe a
Prelude.Nothing
    }

-- | The identifier for the Data Catalog. By default, the account ID. The
-- Data Catalog is the persistent metadata store. It contains database
-- definitions, table definitions, and other control information to manage
-- your Lake Formation environment.
listPermissions_catalogId :: Lens.Lens' ListPermissions (Prelude.Maybe Prelude.Text)
listPermissions_catalogId :: Lens' ListPermissions (Maybe Text)
listPermissions_catalogId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissions' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:ListPermissions' :: ListPermissions -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: ListPermissions
s@ListPermissions' {} Maybe Text
a -> ListPermissions
s {$sel:catalogId:ListPermissions' :: Maybe Text
catalogId = Maybe Text
a} :: ListPermissions)

-- | Indicates that related permissions should be included in the results.
listPermissions_includeRelated :: Lens.Lens' ListPermissions (Prelude.Maybe Prelude.Text)
listPermissions_includeRelated :: Lens' ListPermissions (Maybe Text)
listPermissions_includeRelated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissions' {Maybe Text
includeRelated :: Maybe Text
$sel:includeRelated:ListPermissions' :: ListPermissions -> Maybe Text
includeRelated} -> Maybe Text
includeRelated) (\s :: ListPermissions
s@ListPermissions' {} Maybe Text
a -> ListPermissions
s {$sel:includeRelated:ListPermissions' :: Maybe Text
includeRelated = Maybe Text
a} :: ListPermissions)

-- | The maximum number of results to return.
listPermissions_maxResults :: Lens.Lens' ListPermissions (Prelude.Maybe Prelude.Natural)
listPermissions_maxResults :: Lens' ListPermissions (Maybe Natural)
listPermissions_maxResults = 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)

-- | A continuation token, if this is not the first call to retrieve this
-- list.
listPermissions_nextToken :: Lens.Lens' ListPermissions (Prelude.Maybe Prelude.Text)
listPermissions_nextToken :: Lens' ListPermissions (Maybe Text)
listPermissions_nextToken = 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)

-- | Specifies a principal to filter the permissions returned.
listPermissions_principal :: Lens.Lens' ListPermissions (Prelude.Maybe DataLakePrincipal)
listPermissions_principal :: Lens' ListPermissions (Maybe DataLakePrincipal)
listPermissions_principal = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissions' {Maybe DataLakePrincipal
principal :: Maybe DataLakePrincipal
$sel:principal:ListPermissions' :: ListPermissions -> Maybe DataLakePrincipal
principal} -> Maybe DataLakePrincipal
principal) (\s :: ListPermissions
s@ListPermissions' {} Maybe DataLakePrincipal
a -> ListPermissions
s {$sel:principal:ListPermissions' :: Maybe DataLakePrincipal
principal = Maybe DataLakePrincipal
a} :: ListPermissions)

-- | A resource where you will get a list of the principal permissions.
--
-- This operation does not support getting privileges on a table with
-- columns. Instead, call this operation on the table, and the operation
-- returns the table and the table w columns.
listPermissions_resource :: Lens.Lens' ListPermissions (Prelude.Maybe Resource)
listPermissions_resource :: Lens' ListPermissions (Maybe Resource)
listPermissions_resource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissions' {Maybe Resource
resource :: Maybe Resource
$sel:resource:ListPermissions' :: ListPermissions -> Maybe Resource
resource} -> Maybe Resource
resource) (\s :: ListPermissions
s@ListPermissions' {} Maybe Resource
a -> ListPermissions
s {$sel:resource:ListPermissions' :: Maybe Resource
resource = Maybe Resource
a} :: ListPermissions)

-- | Specifies a resource type to filter the permissions returned.
listPermissions_resourceType :: Lens.Lens' ListPermissions (Prelude.Maybe DataLakeResourceType)
listPermissions_resourceType :: Lens' ListPermissions (Maybe DataLakeResourceType)
listPermissions_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissions' {Maybe DataLakeResourceType
resourceType :: Maybe DataLakeResourceType
$sel:resourceType:ListPermissions' :: ListPermissions -> Maybe DataLakeResourceType
resourceType} -> Maybe DataLakeResourceType
resourceType) (\s :: ListPermissions
s@ListPermissions' {} Maybe DataLakeResourceType
a -> ListPermissions
s {$sel:resourceType:ListPermissions' :: Maybe DataLakeResourceType
resourceType = Maybe DataLakeResourceType
a} :: ListPermissions)

instance Core.AWSRequest ListPermissions where
  type
    AWSResponse ListPermissions =
      ListPermissionsResponse
  request :: (Service -> Service) -> ListPermissions -> Request ListPermissions
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 ListPermissions
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListPermissions)))
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 [PrincipalResourcePermissions]
-> Int
-> ListPermissionsResponse
ListPermissionsResponse'
            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
"PrincipalResourcePermissions"
                            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 ListPermissions where
  hashWithSalt :: Int -> ListPermissions -> Int
hashWithSalt Int
_salt ListPermissions' {Maybe Natural
Maybe Text
Maybe DataLakePrincipal
Maybe DataLakeResourceType
Maybe Resource
resourceType :: Maybe DataLakeResourceType
resource :: Maybe Resource
principal :: Maybe DataLakePrincipal
nextToken :: Maybe Text
maxResults :: Maybe Natural
includeRelated :: Maybe Text
catalogId :: Maybe Text
$sel:resourceType:ListPermissions' :: ListPermissions -> Maybe DataLakeResourceType
$sel:resource:ListPermissions' :: ListPermissions -> Maybe Resource
$sel:principal:ListPermissions' :: ListPermissions -> Maybe DataLakePrincipal
$sel:nextToken:ListPermissions' :: ListPermissions -> Maybe Text
$sel:maxResults:ListPermissions' :: ListPermissions -> Maybe Natural
$sel:includeRelated:ListPermissions' :: ListPermissions -> Maybe Text
$sel:catalogId:ListPermissions' :: ListPermissions -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
catalogId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
includeRelated
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DataLakePrincipal
principal
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Resource
resource
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DataLakeResourceType
resourceType

instance Prelude.NFData ListPermissions where
  rnf :: ListPermissions -> ()
rnf ListPermissions' {Maybe Natural
Maybe Text
Maybe DataLakePrincipal
Maybe DataLakeResourceType
Maybe Resource
resourceType :: Maybe DataLakeResourceType
resource :: Maybe Resource
principal :: Maybe DataLakePrincipal
nextToken :: Maybe Text
maxResults :: Maybe Natural
includeRelated :: Maybe Text
catalogId :: Maybe Text
$sel:resourceType:ListPermissions' :: ListPermissions -> Maybe DataLakeResourceType
$sel:resource:ListPermissions' :: ListPermissions -> Maybe Resource
$sel:principal:ListPermissions' :: ListPermissions -> Maybe DataLakePrincipal
$sel:nextToken:ListPermissions' :: ListPermissions -> Maybe Text
$sel:maxResults:ListPermissions' :: ListPermissions -> Maybe Natural
$sel:includeRelated:ListPermissions' :: ListPermissions -> Maybe Text
$sel:catalogId:ListPermissions' :: ListPermissions -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
catalogId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
includeRelated
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DataLakePrincipal
principal
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Resource
resource
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DataLakeResourceType
resourceType

instance Data.ToHeaders ListPermissions where
  toHeaders :: ListPermissions -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON ListPermissions where
  toJSON :: ListPermissions -> Value
toJSON ListPermissions' {Maybe Natural
Maybe Text
Maybe DataLakePrincipal
Maybe DataLakeResourceType
Maybe Resource
resourceType :: Maybe DataLakeResourceType
resource :: Maybe Resource
principal :: Maybe DataLakePrincipal
nextToken :: Maybe Text
maxResults :: Maybe Natural
includeRelated :: Maybe Text
catalogId :: Maybe Text
$sel:resourceType:ListPermissions' :: ListPermissions -> Maybe DataLakeResourceType
$sel:resource:ListPermissions' :: ListPermissions -> Maybe Resource
$sel:principal:ListPermissions' :: ListPermissions -> Maybe DataLakePrincipal
$sel:nextToken:ListPermissions' :: ListPermissions -> Maybe Text
$sel:maxResults:ListPermissions' :: ListPermissions -> Maybe Natural
$sel:includeRelated:ListPermissions' :: ListPermissions -> Maybe Text
$sel:catalogId:ListPermissions' :: ListPermissions -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"CatalogId" 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
catalogId,
            (Key
"IncludeRelated" 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
includeRelated,
            (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Key
"Principal" 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 DataLakePrincipal
principal,
            (Key
"Resource" 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 Resource
resource,
            (Key
"ResourceType" 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 DataLakeResourceType
resourceType
          ]
      )

instance Data.ToPath ListPermissions where
  toPath :: ListPermissions -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/ListPermissions"

instance Data.ToQuery ListPermissions where
  toQuery :: ListPermissions -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newListPermissionsResponse' smart constructor.
data ListPermissionsResponse = ListPermissionsResponse'
  { -- | A continuation token, if this is not the first call to retrieve this
    -- list.
    ListPermissionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of principals and their permissions on the resource for the
    -- specified principal and resource types.
    ListPermissionsResponse -> Maybe [PrincipalResourcePermissions]
principalResourcePermissions :: Prelude.Maybe [PrincipalResourcePermissions],
    -- | The response's http status code.
    ListPermissionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListPermissionsResponse -> ListPermissionsResponse -> Bool
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]
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
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. 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' - A continuation token, if this is not the first call to retrieve this
-- list.
--
-- 'principalResourcePermissions', 'listPermissionsResponse_principalResourcePermissions' - A list of principals and their permissions on the resource for the
-- specified principal and resource types.
--
-- 'httpStatus', 'listPermissionsResponse_httpStatus' - The response's http status code.
newListPermissionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListPermissionsResponse
newListPermissionsResponse :: Int -> ListPermissionsResponse
newListPermissionsResponse Int
pHttpStatus_ =
  ListPermissionsResponse'
    { $sel:nextToken:ListPermissionsResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:principalResourcePermissions:ListPermissionsResponse' :: Maybe [PrincipalResourcePermissions]
principalResourcePermissions = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListPermissionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A continuation token, if this is not the first call to retrieve this
-- list.
listPermissionsResponse_nextToken :: Lens.Lens' ListPermissionsResponse (Prelude.Maybe Prelude.Text)
listPermissionsResponse_nextToken :: Lens' ListPermissionsResponse (Maybe Text)
listPermissionsResponse_nextToken = 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)

-- | A list of principals and their permissions on the resource for the
-- specified principal and resource types.
listPermissionsResponse_principalResourcePermissions :: Lens.Lens' ListPermissionsResponse (Prelude.Maybe [PrincipalResourcePermissions])
listPermissionsResponse_principalResourcePermissions :: Lens'
  ListPermissionsResponse (Maybe [PrincipalResourcePermissions])
listPermissionsResponse_principalResourcePermissions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissionsResponse' {Maybe [PrincipalResourcePermissions]
principalResourcePermissions :: Maybe [PrincipalResourcePermissions]
$sel:principalResourcePermissions:ListPermissionsResponse' :: ListPermissionsResponse -> Maybe [PrincipalResourcePermissions]
principalResourcePermissions} -> Maybe [PrincipalResourcePermissions]
principalResourcePermissions) (\s :: ListPermissionsResponse
s@ListPermissionsResponse' {} Maybe [PrincipalResourcePermissions]
a -> ListPermissionsResponse
s {$sel:principalResourcePermissions:ListPermissionsResponse' :: Maybe [PrincipalResourcePermissions]
principalResourcePermissions = Maybe [PrincipalResourcePermissions]
a} :: ListPermissionsResponse) 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

-- | The response's http status code.
listPermissionsResponse_httpStatus :: Lens.Lens' ListPermissionsResponse Prelude.Int
listPermissionsResponse_httpStatus :: Lens' ListPermissionsResponse Int
listPermissionsResponse_httpStatus = 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)

instance Prelude.NFData ListPermissionsResponse where
  rnf :: ListPermissionsResponse -> ()
rnf ListPermissionsResponse' {Int
Maybe [PrincipalResourcePermissions]
Maybe Text
httpStatus :: Int
principalResourcePermissions :: Maybe [PrincipalResourcePermissions]
nextToken :: Maybe Text
$sel:httpStatus:ListPermissionsResponse' :: ListPermissionsResponse -> Int
$sel:principalResourcePermissions:ListPermissionsResponse' :: ListPermissionsResponse -> Maybe [PrincipalResourcePermissions]
$sel:nextToken:ListPermissionsResponse' :: ListPermissionsResponse -> 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 [PrincipalResourcePermissions]
principalResourcePermissions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus