{-# 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.IoTSiteWise.ListAccessPolicies
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves a paginated list of access policies for an identity (an IAM
-- Identity Center user, an IAM Identity Center group, or an IAM user) or
-- an IoT SiteWise Monitor resource (a portal or project).
--
-- This operation returns paginated results.
module Amazonka.IoTSiteWise.ListAccessPolicies
  ( -- * Creating a Request
    ListAccessPolicies (..),
    newListAccessPolicies,

    -- * Request Lenses
    listAccessPolicies_iamArn,
    listAccessPolicies_identityId,
    listAccessPolicies_identityType,
    listAccessPolicies_maxResults,
    listAccessPolicies_nextToken,
    listAccessPolicies_resourceId,
    listAccessPolicies_resourceType,

    -- * Destructuring the Response
    ListAccessPoliciesResponse (..),
    newListAccessPoliciesResponse,

    -- * Response Lenses
    listAccessPoliciesResponse_nextToken,
    listAccessPoliciesResponse_httpStatus,
    listAccessPoliciesResponse_accessPolicySummaries,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTSiteWise.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListAccessPolicies' smart constructor.
data ListAccessPolicies = ListAccessPolicies'
  { -- | The ARN of the IAM user. For more information, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html IAM ARNs>
    -- in the /IAM User Guide/. This parameter is required if you specify @IAM@
    -- for @identityType@.
    ListAccessPolicies -> Maybe Text
iamArn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the identity. This parameter is required if you specify @USER@
    -- or @GROUP@ for @identityType@.
    ListAccessPolicies -> Maybe Text
identityId :: Prelude.Maybe Prelude.Text,
    -- | The type of identity (IAM Identity Center user, IAM Identity Center
    -- group, or IAM user). This parameter is required if you specify
    -- @identityId@.
    ListAccessPolicies -> Maybe IdentityType
identityType :: Prelude.Maybe IdentityType,
    -- | The maximum number of results to return for each paginated request.
    --
    -- Default: 50
    ListAccessPolicies -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token to be used for the next set of paginated results.
    ListAccessPolicies -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The ID of the resource. This parameter is required if you specify
    -- @resourceType@.
    ListAccessPolicies -> Maybe Text
resourceId :: Prelude.Maybe Prelude.Text,
    -- | The type of resource (portal or project). This parameter is required if
    -- you specify @resourceId@.
    ListAccessPolicies -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType
  }
  deriving (ListAccessPolicies -> ListAccessPolicies -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccessPolicies -> ListAccessPolicies -> Bool
$c/= :: ListAccessPolicies -> ListAccessPolicies -> Bool
== :: ListAccessPolicies -> ListAccessPolicies -> Bool
$c== :: ListAccessPolicies -> ListAccessPolicies -> Bool
Prelude.Eq, ReadPrec [ListAccessPolicies]
ReadPrec ListAccessPolicies
Int -> ReadS ListAccessPolicies
ReadS [ListAccessPolicies]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAccessPolicies]
$creadListPrec :: ReadPrec [ListAccessPolicies]
readPrec :: ReadPrec ListAccessPolicies
$creadPrec :: ReadPrec ListAccessPolicies
readList :: ReadS [ListAccessPolicies]
$creadList :: ReadS [ListAccessPolicies]
readsPrec :: Int -> ReadS ListAccessPolicies
$creadsPrec :: Int -> ReadS ListAccessPolicies
Prelude.Read, Int -> ListAccessPolicies -> ShowS
[ListAccessPolicies] -> ShowS
ListAccessPolicies -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccessPolicies] -> ShowS
$cshowList :: [ListAccessPolicies] -> ShowS
show :: ListAccessPolicies -> String
$cshow :: ListAccessPolicies -> String
showsPrec :: Int -> ListAccessPolicies -> ShowS
$cshowsPrec :: Int -> ListAccessPolicies -> ShowS
Prelude.Show, forall x. Rep ListAccessPolicies x -> ListAccessPolicies
forall x. ListAccessPolicies -> Rep ListAccessPolicies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAccessPolicies x -> ListAccessPolicies
$cfrom :: forall x. ListAccessPolicies -> Rep ListAccessPolicies x
Prelude.Generic)

