{-# 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.ListUserPolicies
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists the names of the inline policies embedded in the specified IAM
-- user.
--
-- An IAM user can also have managed policies attached to it. To list the
-- managed policies that are attached to a user, use
-- ListAttachedUserPolicies. For more information about policies, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html Managed policies and inline policies>
-- in the /IAM User Guide/.
--
-- You can paginate the results using the @MaxItems@ and @Marker@
-- parameters. If there are no inline policies embedded with the specified
-- user, the operation returns an empty list.
--
-- This operation returns paginated results.
module Amazonka.IAM.ListUserPolicies
  ( -- * Creating a Request
    ListUserPolicies (..),
    newListUserPolicies,

    -- * Request Lenses
    listUserPolicies_marker,
    listUserPolicies_maxItems,
    listUserPolicies_userName,

    -- * Destructuring the Response
    ListUserPoliciesResponse (..),
    newListUserPoliciesResponse,

    -- * Response Lenses
    listUserPoliciesResponse_marker,
    listUserPoliciesResponse_isTruncated,
    listUserPoliciesResponse_httpStatus,
    listUserPoliciesResponse_policyNames,
  )
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:/ 'newListUserPolicies' smart constructor.
data ListUserPolicies = ListUserPolicies'
  { -- | 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.
    ListUserPolicies -> 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.
    ListUserPolicies -> Maybe Natural
maxItems :: Prelude.Maybe Prelude.Natural,
    -- | The name of the user to list policies for.
    --
    -- This parameter allows (through its
    -- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
    -- consisting of upper and lowercase alphanumeric characters with no
    -- spaces. You can also include any of the following characters: _+=,.\@-
    ListUserPolicies -> Text
userName :: Prelude.Text
  }
  deriving (ListUserPolicies -> ListUserPolicies -> Bool
(ListUserPolicies -> ListUserPolicies -> Bool)
-> (ListUserPolicies -> ListUserPolicies -> Bool)
-> Eq ListUserPolicies
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListUserPolicies -> ListUserPolicies -> Bool
$c/= :: ListUserPolicies -> ListUserPolicies -> Bool
== :: ListUserPolicies -> ListUserPolicies -> Bool
$c== :: ListUserPolicies -> ListUserPolicies -> Bool
Prelude.Eq, ReadPrec [ListUserPolicies]
ReadPrec ListUserPolicies
Int -> ReadS ListUserPolicies
ReadS [ListUserPolicies]
(Int -> ReadS ListUserPolicies)
-> ReadS [ListUserPolicies]
-> ReadPrec ListUserPolicies
-> ReadPrec [ListUserPolicies]
-> Read ListUserPolicies
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListUserPolicies]
$creadListPrec :: ReadPrec [ListUserPolicies]
readPrec :: ReadPrec ListUserPolicies
$creadPrec :: ReadPrec ListUserPolicies
readList :: ReadS [ListUserPolicies]
$creadList :: ReadS [ListUserPolicies]
readsPrec :: Int -> ReadS ListUserPolicies
$creadsPrec :: Int -> ReadS ListUserPolicies
Prelude.Read, Int -> ListUserPolicies -> ShowS
[ListUserPolicies] -> ShowS
ListUserPolicies -> String
(Int -> ListUserPolicies -> ShowS)
-> (ListUserPolicies -> String)
-> ([ListUserPolicies] -> ShowS)
-> Show ListUserPolicies
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListUserPolicies] -> ShowS
$cshowList :: [ListUserPolicies] -> ShowS
show :: ListUserPolicies -> String
$cshow :: ListUserPolicies -> String
showsPrec :: Int -> ListUserPolicies -> ShowS
$cshowsPrec :: Int -> ListUserPolicies -> ShowS
Prelude.Show, (forall x. ListUserPolicies -> Rep ListUserPolicies x)
-> (forall x. Rep ListUserPolicies x -> ListUserPolicies)
-> Generic ListUserPolicies
forall x. Rep ListUserPolicies x -> ListUserPolicies
forall x. ListUserPolicies -> Rep ListUserPolicies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListUserPolicies x -> ListUserPolicies
$cfrom :: forall x. ListUserPolicies -> Rep ListUserPolicies x
Prelude.Generic)

