{-# 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.IAM.ListEntitiesForPolicy
-- 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 IAM users, groups, and roles that the specified managed policy
-- is attached to.
--
-- You can use the optional @EntityFilter@ parameter to limit the results
-- to a particular type of entity (users, groups, or roles). For example,
-- to list only the roles that are attached to the specified policy, set
-- @EntityFilter@ to @Role@.
--
-- You can paginate the results using the @MaxItems@ and @Marker@
-- parameters.
--
-- This operation returns paginated results.
module Amazonka.IAM.ListEntitiesForPolicy
  ( -- * Creating a Request
    ListEntitiesForPolicy (..),
    newListEntitiesForPolicy,

    -- * Request Lenses
    listEntitiesForPolicy_pathPrefix,
    listEntitiesForPolicy_entityFilter,
    listEntitiesForPolicy_marker,
    listEntitiesForPolicy_maxItems,
    listEntitiesForPolicy_policyUsageFilter,
    listEntitiesForPolicy_policyArn,

    -- * Destructuring the Response
    ListEntitiesForPolicyResponse (..),
    newListEntitiesForPolicyResponse,

    -- * Response Lenses
    listEntitiesForPolicyResponse_policyGroups,
    listEntitiesForPolicyResponse_policyRoles,
    listEntitiesForPolicyResponse_marker,
    listEntitiesForPolicyResponse_policyUsers,
    listEntitiesForPolicyResponse_isTruncated,
    listEntitiesForPolicyResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IAM.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:/ 'newListEntitiesForPolicy' smart constructor.
data ListEntitiesForPolicy = ListEntitiesForPolicy'
  { -- | The path prefix for filtering the results. This parameter is optional.
    -- If it is not included, it defaults to a slash (\/), listing all
    -- entities.
    --
    -- This parameter allows (through its
    -- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
    -- consisting of either a forward slash (\/) by itself or a string that
    -- must begin and end with forward slashes. In addition, it can contain any
    -- ASCII character from the ! (@\\u0021@) through the DEL character
    -- (@\\u007F@), including most punctuation characters, digits, and upper
    -- and lowercased letters.
    ListEntitiesForPolicy -> Maybe Text
pathPrefix :: Prelude.Maybe Prelude.Text,
    -- | The entity type to use for filtering the results.
    --
    -- For example, when @EntityFilter@ is @Role@, only the roles that are
    -- attached to the specified policy are returned. This parameter is
    -- optional. If it is not included, all attached entities (users, groups,
    -- and roles) are returned. The argument for this parameter must be one of
    -- the valid values listed below.
    ListEntitiesForPolicy -> Maybe EntityType
entityFilter :: Prelude.Maybe EntityType,
    -- | Use this parameter only when paginating results and only after you
    -- receive a response indicating that the results are truncated. Set it to
    -- the value of the @Marker@ element in the response that you received to
    -- indicate where the next call should start.
    ListEntitiesForPolicy -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | Use this only when paginating results to indicate the maximum number of
    -- items you want in the response. If additional items exist beyond the
    -- maximum you specify, the @IsTruncated@ response element is @true@.
    --
    -- If you do not include this parameter, the number of items defaults to
    -- 100. Note that IAM might return fewer results, even when there are more
    -- results available. In that case, the @IsTruncated@ response element
    -- returns @true@, and @Marker@ contains a value to include in the
    -- subsequent call that tells the service where to continue from.
    ListEntitiesForPolicy -> Maybe Natural
maxItems :: Prelude.Maybe Prelude.Natural,
    -- | The policy usage method to use for filtering the results.
    --
    -- To list only permissions policies,
    -- set @PolicyUsageFilter@ to @PermissionsPolicy@. To list only the
    -- policies used to set permissions boundaries, set the value
    -- to @PermissionsBoundary@.
    --
    -- This parameter is optional. If it is not included, all policies are
    -- returned.
    ListEntitiesForPolicy -> Maybe PolicyUsageType
policyUsageFilter :: Prelude.Maybe PolicyUsageType,
    -- | The Amazon Resource Name (ARN) of the IAM policy for which you want the
    -- versions.
    --
    -- For more information about ARNs, see
    -- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs)>
    -- in the /Amazon Web Services General Reference/.
    ListEntitiesForPolicy -> Text
policyArn :: Prelude.Text
  }
  deriving (ListEntitiesForPolicy -> ListEntitiesForPolicy -> Bool
(ListEntitiesForPolicy -> ListEntitiesForPolicy -> Bool)
-> (ListEntitiesForPolicy -> ListEntitiesForPolicy -> Bool)
-> Eq ListEntitiesForPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEntitiesForPolicy -> ListEntitiesForPolicy -> Bool
$c/= :: ListEntitiesForPolicy -> ListEntitiesForPolicy -> Bool
== :: ListEntitiesForPolicy -> ListEntitiesForPolicy -> Bool
$c== :: ListEntitiesForPolicy -> ListEntitiesForPolicy -> Bool
Prelude.Eq, ReadPrec [ListEntitiesForPolicy]
ReadPrec ListEntitiesForPolicy
Int -> ReadS ListEntitiesForPolicy
ReadS [ListEntitiesForPolicy]
(Int -> ReadS ListEntitiesForPolicy)
-> ReadS [ListEntitiesForPolicy]
-> ReadPrec ListEntitiesForPolicy
-> ReadPrec [ListEntitiesForPolicy]
-> Read ListEntitiesForPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEntitiesForPolicy]
$creadListPrec :: ReadPrec [ListEntitiesForPolicy]
readPrec :: ReadPrec ListEntitiesForPolicy
$creadPrec :: ReadPrec ListEntitiesForPolicy
readList :: ReadS [ListEntitiesForPolicy]
$creadList :: ReadS [ListEntitiesForPolicy]
readsPrec :: Int -> ReadS ListEntitiesForPolicy
$creadsPrec :: Int -> ReadS ListEntitiesForPolicy
Prelude.Read, Int -> ListEntitiesForPolicy -> ShowS
[ListEntitiesForPolicy] -> ShowS
ListEntitiesForPolicy -> String
(Int -> ListEntitiesForPolicy -> ShowS)
-> (ListEntitiesForPolicy -> String)
-> ([ListEntitiesForPolicy] -> ShowS)
-> Show ListEntitiesForPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEntitiesForPolicy] -> ShowS
$cshowList :: [ListEntitiesForPolicy] -> ShowS
show :: ListEntitiesForPolicy -> String
$cshow :: ListEntitiesForPolicy -> String
showsPrec :: Int -> ListEntitiesForPolicy -> ShowS
$cshowsPrec :: Int -> ListEntitiesForPolicy -> ShowS
Prelude.Show, (forall x. ListEntitiesForPolicy -> Rep ListEntitiesForPolicy x)
-> (forall x. Rep ListEntitiesForPolicy x -> ListEntitiesForPolicy)
-> Generic ListEntitiesForPolicy
forall x. Rep ListEntitiesForPolicy x -> ListEntitiesForPolicy
forall x. ListEntitiesForPolicy -> Rep ListEntitiesForPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListEntitiesForPolicy x -> ListEntitiesForPolicy
$cfrom :: forall x. ListEntitiesForPolicy -> Rep ListEntitiesForPolicy x
Prelude.Generic)