-- |
-- Create a value of 'ListAccessPolicies' 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:
--
-- 'iamArn', 'listAccessPolicies_iamArn' - The ARN of the IAM user. For more information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html IAM ARNs>
-- in the /IAM User Guide/. This parameter is required if you specify @IAM@
-- for @identityType@.
--
-- 'identityId', 'listAccessPolicies_identityId' - The ID of the identity. This parameter is required if you specify @USER@
-- or @GROUP@ for @identityType@.
--
-- 'identityType', 'listAccessPolicies_identityType' - The type of identity (IAM Identity Center user, IAM Identity Center
-- group, or IAM user). This parameter is required if you specify
-- @identityId@.
--
-- 'maxResults', 'listAccessPolicies_maxResults' - The maximum number of results to return for each paginated request.
--
-- Default: 50
--
-- 'nextToken', 'listAccessPolicies_nextToken' - The token to be used for the next set of paginated results.
--
-- 'resourceId', 'listAccessPolicies_resourceId' - The ID of the resource. This parameter is required if you specify
-- @resourceType@.
--
-- 'resourceType', 'listAccessPolicies_resourceType' - The type of resource (portal or project). This parameter is required if
-- you specify @resourceId@.
newListAccessPolicies ::
  ListAccessPolicies
newListAccessPolicies :: ListAccessPolicies
newListAccessPolicies =
  ListAccessPolicies'
    { $sel:iamArn:ListAccessPolicies' :: Maybe Text
iamArn = forall a. Maybe a
Prelude.Nothing,
      $sel:identityId:ListAccessPolicies' :: Maybe Text
identityId = forall a. Maybe a
Prelude.Nothing,
      $sel:identityType:ListAccessPolicies' :: Maybe IdentityType
identityType = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListAccessPolicies' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListAccessPolicies' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceId:ListAccessPolicies' :: Maybe Text
resourceId = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:ListAccessPolicies' :: Maybe ResourceType
resourceType = forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the IAM user. For more information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html IAM ARNs>
-- in the /IAM User Guide/. This parameter is required if you specify @IAM@
-- for @identityType@.
listAccessPolicies_iamArn :: Lens.Lens' ListAccessPolicies (Prelude.Maybe Prelude.Text)
listAccessPolicies_iamArn :: Lens' ListAccessPolicies (Maybe Text)
listAccessPolicies_iamArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessPolicies' {Maybe Text
iamArn :: Maybe Text
$sel:iamArn:ListAccessPolicies' :: ListAccessPolicies -> Maybe Text
iamArn} -> Maybe Text
iamArn) (\s :: ListAccessPolicies
s@ListAccessPolicies' {} Maybe Text
a -> ListAccessPolicies
s {$sel:iamArn:ListAccessPolicies' :: Maybe Text
iamArn = Maybe Text
a} :: ListAccessPolicies)

-- | The ID of the identity. This parameter is required if you specify @USER@
-- or @GROUP@ for @identityType@.
listAccessPolicies_identityId :: Lens.Lens' ListAccessPolicies (Prelude.Maybe Prelude.Text)
listAccessPolicies_identityId :: Lens' ListAccessPolicies (Maybe Text)
listAccessPolicies_identityId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessPolicies' {Maybe Text
identityId :: Maybe Text
$sel:identityId:ListAccessPolicies' :: ListAccessPolicies -> Maybe Text
identityId} -> Maybe Text
identityId) (\s :: ListAccessPolicies
s@ListAccessPolicies' {} Maybe Text
a -> ListAccessPolicies
s {$sel:identityId:ListAccessPolicies' :: Maybe Text
identityId = Maybe Text
a} :: ListAccessPolicies)

-- | The type of identity (IAM Identity Center user, IAM Identity Center
-- group, or IAM user). This parameter is required if you specify
-- @identityId@.
listAccessPolicies_identityType :: Lens.Lens' ListAccessPolicies (Prelude.Maybe IdentityType)
listAccessPolicies_identityType :: Lens' ListAccessPolicies (Maybe IdentityType)
listAccessPolicies_identityType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessPolicies' {Maybe IdentityType
identityType :: Maybe IdentityType
$sel:identityType:ListAccessPolicies' :: ListAccessPolicies -> Maybe IdentityType
identityType} -> Maybe IdentityType
identityType) (\s :: ListAccessPolicies
s@ListAccessPolicies' {} Maybe IdentityType
a -> ListAccessPolicies
s {$sel:identityType:ListAccessPolicies' :: Maybe IdentityType
identityType = Maybe IdentityType
a} :: ListAccessPolicies)