-- |
-- Create a value of 'ListUserPolicies' 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:
--
-- 'marker', 'listUserPolicies_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', 'listUserPolicies_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.
--
-- 'userName', 'listUserPolicies_userName' - The name of the user to list policies for.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of upper and lowercase alphanumeric characters with no
-- spaces. You can also include any of the following characters: _+=,.\@-
newListUserPolicies ::
  -- | 'userName'
  Prelude.Text ->
  ListUserPolicies
newListUserPolicies :: Text -> ListUserPolicies
newListUserPolicies Text
pUserName_ =
  ListUserPolicies' :: Maybe Text -> Maybe Natural -> Text -> ListUserPolicies
ListUserPolicies'
    { $sel:marker:ListUserPolicies' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxItems:ListUserPolicies' :: Maybe Natural
maxItems = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:userName:ListUserPolicies' :: Text
userName = Text
pUserName_
    }

-- | 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.
listUserPolicies_marker :: Lens.Lens' ListUserPolicies (Prelude.Maybe Prelude.Text)
listUserPolicies_marker :: (Maybe Text -> f (Maybe Text))
-> ListUserPolicies -> f ListUserPolicies
listUserPolicies_marker = (ListUserPolicies -> Maybe Text)
-> (ListUserPolicies -> Maybe Text -> ListUserPolicies)
-> Lens ListUserPolicies ListUserPolicies (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUserPolicies' {Maybe Text
marker :: Maybe Text
$sel:marker:ListUserPolicies' :: ListUserPolicies -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListUserPolicies
s@ListUserPolicies' {} Maybe Text
a -> ListUserPolicies
s {$sel:marker:ListUserPolicies' :: Maybe Text
marker = Maybe Text
a} :: ListUserPolicies)

-- | 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.
listUserPolicies_maxItems :: Lens.Lens' ListUserPolicies (Prelude.Maybe Prelude.Natural)
listUserPolicies_maxItems :: (Maybe Natural -> f (Maybe Natural))
-> ListUserPolicies -> f ListUserPolicies
listUserPolicies_maxItems = (ListUserPolicies -> Maybe Natural)
-> (ListUserPolicies -> Maybe Natural -> ListUserPolicies)
-> Lens
     ListUserPolicies ListUserPolicies (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUserPolicies' {Maybe Natural
maxItems :: Maybe Natural
$sel:maxItems:ListUserPolicies' :: ListUserPolicies -> Maybe Natural
maxItems} -> Maybe Natural
maxItems) (\s :: ListUserPolicies
s@ListUserPolicies' {} Maybe Natural
a -> ListUserPolicies
s {$sel:maxItems:ListUserPolicies' :: Maybe Natural
maxItems = Maybe Natural
a} :: ListUserPolicies)

-- | The name of the user to list policies for.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of upper and lowercase alphanumeric characters with no
-- spaces. You can also include any of the following characters: _+=,.\@-
listUserPolicies_userName :: Lens.Lens' ListUserPolicies Prelude.Text
listUserPolicies_userName :: (Text -> f Text) -> ListUserPolicies -> f ListUserPolicies
listUserPolicies_userName = (ListUserPolicies -> Text)
-> (ListUserPolicies -> Text -> ListUserPolicies)
-> Lens ListUserPolicies ListUserPolicies Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUserPolicies' {Text
userName :: Text
$sel:userName:ListUserPolicies' :: ListUserPolicies -> Text
userName} -> Text
userName) (\s :: ListUserPolicies
s@ListUserPolicies' {} Text
a -> ListUserPolicies
s {$sel:userName:ListUserPolicies' :: Text
userName = Text
a} :: ListUserPolicies)

instance Core.AWSPager ListUserPolicies where
  page :: ListUserPolicies
-> AWSResponse ListUserPolicies -> Maybe ListUserPolicies
page ListUserPolicies
rq AWSResponse ListUserPolicies
rs
    | Maybe Bool -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListUserPolicies
ListUserPoliciesResponse
rs
            ListUserPoliciesResponse
-> Getting (First Bool) ListUserPoliciesResponse Bool -> Maybe Bool
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Bool -> Const (First Bool) (Maybe Bool))
-> ListUserPoliciesResponse
-> Const (First Bool) ListUserPoliciesResponse
Lens' ListUserPoliciesResponse (Maybe Bool)
listUserPoliciesResponse_isTruncated
              ((Maybe Bool -> Const (First Bool) (Maybe Bool))
 -> ListUserPoliciesResponse
 -> Const (First Bool) ListUserPoliciesResponse)
-> ((Bool -> Const (First Bool) Bool)
    -> Maybe Bool -> Const (First Bool) (Maybe Bool))
-> Getting (First Bool) ListUserPoliciesResponse 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 ListUserPolicies
forall a. Maybe a
Prelude.Nothing
    | Maybe Text -> Bool
forall a. Maybe a -> Bool
Prelude.isNothing
        ( AWSResponse ListUserPolicies
ListUserPoliciesResponse
rs
            ListUserPoliciesResponse
-> Getting (First Text) ListUserPoliciesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListUserPoliciesResponse
-> Const (First Text) ListUserPoliciesResponse
Lens' ListUserPoliciesResponse (Maybe Text)
listUserPoliciesResponse_marker ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListUserPoliciesResponse
 -> Const (First Text) ListUserPoliciesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListUserPoliciesResponse 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 ListUserPolicies
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListUserPolicies -> Maybe ListUserPolicies
forall a. a -> Maybe a
Prelude.Just (ListUserPolicies -> Maybe ListUserPolicies)
-> ListUserPolicies -> Maybe ListUserPolicies
forall a b. (a -> b) -> a -> b
Prelude.$
        ListUserPolicies
rq
          ListUserPolicies
-> (ListUserPolicies -> ListUserPolicies) -> ListUserPolicies
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListUserPolicies -> Identity ListUserPolicies
Lens ListUserPolicies ListUserPolicies (Maybe Text) (Maybe Text)
listUserPolicies_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> ListUserPolicies -> Identity ListUserPolicies)
-> Maybe Text -> ListUserPolicies -> ListUserPolicies
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListUserPolicies
ListUserPoliciesResponse
rs
          ListUserPoliciesResponse
-> Getting (First Text) ListUserPoliciesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListUserPoliciesResponse
-> Const (First Text) ListUserPoliciesResponse
Lens' ListUserPoliciesResponse (Maybe Text)
listUserPoliciesResponse_marker ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListUserPoliciesResponse
 -> Const (First Text) ListUserPoliciesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListUserPoliciesResponse 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 ListUserPolicies where
  type
    AWSResponse ListUserPolicies =
      ListUserPoliciesResponse
  request :: ListUserPolicies -> Request ListUserPolicies
request = Service -> ListUserPolicies -> Request ListUserPolicies
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy ListUserPolicies
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListUserPolicies)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse ListUserPolicies))
-> Logger
-> Service
-> Proxy ListUserPolicies
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListUserPolicies)))
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
"ListUserPoliciesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text
-> Maybe Bool -> Int -> [Text] -> ListUserPoliciesResponse
ListUserPoliciesResponse'
            (Maybe Text
 -> Maybe Bool -> Int -> [Text] -> ListUserPoliciesResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Bool -> Int -> [Text] -> ListUserPoliciesResponse)
forall (f :: * -> *) a b. Functor 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 Bool -> Int -> [Text] -> ListUserPoliciesResponse)
-> Either String (Maybe Bool)
-> Either String (Int -> [Text] -> ListUserPoliciesResponse)
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 -> [Text] -> ListUserPoliciesResponse)
-> Either String Int
-> Either String ([Text] -> ListUserPoliciesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either String ([Text] -> ListUserPoliciesResponse)
-> Either String [Text] -> Either String ListUserPoliciesResponse
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
"PolicyNames" 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 [Text]) -> Either String [Text]
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member"
                        )
      )