-- |
-- Create a value of 'ListEntitiesForPolicy' 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:
--
-- 'pathPrefix', 'listEntitiesForPolicy_pathPrefix' - The path prefix for filtering the results. This parameter is optional.
-- If it is not included, it defaults to a slash (\/), listing all
-- entities.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of either a forward slash (\/) by itself or a string that
-- must begin and end with forward slashes. In addition, it can contain any
-- ASCII character from the ! (@\\u0021@) through the DEL character
-- (@\\u007F@), including most punctuation characters, digits, and upper
-- and lowercased letters.
--
-- 'entityFilter', 'listEntitiesForPolicy_entityFilter' - The entity type to use for filtering the results.
--
-- For example, when @EntityFilter@ is @Role@, only the roles that are
-- attached to the specified policy are returned. This parameter is
-- optional. If it is not included, all attached entities (users, groups,
-- and roles) are returned. The argument for this parameter must be one of
-- the valid values listed below.
--
-- 'marker', 'listEntitiesForPolicy_marker' - Use this parameter only when paginating results and only after you
-- receive a response indicating that the results are truncated. Set it to
-- the value of the @Marker@ element in the response that you received to
-- indicate where the next call should start.
--
-- 'maxItems', 'listEntitiesForPolicy_maxItems' - Use this only when paginating results to indicate the maximum number of
-- items you want in the response. If additional items exist beyond the
-- maximum you specify, the @IsTruncated@ response element is @true@.
--
-- If you do not include this parameter, the number of items defaults to
-- 100. Note that IAM might return fewer results, even when there are more
-- results available. In that case, the @IsTruncated@ response element
-- returns @true@, and @Marker@ contains a value to include in the
-- subsequent call that tells the service where to continue from.
--
-- 'policyUsageFilter', 'listEntitiesForPolicy_policyUsageFilter' - The policy usage method to use for filtering the results.
--
-- To list only permissions policies,
-- set @PolicyUsageFilter@ to @PermissionsPolicy@. To list only the
-- policies used to set permissions boundaries, set the value
-- to @PermissionsBoundary@.
--
-- This parameter is optional. If it is not included, all policies are
-- returned.
--
-- 'policyArn', 'listEntitiesForPolicy_policyArn' - The Amazon Resource Name (ARN) of the IAM policy for which you want the
-- versions.
--
-- For more information about ARNs, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs)>
-- in the /Amazon Web Services General Reference/.
newListEntitiesForPolicy ::
  -- | 'policyArn'
  Prelude.Text ->
  ListEntitiesForPolicy
newListEntitiesForPolicy :: Text -> ListEntitiesForPolicy
newListEntitiesForPolicy Text
pPolicyArn_ =
  ListEntitiesForPolicy' :: Maybe Text
-> Maybe EntityType
-> Maybe Text
-> Maybe Natural
-> Maybe PolicyUsageType
-> Text
-> ListEntitiesForPolicy
ListEntitiesForPolicy'
    { $sel:pathPrefix:ListEntitiesForPolicy' :: Maybe Text
pathPrefix =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:entityFilter:ListEntitiesForPolicy' :: Maybe EntityType
entityFilter = Maybe EntityType
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:ListEntitiesForPolicy' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxItems:ListEntitiesForPolicy' :: Maybe Natural
maxItems = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:policyUsageFilter:ListEntitiesForPolicy' :: Maybe PolicyUsageType
policyUsageFilter = Maybe PolicyUsageType
forall a. Maybe a
Prelude.Nothing,
      $sel:policyArn:ListEntitiesForPolicy' :: Text
policyArn = Text
pPolicyArn_
    }