-- | The maximum number of results to return for each paginated request.
--
-- Default: 50
listAccessPolicies_maxResults :: Lens.Lens' ListAccessPolicies (Prelude.Maybe Prelude.Natural)
listAccessPolicies_maxResults :: Lens' ListAccessPolicies (Maybe Natural)
listAccessPolicies_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessPolicies' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListAccessPolicies' :: ListAccessPolicies -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListAccessPolicies
s@ListAccessPolicies' {} Maybe Natural
a -> ListAccessPolicies
s {$sel:maxResults:ListAccessPolicies' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListAccessPolicies)

-- | The token to be used for the next set of paginated results.
listAccessPolicies_nextToken :: Lens.Lens' ListAccessPolicies (Prelude.Maybe Prelude.Text)
listAccessPolicies_nextToken :: Lens' ListAccessPolicies (Maybe Text)
listAccessPolicies_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessPolicies' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAccessPolicies' :: ListAccessPolicies -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAccessPolicies
s@ListAccessPolicies' {} Maybe Text
a -> ListAccessPolicies
s {$sel:nextToken:ListAccessPolicies' :: Maybe Text
nextToken = Maybe Text
a} :: ListAccessPolicies)

-- | The ID of the resource. This parameter is required if you specify
-- @resourceType@.
listAccessPolicies_resourceId :: Lens.Lens' ListAccessPolicies (Prelude.Maybe Prelude.Text)
listAccessPolicies_resourceId :: Lens' ListAccessPolicies (Maybe Text)
listAccessPolicies_resourceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessPolicies' {Maybe Text
resourceId :: Maybe Text
$sel:resourceId:ListAccessPolicies' :: ListAccessPolicies -> Maybe Text
resourceId} -> Maybe Text
resourceId) (\s :: ListAccessPolicies
s@ListAccessPolicies' {} Maybe Text
a -> ListAccessPolicies
s {$sel:resourceId:ListAccessPolicies' :: Maybe Text
resourceId = Maybe Text
a} :: ListAccessPolicies)

-- | The type of resource (portal or project). This parameter is required if
-- you specify @resourceId@.
listAccessPolicies_resourceType :: Lens.Lens' ListAccessPolicies (Prelude.Maybe ResourceType)
listAccessPolicies_resourceType :: Lens' ListAccessPolicies (Maybe ResourceType)
listAccessPolicies_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessPolicies' {Maybe ResourceType
resourceType :: Maybe ResourceType
$sel:resourceType:ListAccessPolicies' :: ListAccessPolicies -> Maybe ResourceType
resourceType} -> Maybe ResourceType
resourceType) (\s :: ListAccessPolicies
s@ListAccessPolicies' {} Maybe ResourceType
a -> ListAccessPolicies
s {$sel:resourceType:ListAccessPolicies' :: Maybe ResourceType
resourceType = Maybe ResourceType
a} :: ListAccessPolicies)

instance Core.AWSPager ListAccessPolicies where
  page :: ListAccessPolicies
-> AWSResponse ListAccessPolicies -> Maybe ListAccessPolicies
page ListAccessPolicies
rq AWSResponse ListAccessPolicies
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAccessPolicies
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAccessPoliciesResponse (Maybe Text)
listAccessPoliciesResponse_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 ListAccessPolicies
rs
            forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListAccessPoliciesResponse [AccessPolicySummary]
listAccessPoliciesResponse_accessPolicySummaries
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListAccessPolicies
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListAccessPolicies (Maybe Text)
listAccessPolicies_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAccessPolicies
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAccessPoliciesResponse (Maybe Text)
listAccessPoliciesResponse_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 ListAccessPolicies where
  type
    AWSResponse ListAccessPolicies =
      ListAccessPoliciesResponse
  request :: (Service -> Service)
-> ListAccessPolicies -> Request ListAccessPolicies
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 ListAccessPolicies
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListAccessPolicies)))
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
-> Int -> [AccessPolicySummary] -> ListAccessPoliciesResponse
ListAccessPoliciesResponse'
            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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            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
"accessPolicySummaries"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ListAccessPolicies where
  hashWithSalt :: Int -> ListAccessPolicies -> Int