instance Prelude.Hashable ListUserPolicies

instance Prelude.NFData ListUserPolicies

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

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

instance Core.ToQuery ListUserPolicies where
  toQuery :: ListUserPolicies -> QueryString
toQuery ListUserPolicies' {Maybe Natural
Maybe Text
Text
userName :: Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:userName:ListUserPolicies' :: ListUserPolicies -> Text
$sel:maxItems:ListUserPolicies' :: ListUserPolicies -> Maybe Natural
$sel:marker:ListUserPolicies' :: ListUserPolicies -> 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
"ListUserPolicies" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
        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
"UserName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
userName
      ]

-- | Contains the response to a successful ListUserPolicies request.
--
-- /See:/ 'newListUserPoliciesResponse' smart constructor.
data ListUserPoliciesResponse = ListUserPoliciesResponse'
  { -- | When @IsTruncated@ is @true@, this element is present and contains the
    -- value to use for the @Marker@ parameter in a subsequent pagination
    -- request.
    ListUserPoliciesResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | 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.
    ListUserPoliciesResponse -> Maybe Bool
isTruncated :: Prelude.Maybe Prelude.Bool,
    -- | The response's http status code.
    ListUserPoliciesResponse -> Int
httpStatus :: Prelude.Int,
    -- | A list of policy names.
    ListUserPoliciesResponse -> [Text]
policyNames :: [Prelude.Text]
  }
  deriving (ListUserPoliciesResponse -> ListUserPoliciesResponse -> Bool
(ListUserPoliciesResponse -> ListUserPoliciesResponse -> Bool)
-> (ListUserPoliciesResponse -> ListUserPoliciesResponse -> Bool)
-> Eq ListUserPoliciesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListUserPoliciesResponse -> ListUserPoliciesResponse -> Bool
$c/= :: ListUserPoliciesResponse -> ListUserPoliciesResponse -> Bool
== :: ListUserPoliciesResponse -> ListUserPoliciesResponse -> Bool
$c== :: ListUserPoliciesResponse -> ListUserPoliciesResponse -> Bool
Prelude.Eq, ReadPrec [ListUserPoliciesResponse]
ReadPrec ListUserPoliciesResponse
Int -> ReadS ListUserPoliciesResponse
ReadS [ListUserPoliciesResponse]
(Int -> ReadS ListUserPoliciesResponse)
-> ReadS [ListUserPoliciesResponse]
-> ReadPrec ListUserPoliciesResponse
-> ReadPrec [ListUserPoliciesResponse]
-> Read ListUserPoliciesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListUserPoliciesResponse]
$creadListPrec :: ReadPrec [ListUserPoliciesResponse]
readPrec :: ReadPrec ListUserPoliciesResponse
$creadPrec :: ReadPrec ListUserPoliciesResponse
readList :: ReadS [ListUserPoliciesResponse]
$creadList :: ReadS [ListUserPoliciesResponse]
readsPrec :: Int -> ReadS ListUserPoliciesResponse
$creadsPrec :: Int -> ReadS ListUserPoliciesResponse
Prelude.Read, Int -> ListUserPoliciesResponse -> ShowS
[ListUserPoliciesResponse] -> ShowS
ListUserPoliciesResponse -> String
(Int -> ListUserPoliciesResponse -> ShowS)
-> (ListUserPoliciesResponse -> String)
-> ([ListUserPoliciesResponse] -> ShowS)
-> Show ListUserPoliciesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListUserPoliciesResponse] -> ShowS
$cshowList :: [ListUserPoliciesResponse] -> ShowS
show :: ListUserPoliciesResponse -> String
$cshow :: ListUserPoliciesResponse -> String
showsPrec :: Int -> ListUserPoliciesResponse -> ShowS
$cshowsPrec :: Int -> ListUserPoliciesResponse -> ShowS
Prelude.Show, (forall x.
 ListUserPoliciesResponse -> Rep ListUserPoliciesResponse x)
-> (forall x.
    Rep ListUserPoliciesResponse x -> ListUserPoliciesResponse)