-- | The path prefix for filtering the results. This parameter is optional.
-- If it is not included, it defaults to a slash (\/), listing all
-- entities.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of either a forward slash (\/) by itself or a string that
-- must begin and end with forward slashes. In addition, it can contain any
-- ASCII character from the ! (@\\u0021@) through the DEL character
-- (@\\u007F@), including most punctuation characters, digits, and upper
-- and lowercased letters.
listEntitiesForPolicy_pathPrefix :: Lens.Lens' ListEntitiesForPolicy (Prelude.Maybe Prelude.Text)
listEntitiesForPolicy_pathPrefix :: (Maybe Text -> f (Maybe Text))
-> ListEntitiesForPolicy -> f ListEntitiesForPolicy
listEntitiesForPolicy_pathPrefix = (ListEntitiesForPolicy -> Maybe Text)
-> (ListEntitiesForPolicy -> Maybe Text -> ListEntitiesForPolicy)
-> Lens
     ListEntitiesForPolicy
     ListEntitiesForPolicy
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEntitiesForPolicy' {Maybe Text
pathPrefix :: Maybe Text
$sel:pathPrefix:ListEntitiesForPolicy' :: ListEntitiesForPolicy -> Maybe Text
pathPrefix} -> Maybe Text
pathPrefix) (\s :: ListEntitiesForPolicy
s@ListEntitiesForPolicy' {} Maybe Text
a -> ListEntitiesForPolicy
s {$sel:pathPrefix:ListEntitiesForPolicy' :: Maybe Text
pathPrefix = Maybe Text
a} :: ListEntitiesForPolicy)

-- | The entity type to use for filtering the results.
--
-- For example, when @EntityFilter@ is @Role@, only the roles that are
-- attached to the specified policy are returned. This parameter is
-- optional. If it is not included, all attached entities (users, groups,
-- and roles) are returned. The argument for this parameter must be one of
-- the valid values listed below.
listEntitiesForPolicy_entityFilter :: Lens.Lens' ListEntitiesForPolicy (Prelude.Maybe EntityType)
listEntitiesForPolicy_entityFilter :: (Maybe EntityType -> f (Maybe EntityType))
-> ListEntitiesForPolicy -> f ListEntitiesForPolicy
listEntitiesForPolicy_entityFilter = (ListEntitiesForPolicy -> Maybe EntityType)
-> (ListEntitiesForPolicy
    -> Maybe EntityType -> ListEntitiesForPolicy)
-> Lens
     ListEntitiesForPolicy
     ListEntitiesForPolicy
     (Maybe EntityType)
     (Maybe EntityType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEntitiesForPolicy' {Maybe EntityType
entityFilter :: Maybe EntityType
$sel:entityFilter:ListEntitiesForPolicy' :: ListEntitiesForPolicy -> Maybe EntityType
entityFilter} -> Maybe EntityType
entityFilter) (\s :: ListEntitiesForPolicy
s@ListEntitiesForPolicy' {} Maybe EntityType
a -> ListEntitiesForPolicy
s {$sel:entityFilter:ListEntitiesForPolicy' :: Maybe EntityType
entityFilter = Maybe EntityType
a} :: ListEntitiesForPolicy)

-- | Use this parameter only when paginating results and only after you
-- receive a response indicating that the results are truncated. Set it to
-- the value of the @Marker@ element in the response that you received to
-- indicate where the next call should start.
listEntitiesForPolicy_marker :: Lens.Lens' ListEntitiesForPolicy (Prelude.Maybe Prelude.Text)
listEntitiesForPolicy_marker :: (Maybe Text -> f (Maybe Text))
-> ListEntitiesForPolicy -> f ListEntitiesForPolicy
listEntitiesForPolicy_marker = (ListEntitiesForPolicy -> Maybe Text)
-> (ListEntitiesForPolicy -> Maybe Text -> ListEntitiesForPolicy)
-> Lens
     ListEntitiesForPolicy
     ListEntitiesForPolicy
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEntitiesForPolicy' {Maybe Text
marker :: Maybe Text
$sel:marker:ListEntitiesForPolicy' :: ListEntitiesForPolicy -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListEntitiesForPolicy
s@ListEntitiesForPolicy' {} Maybe Text
a -> ListEntitiesForPolicy
s {$sel:marker:ListEntitiesForPolicy' :: Maybe Text
marker = Maybe Text
a} :: ListEntitiesForPolicy)

-- | Use this only when paginating results to indicate the maximum number of
-- items you want in the response. If additional items exist beyond the
-- maximum you specify, the @IsTruncated@ response element is @true@.
--
-- If you do not include this parameter, the number of items defaults to
-- 100. Note that IAM might return fewer results, even when there are more
-- results available. In that case, the @IsTruncated@ response element
-- returns @true@, and @Marker@ contains a value to include in the
-- subsequent call that tells the service where to continue from.
listEntitiesForPolicy_maxItems :: Lens.Lens' ListEntitiesForPolicy (Prelude.Maybe Prelude.Natural)
listEntitiesForPolicy_maxItems :: (Maybe Natural -> f (Maybe Natural))
-> ListEntitiesForPolicy -> f ListEntitiesForPolicy
listEntitiesForPolicy_maxItems = (ListEntitiesForPolicy -> Maybe Natural)
-> (ListEntitiesForPolicy
    -> Maybe Natural -> ListEntitiesForPolicy)
-> Lens
     ListEntitiesForPolicy
     ListEntitiesForPolicy
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEntitiesForPolicy' {Maybe Natural
maxItems :: Maybe Natural
$sel:maxItems:ListEntitiesForPolicy' :: ListEntitiesForPolicy -> Maybe Natural
maxItems} -> Maybe Natural
maxItems) (\s :: ListEntitiesForPolicy
s@ListEntitiesForPolicy' {} Maybe Natural
a -> ListEntitiesForPolicy
s {$sel:maxItems:ListEntitiesForPolicy' :: Maybe Natural
maxItems = Maybe Natural
a} :: ListEntitiesForPolicy)

-- | The policy usage method to use for filtering the results.
--
-- To list only permissions policies,
-- set @PolicyUsageFilter@ to @PermissionsPolicy@. To list only the
-- policies used to set permissions boundaries, set the value
-- to @PermissionsBoundary@.
--
-- This parameter is optional. If it is not included, all policies are
-- returned.
listEntitiesForPolicy_policyUsageFilter :: Lens.Lens' ListEntitiesForPolicy (Prelude.Maybe PolicyUsageType)
listEntitiesForPolicy_policyUsageFilter :: (Maybe PolicyUsageType -> f (Maybe PolicyUsageType))
-> ListEntitiesForPolicy -> f ListEntitiesForPolicy
listEntitiesForPolicy_policyUsageFilter = (ListEntitiesForPolicy -> Maybe PolicyUsageType)
-> (ListEntitiesForPolicy
    -> Maybe PolicyUsageType -> ListEntitiesForPolicy)