hashWithSalt Int
_salt ListAccessPolicies' {Maybe Natural
Maybe Text
Maybe IdentityType
Maybe ResourceType
resourceType :: Maybe ResourceType
resourceId :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
identityType :: Maybe IdentityType
identityId :: Maybe Text
iamArn :: Maybe Text
$sel:resourceType:ListAccessPolicies' :: ListAccessPolicies -> Maybe ResourceType
$sel:resourceId:ListAccessPolicies' :: ListAccessPolicies -> Maybe Text
$sel:nextToken:ListAccessPolicies' :: ListAccessPolicies -> Maybe Text
$sel:maxResults:ListAccessPolicies' :: ListAccessPolicies -> Maybe Natural
$sel:identityType:ListAccessPolicies' :: ListAccessPolicies -> Maybe IdentityType
$sel:identityId:ListAccessPolicies' :: ListAccessPolicies -> Maybe Text
$sel:iamArn:ListAccessPolicies' :: ListAccessPolicies -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
iamArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
identityId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe IdentityType
identityType
      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 Text
resourceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResourceType
resourceType

instance Prelude.NFData ListAccessPolicies where
  rnf :: ListAccessPolicies -> ()
rnf ListAccessPolicies' {Maybe Natural
Maybe Text
Maybe IdentityType
Maybe ResourceType
resourceType :: Maybe ResourceType
resourceId :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
identityType :: Maybe IdentityType
identityId :: Maybe Text
iamArn :: Maybe Text
$sel:resourceType:ListAccessPolicies' :: ListAccessPolicies -> Maybe ResourceType
$sel:resourceId:ListAccessPolicies' :: ListAccessPolicies -> Maybe Text
$sel:nextToken:ListAccessPolicies' :: ListAccessPolicies -> Maybe Text
$sel:maxResults:ListAccessPolicies' :: ListAccessPolicies -> Maybe Natural
$sel:identityType:ListAccessPolicies' :: ListAccessPolicies -> Maybe IdentityType
$sel:identityId:ListAccessPolicies' :: ListAccessPolicies -> Maybe Text
$sel:iamArn:ListAccessPolicies' :: ListAccessPolicies -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
iamArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
identityId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe IdentityType
identityType
      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 Text
resourceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceType
resourceType

instance Data.ToHeaders ListAccessPolicies where
  toHeaders :: ListAccessPolicies -> 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.ToPath ListAccessPolicies where
  toPath :: ListAccessPolicies -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/access-policies"

instance Data.ToQuery ListAccessPolicies where
  toQuery :: ListAccessPolicies -> QueryString
toQuery ListAccessPolicies' {Maybe Natural
Maybe Text
Maybe IdentityType
Maybe ResourceType
resourceType :: Maybe ResourceType
resourceId :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
identityType :: Maybe IdentityType
identityId :: Maybe Text
iamArn :: Maybe Text
$sel:resourceType:ListAccessPolicies' :: ListAccessPolicies -> Maybe ResourceType
$sel:resourceId:ListAccessPolicies' :: ListAccessPolicies -> Maybe Text
$sel:nextToken:ListAccessPolicies' :: ListAccessPolicies -> Maybe Text
$sel:maxResults:ListAccessPolicies' :: ListAccessPolicies -> Maybe Natural
$sel:identityType:ListAccessPolicies' :: ListAccessPolicies -> Maybe IdentityType
$sel:identityId:ListAccessPolicies' :: ListAccessPolicies -> Maybe Text
$sel:iamArn:ListAccessPolicies' :: ListAccessPolicies -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"iamArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
iamArn,
        ByteString
"identityId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
identityId,
        ByteString
"identityType" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe IdentityType
identityType,
        ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
        ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken,
        ByteString
"resourceId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
resourceId,
        ByteString
"resourceType" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe ResourceType
resourceType
      ]