-> Generic ListUserPoliciesResponse
forall x.
Rep ListUserPoliciesResponse x -> ListUserPoliciesResponse
forall x.
ListUserPoliciesResponse -> Rep ListUserPoliciesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListUserPoliciesResponse x -> ListUserPoliciesResponse
$cfrom :: forall x.
ListUserPoliciesResponse -> Rep ListUserPoliciesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListUserPoliciesResponse' 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:
--
-- 'marker', 'listUserPoliciesResponse_marker' - When @IsTruncated@ is @true@, this element is present and contains the
-- value to use for the @Marker@ parameter in a subsequent pagination
-- request.
--
-- 'isTruncated', 'listUserPoliciesResponse_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', 'listUserPoliciesResponse_httpStatus' - The response's http status code.
--
-- 'policyNames', 'listUserPoliciesResponse_policyNames' - A list of policy names.
newListUserPoliciesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListUserPoliciesResponse
newListUserPoliciesResponse :: Int -> ListUserPoliciesResponse
newListUserPoliciesResponse Int
pHttpStatus_ =
  ListUserPoliciesResponse' :: Maybe Text
-> Maybe Bool -> Int -> [Text] -> ListUserPoliciesResponse
ListUserPoliciesResponse'
    { $sel:marker:ListUserPoliciesResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isTruncated:ListUserPoliciesResponse' :: Maybe Bool
isTruncated = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListUserPoliciesResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:policyNames:ListUserPoliciesResponse' :: [Text]
policyNames = [Text]
forall a. Monoid a => a
Prelude.mempty
    }

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

-- | 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.
listUserPoliciesResponse_isTruncated :: Lens.Lens' ListUserPoliciesResponse (Prelude.Maybe Prelude.Bool)
listUserPoliciesResponse_isTruncated :: (Maybe Bool -> f (Maybe Bool))
-> ListUserPoliciesResponse -> f ListUserPoliciesResponse
listUserPoliciesResponse_isTruncated = (ListUserPoliciesResponse -> Maybe Bool)
-> (ListUserPoliciesResponse
    -> Maybe Bool -> ListUserPoliciesResponse)
-> Lens' ListUserPoliciesResponse (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUserPoliciesResponse' {Maybe Bool
isTruncated :: Maybe Bool
$sel:isTruncated:ListUserPoliciesResponse' :: ListUserPoliciesResponse -> Maybe Bool
isTruncated} -> Maybe Bool
isTruncated) (\s :: ListUserPoliciesResponse
s@ListUserPoliciesResponse' {} Maybe Bool
a -> ListUserPoliciesResponse
s {$sel:isTruncated:ListUserPoliciesResponse' :: Maybe Bool
isTruncated = Maybe Bool
a} :: ListUserPoliciesResponse)

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

-- | A list of policy names.
listUserPoliciesResponse_policyNames :: Lens.Lens' ListUserPoliciesResponse [Prelude.Text]
listUserPoliciesResponse_policyNames :: ([Text] -> f [Text])
-> ListUserPoliciesResponse -> f ListUserPoliciesResponse
listUserPoliciesResponse_policyNames = (ListUserPoliciesResponse -> [Text])
-> (ListUserPoliciesResponse -> [Text] -> ListUserPoliciesResponse)
-> Lens
     ListUserPoliciesResponse ListUserPoliciesResponse [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUserPoliciesResponse' {[Text]
policyNames :: [Text]
$sel:policyNames:ListUserPoliciesResponse' :: ListUserPoliciesResponse -> [Text]
policyNames} -> [Text]
policyNames) (\s :: ListUserPoliciesResponse
s@ListUserPoliciesResponse' {} [Text]
a -> ListUserPoliciesResponse
s {$sel:policyNames:ListUserPoliciesResponse' :: [Text]
policyNames = [Text]
a} :: ListUserPoliciesResponse) (([Text] -> f [Text])
 -> ListUserPoliciesResponse -> f ListUserPoliciesResponse)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> ListUserPoliciesResponse
-> f ListUserPoliciesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData ListUserPoliciesResponse