-> Lens
     ListEntitiesForPolicy
     ListEntitiesForPolicy
     (Maybe PolicyUsageType)
     (Maybe PolicyUsageType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEntitiesForPolicy' {Maybe PolicyUsageType
policyUsageFilter :: Maybe PolicyUsageType
$sel:policyUsageFilter:ListEntitiesForPolicy' :: ListEntitiesForPolicy -> Maybe PolicyUsageType
policyUsageFilter} -> Maybe PolicyUsageType
policyUsageFilter) (\s :: ListEntitiesForPolicy
s@ListEntitiesForPolicy' {} Maybe PolicyUsageType
a -> ListEntitiesForPolicy
s {$sel:policyUsageFilter:ListEntitiesForPolicy' :: Maybe PolicyUsageType
policyUsageFilter = Maybe PolicyUsageType
a} :: ListEntitiesForPolicy)

-- | The Amazon Resource Name (ARN) of the IAM policy for which you want the
-- versions.
--
-- For more information about ARNs, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs)>
-- in the /Amazon Web Services General Reference/.
listEntitiesForPolicy_policyArn :: Lens.Lens' ListEntitiesForPolicy Prelude.Text
listEntitiesForPolicy_policyArn :: (Text -> f Text)
-> ListEntitiesForPolicy -> f ListEntitiesForPolicy
listEntitiesForPolicy_policyArn = (ListEntitiesForPolicy -> Text)
-> (ListEntitiesForPolicy -> Text -> ListEntitiesForPolicy)
-> Lens ListEntitiesForPolicy ListEntitiesForPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEntitiesForPolicy' {Text
policyArn :: Text
$sel:policyArn:ListEntitiesForPolicy' :: ListEntitiesForPolicy -> Text
policyArn} -> Text
policyArn) (\s :: ListEntitiesForPolicy
s@ListEntitiesForPolicy' {} Text
a -> ListEntitiesForPolicy
s {$sel:policyArn:ListEntitiesForPolicy' :: Text
policyArn = Text
a} :: ListEntitiesForPolicy)

instance Core.AWSPager ListEntitiesForPolicy where
  page :: ListEntitiesForPolicy
-> AWSResponse ListEntitiesForPolicy -> Maybe ListEntitiesForPolicy
page ListEntitiesForPolicy
rq AWSResponse ListEntitiesForPolicy
rs
    | Maybe Bool -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListEntitiesForPolicy
ListEntitiesForPolicyResponse
rs
            ListEntitiesForPolicyResponse
-> Getting (First Bool) ListEntitiesForPolicyResponse Bool
-> Maybe Bool
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Bool -> Const (First Bool) (Maybe Bool))
-> ListEntitiesForPolicyResponse
-> Const (First Bool) ListEntitiesForPolicyResponse
Lens' ListEntitiesForPolicyResponse (Maybe Bool)
listEntitiesForPolicyResponse_isTruncated
              ((Maybe Bool -> Const (First Bool) (Maybe Bool))
 -> ListEntitiesForPolicyResponse
 -> Const (First Bool) ListEntitiesForPolicyResponse)
-> ((Bool -> Const (First Bool) Bool)
    -> Maybe Bool -> Const (First Bool) (Maybe Bool))
-> Getting (First Bool) ListEntitiesForPolicyResponse Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Bool -> Const (First Bool) Bool)
-> Maybe Bool -> Const (First Bool) (Maybe Bool)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListEntitiesForPolicy
forall a. Maybe a
Prelude.Nothing
    | Maybe Text -> Bool
forall a. Maybe a -> Bool
Prelude.isNothing
        ( AWSResponse ListEntitiesForPolicy
ListEntitiesForPolicyResponse
rs
            ListEntitiesForPolicyResponse
-> Getting (First Text) ListEntitiesForPolicyResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListEntitiesForPolicyResponse
-> Const (First Text) ListEntitiesForPolicyResponse
Lens' ListEntitiesForPolicyResponse (Maybe Text)
listEntitiesForPolicyResponse_marker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListEntitiesForPolicyResponse
 -> Const (First Text) ListEntitiesForPolicyResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListEntitiesForPolicyResponse 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 ListEntitiesForPolicy
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListEntitiesForPolicy -> Maybe ListEntitiesForPolicy
forall a. a -> Maybe a
Prelude.Just (ListEntitiesForPolicy -> Maybe ListEntitiesForPolicy)
-> ListEntitiesForPolicy -> Maybe ListEntitiesForPolicy
forall a b. (a -> b) -> a -> b
Prelude.$
        ListEntitiesForPolicy
rq
          ListEntitiesForPolicy
-> (ListEntitiesForPolicy -> ListEntitiesForPolicy)
-> ListEntitiesForPolicy
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListEntitiesForPolicy -> Identity ListEntitiesForPolicy
Lens
  ListEntitiesForPolicy
  ListEntitiesForPolicy
  (Maybe Text)
  (Maybe Text)
listEntitiesForPolicy_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> ListEntitiesForPolicy -> Identity ListEntitiesForPolicy)
-> Maybe Text -> ListEntitiesForPolicy -> ListEntitiesForPolicy
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListEntitiesForPolicy
ListEntitiesForPolicyResponse
rs
          ListEntitiesForPolicyResponse