-- | /See:/ 'newListAccessPoliciesResponse' smart constructor.
data ListAccessPoliciesResponse = ListAccessPoliciesResponse'
  { -- | The token for the next set of results, or null if there are no
    -- additional results.
    ListAccessPoliciesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListAccessPoliciesResponse -> Int
httpStatus :: Prelude.Int,
    -- | A list that summarizes each access policy.
    ListAccessPoliciesResponse -> [AccessPolicySummary]
accessPolicySummaries :: [AccessPolicySummary]
  }
  deriving (ListAccessPoliciesResponse -> ListAccessPoliciesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccessPoliciesResponse -> ListAccessPoliciesResponse -> Bool
$c/= :: ListAccessPoliciesResponse -> ListAccessPoliciesResponse -> Bool
== :: ListAccessPoliciesResponse -> ListAccessPoliciesResponse -> Bool
$c== :: ListAccessPoliciesResponse -> ListAccessPoliciesResponse -> Bool
Prelude.Eq, ReadPrec [ListAccessPoliciesResponse]
ReadPrec ListAccessPoliciesResponse
Int -> ReadS ListAccessPoliciesResponse
ReadS [ListAccessPoliciesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAccessPoliciesResponse]
$creadListPrec :: ReadPrec [ListAccessPoliciesResponse]
readPrec :: ReadPrec ListAccessPoliciesResponse
$creadPrec :: ReadPrec ListAccessPoliciesResponse
readList :: ReadS [ListAccessPoliciesResponse]
$creadList :: ReadS [ListAccessPoliciesResponse]
readsPrec :: Int -> ReadS ListAccessPoliciesResponse
$creadsPrec :: Int -> ReadS ListAccessPoliciesResponse
Prelude.Read, Int -> ListAccessPoliciesResponse -> ShowS
[ListAccessPoliciesResponse] -> ShowS
ListAccessPoliciesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccessPoliciesResponse] -> ShowS
$cshowList :: [ListAccessPoliciesResponse] -> ShowS
show :: ListAccessPoliciesResponse -> String
$cshow :: ListAccessPoliciesResponse -> String
showsPrec :: Int -> ListAccessPoliciesResponse -> ShowS
$cshowsPrec :: Int -> ListAccessPoliciesResponse -> ShowS
Prelude.Show, forall x.
Rep ListAccessPoliciesResponse x -> ListAccessPoliciesResponse
forall x.
ListAccessPoliciesResponse -> Rep ListAccessPoliciesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAccessPoliciesResponse x -> ListAccessPoliciesResponse
$cfrom :: forall x.
ListAccessPoliciesResponse -> Rep ListAccessPoliciesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAccessPoliciesResponse' 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', 'listAccessPoliciesResponse_nextToken' - The token for the next set of results, or null if there are no
-- additional results.
--
-- 'httpStatus', 'listAccessPoliciesResponse_httpStatus' - The response's http status code.
--
-- 'accessPolicySummaries', 'listAccessPoliciesResponse_accessPolicySummaries' - A list that summarizes each access policy.
newListAccessPoliciesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAccessPoliciesResponse
newListAccessPoliciesResponse :: Int -> ListAccessPoliciesResponse
newListAccessPoliciesResponse Int
pHttpStatus_ =
  ListAccessPoliciesResponse'
    { $sel:nextToken:ListAccessPoliciesResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAccessPoliciesResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:accessPolicySummaries:ListAccessPoliciesResponse' :: [AccessPolicySummary]
accessPolicySummaries = forall a. Monoid a => a
Prelude.mempty
    }

-- | The token for the next set of results, or null if there are no
-- additional results.
listAccessPoliciesResponse_nextToken :: Lens.Lens' ListAccessPoliciesResponse (Prelude.Maybe Prelude.Text)
listAccessPoliciesResponse_nextToken :: Lens' ListAccessPoliciesResponse (Maybe Text)
listAccessPoliciesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessPoliciesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAccessPoliciesResponse' :: ListAccessPoliciesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAccessPoliciesResponse
s@ListAccessPoliciesResponse' {} Maybe Text
a -> ListAccessPoliciesResponse
s {$sel:nextToken:ListAccessPoliciesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAccessPoliciesResponse)

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

-- | A list that summarizes each access policy.
listAccessPoliciesResponse_accessPolicySummaries :: Lens.Lens' ListAccessPoliciesResponse [AccessPolicySummary]
listAccessPoliciesResponse_accessPolicySummaries :: Lens' ListAccessPoliciesResponse [AccessPolicySummary]
listAccessPoliciesResponse_accessPolicySummaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessPoliciesResponse' {[AccessPolicySummary]
accessPolicySummaries :: [AccessPolicySummary]
$sel:accessPolicySummaries:ListAccessPoliciesResponse' :: ListAccessPoliciesResponse -> [AccessPolicySummary]
accessPolicySummaries} -> [AccessPolicySummary]
accessPolicySummaries) (\s :: ListAccessPoliciesResponse
s@ListAccessPoliciesResponse' {} [AccessPolicySummary]
a -> ListAccessPoliciesResponse
s {$sel:accessPolicySummaries:ListAccessPoliciesResponse' :: [AccessPolicySummary]
accessPolicySummaries = [AccessPolicySummary]
a} :: ListAccessPoliciesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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