-> Getting (First Text) ListEntitiesForPolicyResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListEntitiesForPolicyResponse
-> Const (First Text) ListEntitiesForPolicyResponse
Lens' ListEntitiesForPolicyResponse (Maybe Text)
listEntitiesForPolicyResponse_marker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListEntitiesForPolicyResponse
 -> Const (First Text) ListEntitiesForPolicyResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListEntitiesForPolicyResponse 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 ListEntitiesForPolicy where
  type
    AWSResponse ListEntitiesForPolicy =
      ListEntitiesForPolicyResponse
  request :: ListEntitiesForPolicy -> Request ListEntitiesForPolicy
request = Service -> ListEntitiesForPolicy -> Request ListEntitiesForPolicy
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy ListEntitiesForPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListEntitiesForPolicy)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse ListEntitiesForPolicy))
-> Logger
-> Service
-> Proxy ListEntitiesForPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListEntitiesForPolicy)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"ListEntitiesForPolicyResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [PolicyGroup]
-> Maybe [PolicyRole]
-> Maybe Text
-> Maybe [PolicyUser]
-> Maybe Bool
-> Int
-> ListEntitiesForPolicyResponse
ListEntitiesForPolicyResponse'
            (Maybe [PolicyGroup]
 -> Maybe [PolicyRole]
 -> Maybe Text
 -> Maybe [PolicyUser]
 -> Maybe Bool
 -> Int
 -> ListEntitiesForPolicyResponse)
-> Either String (Maybe [PolicyGroup])
-> Either
     String
     (Maybe [PolicyRole]
      -> Maybe Text
      -> Maybe [PolicyUser]
      -> Maybe Bool
      -> Int
      -> ListEntitiesForPolicyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PolicyGroups" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (Maybe [PolicyGroup]))
-> Either String (Maybe [PolicyGroup])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [PolicyGroup])
-> [Node] -> Either String (Maybe [PolicyGroup])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [PolicyGroup]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            Either
  String
  (Maybe [PolicyRole]
   -> Maybe Text
   -> Maybe [PolicyUser]
   -> Maybe Bool
   -> Int
   -> ListEntitiesForPolicyResponse)
-> Either String (Maybe [PolicyRole])
-> Either
     String
     (Maybe Text
      -> Maybe [PolicyUser]
      -> Maybe Bool
      -> Int
      -> ListEntitiesForPolicyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PolicyRoles" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (Maybe [PolicyRole]))
-> Either String (Maybe [PolicyRole])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [PolicyRole])
-> [Node] -> Either String (Maybe [PolicyRole])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [PolicyRole]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            Either
  String
  (Maybe Text
   -> Maybe [PolicyUser]
   -> Maybe Bool
   -> Int
   -> ListEntitiesForPolicyResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [PolicyUser]
      -> Maybe Bool -> Int -> ListEntitiesForPolicyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Marker")
            Either
  String
  (Maybe [PolicyUser]
   -> Maybe Bool -> Int -> ListEntitiesForPolicyResponse)
-> Either String (Maybe [PolicyUser])
-> Either
     String (Maybe Bool -> Int -> ListEntitiesForPolicyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PolicyUsers" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (Maybe [PolicyUser]))
-> Either String (Maybe [PolicyUser])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [PolicyUser])
-> [Node] -> Either String (Maybe [PolicyUser])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [PolicyUser]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            Either String (Maybe Bool -> Int -> ListEntitiesForPolicyResponse)
-> Either String (Maybe Bool)
-> Either String (Int -> ListEntitiesForPolicyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"IsTruncated")
            Either String (Int -> ListEntitiesForPolicyResponse)
-> Either String Int -> Either String ListEntitiesForPolicyResponse
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 ListEntitiesForPolicy

instance Prelude.NFData ListEntitiesForPolicy

instance Core.ToHeaders ListEntitiesForPolicy where
  toHeaders :: ListEntitiesForPolicy -> ResponseHeaders
toHeaders = ResponseHeaders -> ListEntitiesForPolicy -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery ListEntitiesForPolicy where
  toQuery :: ListEntitiesForPolicy -> QueryString
toQuery ListEntitiesForPolicy' {Maybe Natural
Maybe Text
Maybe EntityType
Maybe PolicyUsageType
Text
policyArn :: Text
policyUsageFilter :: Maybe PolicyUsageType
maxItems :: Maybe Natural
marker :: Maybe Text
entityFilter :: Maybe EntityType
pathPrefix :: Maybe Text
$sel:policyArn:ListEntitiesForPolicy' :: ListEntitiesForPolicy -> Text
$sel:policyUsageFilter:ListEntitiesForPolicy' :: ListEntitiesForPolicy -> Maybe PolicyUsageType
$sel:maxItems:ListEntitiesForPolicy' :: ListEntitiesForPolicy -> Maybe Natural
$sel:marker:ListEntitiesForPolicy' :: ListEntitiesForPolicy -> Maybe Text
$sel:entityFilter:ListEntitiesForPolicy' :: ListEntitiesForPolicy -> Maybe EntityType
$sel:pathPrefix:ListEntitiesForPolicy' :: ListEntitiesForPolicy -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"ListEntitiesForPolicy" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
        ByteString
"PathPrefix" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
pathPrefix,
        ByteString
"EntityFilter" ByteString -> Maybe EntityType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe EntityType
entityFilter,
        ByteString
"Marker" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
marker,
        ByteString
"MaxItems" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxItems,
        ByteString
"PolicyUsageFilter" ByteString -> Maybe PolicyUsageType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe PolicyUsageType
policyUsageFilter,
        ByteString
"PolicyArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
policyArn
      ]

-- | Contains the response to a successful ListEntitiesForPolicy request.
--
-- /See:/ 'newListEntitiesForPolicyResponse' smart constructor.
data ListEntitiesForPolicyResponse = ListEntitiesForPolicyResponse'
  { -- | A list of IAM groups that the policy is attached to.
    ListEntitiesForPolicyResponse -> Maybe [PolicyGroup]
policyGroups :: Prelude.Maybe [PolicyGroup],
    -- | A list of IAM roles that the policy is attached to.
    ListEntitiesForPolicyResponse -> Maybe [PolicyRole]
policyRoles :: Prelude.Maybe [PolicyRole],
    -- | When @IsTruncated@ is @true@, this element is present and contains the
    -- value to use for the @Marker@ parameter in a subsequent pagination
    -- request.
    ListEntitiesForPolicyResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | A list of IAM users that the policy is attached to.
    ListEntitiesForPolicyResponse -> Maybe [PolicyUser]
policyUsers :: Prelude.Maybe [PolicyUser],
    -- | A flag that indicates whether there are more items to return. If your
    -- results were truncated, you can make a subsequent pagination request
    -- using the @Marker@ request parameter to retrieve more items. Note that
    -- IAM might return fewer than the @MaxItems@ number of results even when
    -- there are more results available. We recommend that you check
    -- @IsTruncated@ after every call to ensure that you receive all your
    -- results.
    ListEntitiesForPolicyResponse -> Maybe Bool
isTruncated :: Prelude.Maybe Prelude.Bool,
    -- | The response's http status code.
    ListEntitiesForPolicyResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListEntitiesForPolicyResponse
-> ListEntitiesForPolicyResponse -> Bool
(ListEntitiesForPolicyResponse
 -> ListEntitiesForPolicyResponse -> Bool)
-> (ListEntitiesForPolicyResponse
    -> ListEntitiesForPolicyResponse -> Bool)
-> Eq ListEntitiesForPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEntitiesForPolicyResponse
-> ListEntitiesForPolicyResponse -> Bool
$c/= :: ListEntitiesForPolicyResponse
-> ListEntitiesForPolicyResponse -> Bool
== :: ListEntitiesForPolicyResponse
-> ListEntitiesForPolicyResponse -> Bool
$c== :: ListEntitiesForPolicyResponse
-> ListEntitiesForPolicyResponse -> Bool
Prelude.Eq, ReadPrec [ListEntitiesForPolicyResponse]
ReadPrec ListEntitiesForPolicyResponse
Int -> ReadS ListEntitiesForPolicyResponse
ReadS [ListEntitiesForPolicyResponse]
(Int -> ReadS ListEntitiesForPolicyResponse)
-> ReadS [ListEntitiesForPolicyResponse]
-> ReadPrec ListEntitiesForPolicyResponse
-> ReadPrec [ListEntitiesForPolicyResponse]
-> Read ListEntitiesForPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEntitiesForPolicyResponse]
$creadListPrec :: ReadPrec [ListEntitiesForPolicyResponse]
readPrec :: ReadPrec ListEntitiesForPolicyResponse
$creadPrec :: ReadPrec ListEntitiesForPolicyResponse
readList :: ReadS [ListEntitiesForPolicyResponse]
$creadList :: ReadS [ListEntitiesForPolicyResponse]
readsPrec :: Int -> ReadS ListEntitiesForPolicyResponse
$creadsPrec :: Int -> ReadS ListEntitiesForPolicyResponse
Prelude.Read, Int -> ListEntitiesForPolicyResponse -> ShowS
[ListEntitiesForPolicyResponse] -> ShowS
ListEntitiesForPolicyResponse -> String
(Int -> ListEntitiesForPolicyResponse -> ShowS)
-> (ListEntitiesForPolicyResponse -> String)
-> ([ListEntitiesForPolicyResponse] -> ShowS)
-> Show ListEntitiesForPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEntitiesForPolicyResponse] -> ShowS
$cshowList :: [ListEntitiesForPolicyResponse] -> ShowS
show :: ListEntitiesForPolicyResponse -> String
$cshow :: ListEntitiesForPolicyResponse -> String
showsPrec :: Int -> ListEntitiesForPolicyResponse -> ShowS
$cshowsPrec :: Int -> ListEntitiesForPolicyResponse -> ShowS
Prelude.Show, (forall x.
 ListEntitiesForPolicyResponse
 -> Rep ListEntitiesForPolicyResponse x)
-> (forall x.
    Rep ListEntitiesForPolicyResponse x
    -> ListEntitiesForPolicyResponse)
-> Generic ListEntitiesForPolicyResponse
forall x.
Rep ListEntitiesForPolicyResponse x
-> ListEntitiesForPolicyResponse
forall x.
ListEntitiesForPolicyResponse
-> Rep ListEntitiesForPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListEntitiesForPolicyResponse x
-> ListEntitiesForPolicyResponse
$cfrom :: forall x.
ListEntitiesForPolicyResponse
-> Rep ListEntitiesForPolicyResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListEntitiesForPolicyResponse' 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:
--
-- 'policyGroups', 'listEntitiesForPolicyResponse_policyGroups' - A list of IAM groups that the policy is attached to.
--
-- 'policyRoles', 'listEntitiesForPolicyResponse_policyRoles' - A list of IAM roles that the policy is attached to.
--
-- 'marker', 'listEntitiesForPolicyResponse_marker' - When @IsTruncated@ is @true@, this element is present and contains the
-- value to use for the @Marker@ parameter in a subsequent pagination
-- request.
--
-- 'policyUsers', 'listEntitiesForPolicyResponse_policyUsers' - A list of IAM users that the policy is attached to.
--
-- 'isTruncated', 'listEntitiesForPolicyResponse_isTruncated' - A flag that indicates whether there are more items to return. If your
-- results were truncated, you can make a subsequent pagination request
-- using the @Marker@ request parameter to retrieve more items. Note that
-- IAM might return fewer than the @MaxItems@ number of results even when
-- there are more results available. We recommend that you check
-- @IsTruncated@ after every call to ensure that you receive all your
-- results.
--
-- 'httpStatus', 'listEntitiesForPolicyResponse_httpStatus' - The response's http status code.
newListEntitiesForPolicyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListEntitiesForPolicyResponse
newListEntitiesForPolicyResponse :: Int -> ListEntitiesForPolicyResponse
newListEntitiesForPolicyResponse Int
pHttpStatus_ =
  ListEntitiesForPolicyResponse' :: Maybe [PolicyGroup]
-> Maybe [PolicyRole]
-> Maybe Text
-> Maybe [PolicyUser]
-> Maybe Bool
-> Int
-> ListEntitiesForPolicyResponse
ListEntitiesForPolicyResponse'
    { $sel:policyGroups:ListEntitiesForPolicyResponse' :: Maybe [PolicyGroup]
policyGroups =
        Maybe [PolicyGroup]
forall a. Maybe a
Prelude.Nothing,
      $sel:policyRoles:ListEntitiesForPolicyResponse' :: Maybe [PolicyRole]
policyRoles = Maybe [PolicyRole]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:ListEntitiesForPolicyResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:policyUsers:ListEntitiesForPolicyResponse' :: Maybe [PolicyUser]
policyUsers = Maybe [PolicyUser]
forall a. Maybe a
Prelude.Nothing,
      $sel:isTruncated:ListEntitiesForPolicyResponse' :: Maybe Bool
isTruncated = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListEntitiesForPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of IAM groups that the policy is attached to.
listEntitiesForPolicyResponse_policyGroups :: Lens.Lens' ListEntitiesForPolicyResponse (Prelude.Maybe [PolicyGroup])
listEntitiesForPolicyResponse_policyGroups :: (Maybe [PolicyGroup] -> f (Maybe [PolicyGroup]))
-> ListEntitiesForPolicyResponse -> f ListEntitiesForPolicyResponse
listEntitiesForPolicyResponse_policyGroups = (ListEntitiesForPolicyResponse -> Maybe [PolicyGroup])
-> (ListEntitiesForPolicyResponse
    -> Maybe [PolicyGroup] -> ListEntitiesForPolicyResponse)
-> Lens
     ListEntitiesForPolicyResponse
     ListEntitiesForPolicyResponse
     (Maybe [PolicyGroup])
     (Maybe [PolicyGroup])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEntitiesForPolicyResponse' {Maybe [PolicyGroup]
policyGroups :: Maybe [PolicyGroup]
$sel:policyGroups:ListEntitiesForPolicyResponse' :: ListEntitiesForPolicyResponse -> Maybe [PolicyGroup]
policyGroups} -> Maybe [PolicyGroup]
policyGroups) (\s :: ListEntitiesForPolicyResponse
s@ListEntitiesForPolicyResponse' {} Maybe [PolicyGroup]
a -> ListEntitiesForPolicyResponse
s {$sel:policyGroups:ListEntitiesForPolicyResponse' :: Maybe [PolicyGroup]
policyGroups = Maybe [PolicyGroup]
a} :: ListEntitiesForPolicyResponse) ((Maybe [PolicyGroup] -> f (Maybe [PolicyGroup]))
 -> ListEntitiesForPolicyResponse
 -> f ListEntitiesForPolicyResponse)
-> ((Maybe [PolicyGroup] -> f (Maybe [PolicyGroup]))
    -> Maybe [PolicyGroup] -> f (Maybe [PolicyGroup]))
-> (Maybe [PolicyGroup] -> f (Maybe [PolicyGroup]))
-> ListEntitiesForPolicyResponse
-> f ListEntitiesForPolicyResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [PolicyGroup] [PolicyGroup] [PolicyGroup] [PolicyGroup]
-> Iso
     (Maybe [PolicyGroup])
     (Maybe [PolicyGroup])
     (Maybe [PolicyGroup])
     (Maybe [PolicyGroup])
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 [PolicyGroup] [PolicyGroup] [PolicyGroup] [PolicyGroup]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of IAM roles that the policy is attached to.
listEntitiesForPolicyResponse_policyRoles :: Lens.Lens' ListEntitiesForPolicyResponse (Prelude.Maybe [PolicyRole])
listEntitiesForPolicyResponse_policyRoles :: (Maybe [PolicyRole] -> f (Maybe [PolicyRole]))
-> ListEntitiesForPolicyResponse -> f ListEntitiesForPolicyResponse
listEntitiesForPolicyResponse_policyRoles = (ListEntitiesForPolicyResponse -> Maybe [PolicyRole])
-> (ListEntitiesForPolicyResponse
    -> Maybe [PolicyRole] -> ListEntitiesForPolicyResponse)
-> Lens
     ListEntitiesForPolicyResponse
     ListEntitiesForPolicyResponse
     (Maybe [PolicyRole])
     (Maybe [PolicyRole])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEntitiesForPolicyResponse' {Maybe [PolicyRole]
policyRoles :: Maybe [PolicyRole]
$sel:policyRoles:ListEntitiesForPolicyResponse' :: ListEntitiesForPolicyResponse -> Maybe [PolicyRole]
policyRoles} -> Maybe [PolicyRole]
policyRoles) (\s :: ListEntitiesForPolicyResponse
s@ListEntitiesForPolicyResponse' {} Maybe [PolicyRole]
a -> ListEntitiesForPolicyResponse
s {$sel:policyRoles:ListEntitiesForPolicyResponse' :: Maybe [PolicyRole]
policyRoles = Maybe [PolicyRole]
a} :: ListEntitiesForPolicyResponse) ((Maybe [PolicyRole] -> f (Maybe [PolicyRole]))
 -> ListEntitiesForPolicyResponse
 -> f ListEntitiesForPolicyResponse)
-> ((Maybe [PolicyRole] -> f (Maybe [PolicyRole]))
    -> Maybe [PolicyRole] -> f (Maybe [PolicyRole]))
-> (Maybe [PolicyRole] -> f (Maybe [PolicyRole]))
-> ListEntitiesForPolicyResponse
-> f ListEntitiesForPolicyResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [PolicyRole] [PolicyRole] [PolicyRole] [PolicyRole]
-> Iso
     (Maybe [PolicyRole])
     (Maybe [PolicyRole])
     (Maybe [PolicyRole])
     (Maybe [PolicyRole])
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 [PolicyRole] [PolicyRole] [PolicyRole] [PolicyRole]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | When @IsTruncated@ is @true@, this element is present and contains the
-- value to use for the @Marker@ parameter in a subsequent pagination
-- request.
listEntitiesForPolicyResponse_marker :: Lens.Lens' ListEntitiesForPolicyResponse (Prelude.Maybe Prelude.Text)
listEntitiesForPolicyResponse_marker :: (Maybe Text -> f (Maybe Text))
-> ListEntitiesForPolicyResponse -> f ListEntitiesForPolicyResponse
listEntitiesForPolicyResponse_marker = (ListEntitiesForPolicyResponse -> Maybe Text)
-> (ListEntitiesForPolicyResponse
    -> Maybe Text -> ListEntitiesForPolicyResponse)
-> Lens' ListEntitiesForPolicyResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEntitiesForPolicyResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:ListEntitiesForPolicyResponse' :: ListEntitiesForPolicyResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListEntitiesForPolicyResponse
s@ListEntitiesForPolicyResponse' {} Maybe Text
a -> ListEntitiesForPolicyResponse
s {$sel:marker:ListEntitiesForPolicyResponse' :: Maybe Text
marker = Maybe Text
a} :: ListEntitiesForPolicyResponse)

-- | A list of IAM users that the policy is attached to.
listEntitiesForPolicyResponse_policyUsers :: Lens.Lens' ListEntitiesForPolicyResponse (Prelude.Maybe [PolicyUser])
listEntitiesForPolicyResponse_policyUsers :: (Maybe [PolicyUser] -> f (Maybe [PolicyUser]))
-> ListEntitiesForPolicyResponse -> f ListEntitiesForPolicyResponse
listEntitiesForPolicyResponse_policyUsers = (ListEntitiesForPolicyResponse -> Maybe [PolicyUser])
-> (ListEntitiesForPolicyResponse
    -> Maybe [PolicyUser] -> ListEntitiesForPolicyResponse)
-> Lens
     ListEntitiesForPolicyResponse
     ListEntitiesForPolicyResponse
     (Maybe [PolicyUser])
     (Maybe [PolicyUser])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEntitiesForPolicyResponse' {Maybe [PolicyUser]
policyUsers :: Maybe [PolicyUser]
$sel:policyUsers:ListEntitiesForPolicyResponse' :: ListEntitiesForPolicyResponse -> Maybe [PolicyUser]
policyUsers} -> Maybe [PolicyUser]
policyUsers) (\s :: ListEntitiesForPolicyResponse
s@ListEntitiesForPolicyResponse' {} Maybe [PolicyUser]
a -> ListEntitiesForPolicyResponse
s {$sel:policyUsers:ListEntitiesForPolicyResponse' :: Maybe [PolicyUser]
policyUsers = Maybe [PolicyUser]
a} :: ListEntitiesForPolicyResponse) ((Maybe [PolicyUser] -> f (Maybe [PolicyUser]))
 -> ListEntitiesForPolicyResponse
 -> f ListEntitiesForPolicyResponse)
-> ((Maybe [PolicyUser] -> f (Maybe [PolicyUser]))
    -> Maybe [PolicyUser] -> f (Maybe [PolicyUser]))
-> (Maybe [PolicyUser] -> f (Maybe [PolicyUser]))
-> ListEntitiesForPolicyResponse
-> f ListEntitiesForPolicyResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [PolicyUser] [PolicyUser] [PolicyUser] [PolicyUser]
-> Iso
     (Maybe [PolicyUser])
     (Maybe [PolicyUser])
     (Maybe [PolicyUser])
     (Maybe [PolicyUser])
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 [PolicyUser] [PolicyUser] [PolicyUser] [PolicyUser]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A flag that indicates whether there are more items to return. If your
-- results were truncated, you can make a subsequent pagination request
-- using the @Marker@ request parameter to retrieve more items. Note that
-- IAM might return fewer than the @MaxItems@ number of results even when
-- there are more results available. We recommend that you check
-- @IsTruncated@ after every call to ensure that you receive all your
-- results.
listEntitiesForPolicyResponse_isTruncated :: Lens.Lens' ListEntitiesForPolicyResponse (Prelude.Maybe Prelude.Bool)
listEntitiesForPolicyResponse_isTruncated :: (Maybe Bool -> f (Maybe Bool))
-> ListEntitiesForPolicyResponse -> f ListEntitiesForPolicyResponse
listEntitiesForPolicyResponse_isTruncated = (ListEntitiesForPolicyResponse -> Maybe Bool)
-> (ListEntitiesForPolicyResponse
    -> Maybe Bool -> ListEntitiesForPolicyResponse)
-> Lens' ListEntitiesForPolicyResponse (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEntitiesForPolicyResponse' {Maybe Bool
isTruncated :: Maybe Bool
$sel:isTruncated:ListEntitiesForPolicyResponse' :: ListEntitiesForPolicyResponse -> Maybe Bool
isTruncated} -> Maybe Bool
isTruncated) (\s :: ListEntitiesForPolicyResponse
s@ListEntitiesForPolicyResponse' {} Maybe Bool
a -> ListEntitiesForPolicyResponse
s {$sel:isTruncated:ListEntitiesForPolicyResponse' :: Maybe Bool
isTruncated = Maybe Bool
a} :: ListEntitiesForPolicyResponse)

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

instance Prelude.NFData ListEntitiesForPolicyResponse