{-# 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.ListAttachedGroupPolicies
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists all managed policies that are attached to the specified IAM group.
--
-- An IAM group can also have inline policies embedded with it. To list the
-- inline policies for a group, use ListGroupPolicies. For 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. You can use the @PathPrefix@ parameter to limit the list of
-- policies to only those matching the specified path prefix. If there are
-- no policies attached to the specified group (or none that match the
-- specified path prefix), the operation returns an empty list.
--
-- This operation returns paginated results.
module Amazonka.IAM.ListAttachedGroupPolicies
  ( -- * Creating a Request
    ListAttachedGroupPolicies (..),
    newListAttachedGroupPolicies,

    -- * Request Lenses
    listAttachedGroupPolicies_marker,
    listAttachedGroupPolicies_maxItems,
    listAttachedGroupPolicies_pathPrefix,
    listAttachedGroupPolicies_groupName,

    -- * Destructuring the Response
    ListAttachedGroupPoliciesResponse (..),
    newListAttachedGroupPoliciesResponse,

    -- * Response Lenses
    listAttachedGroupPoliciesResponse_attachedPolicies,
    listAttachedGroupPoliciesResponse_isTruncated,
    listAttachedGroupPoliciesResponse_marker,
    listAttachedGroupPoliciesResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListAttachedGroupPolicies' smart constructor.
data ListAttachedGroupPolicies = ListAttachedGroupPolicies'
  { -- | 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.
    ListAttachedGroupPolicies -> 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.
    ListAttachedGroupPolicies -> Maybe Natural
maxItems :: Prelude.Maybe Prelude.Natural,
    -- | The path prefix for filtering the results. This parameter is optional.
    -- If it is not included, it defaults to a slash (\/), listing all
    -- policies.
    --
    -- 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.
    ListAttachedGroupPolicies -> Maybe Text
pathPrefix :: Prelude.Maybe Prelude.Text,
    -- | The name (friendly name, not ARN) of the group to list attached 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: _+=,.\@-
    ListAttachedGroupPolicies -> Text
groupName :: Prelude.Text
  }
  deriving (ListAttachedGroupPolicies -> ListAttachedGroupPolicies -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAttachedGroupPolicies -> ListAttachedGroupPolicies -> Bool
$c/= :: ListAttachedGroupPolicies -> ListAttachedGroupPolicies -> Bool
== :: ListAttachedGroupPolicies -> ListAttachedGroupPolicies -> Bool
$c== :: ListAttachedGroupPolicies -> ListAttachedGroupPolicies -> Bool
Prelude.Eq, ReadPrec [ListAttachedGroupPolicies]
ReadPrec ListAttachedGroupPolicies
Int -> ReadS ListAttachedGroupPolicies
ReadS [ListAttachedGroupPolicies]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAttachedGroupPolicies]
$creadListPrec :: ReadPrec [ListAttachedGroupPolicies]
readPrec :: ReadPrec ListAttachedGroupPolicies
$creadPrec :: ReadPrec ListAttachedGroupPolicies
readList :: ReadS [ListAttachedGroupPolicies]
$creadList :: ReadS [ListAttachedGroupPolicies]
readsPrec :: Int -> ReadS ListAttachedGroupPolicies
$creadsPrec :: Int -> ReadS ListAttachedGroupPolicies
Prelude.Read, Int -> ListAttachedGroupPolicies -> ShowS
[ListAttachedGroupPolicies] -> ShowS
ListAttachedGroupPolicies -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAttachedGroupPolicies] -> ShowS
$cshowList :: [ListAttachedGroupPolicies] -> ShowS
show :: ListAttachedGroupPolicies -> String
$cshow :: ListAttachedGroupPolicies -> String
showsPrec :: Int -> ListAttachedGroupPolicies -> ShowS
$cshowsPrec :: Int -> ListAttachedGroupPolicies -> ShowS
Prelude.Show, forall x.
Rep ListAttachedGroupPolicies x -> ListAttachedGroupPolicies
forall x.
ListAttachedGroupPolicies -> Rep ListAttachedGroupPolicies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAttachedGroupPolicies x -> ListAttachedGroupPolicies
$cfrom :: forall x.
ListAttachedGroupPolicies -> Rep ListAttachedGroupPolicies x
Prelude.Generic)

-- |
-- Create a value of 'ListAttachedGroupPolicies' 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', 'listAttachedGroupPolicies_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', 'listAttachedGroupPolicies_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.
--
-- 'pathPrefix', 'listAttachedGroupPolicies_pathPrefix' - The path prefix for filtering the results. This parameter is optional.
-- If it is not included, it defaults to a slash (\/), listing all
-- policies.
--
-- 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.
--
-- 'groupName', 'listAttachedGroupPolicies_groupName' - The name (friendly name, not ARN) of the group to list attached 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: _+=,.\@-
newListAttachedGroupPolicies ::
  -- | 'groupName'
  Prelude.Text ->
  ListAttachedGroupPolicies
newListAttachedGroupPolicies :: Text -> ListAttachedGroupPolicies
newListAttachedGroupPolicies Text
pGroupName_ =
  ListAttachedGroupPolicies'
    { $sel:marker:ListAttachedGroupPolicies' :: Maybe Text
marker =
        forall a. Maybe a
Prelude.Nothing,
      $sel:maxItems:ListAttachedGroupPolicies' :: Maybe Natural
maxItems = forall a. Maybe a
Prelude.Nothing,
      $sel:pathPrefix:ListAttachedGroupPolicies' :: Maybe Text
pathPrefix = forall a. Maybe a
Prelude.Nothing,
      $sel:groupName:ListAttachedGroupPolicies' :: Text
groupName = Text
pGroupName_
    }

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

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

-- | The path prefix for filtering the results. This parameter is optional.
-- If it is not included, it defaults to a slash (\/), listing all
-- policies.
--
-- 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.
listAttachedGroupPolicies_pathPrefix :: Lens.Lens' ListAttachedGroupPolicies (Prelude.Maybe Prelude.Text)
listAttachedGroupPolicies_pathPrefix :: Lens' ListAttachedGroupPolicies (Maybe Text)
listAttachedGroupPolicies_pathPrefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttachedGroupPolicies' {Maybe Text
pathPrefix :: Maybe Text
$sel:pathPrefix:ListAttachedGroupPolicies' :: ListAttachedGroupPolicies -> Maybe Text
pathPrefix} -> Maybe Text
pathPrefix) (\s :: ListAttachedGroupPolicies
s@ListAttachedGroupPolicies' {} Maybe Text
a -> ListAttachedGroupPolicies
s {$sel:pathPrefix:ListAttachedGroupPolicies' :: Maybe Text
pathPrefix = Maybe Text
a} :: ListAttachedGroupPolicies)

-- | The name (friendly name, not ARN) of the group to list attached 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: _+=,.\@-
listAttachedGroupPolicies_groupName :: Lens.Lens' ListAttachedGroupPolicies Prelude.Text
listAttachedGroupPolicies_groupName :: Lens' ListAttachedGroupPolicies Text
listAttachedGroupPolicies_groupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttachedGroupPolicies' {Text
groupName :: Text
$sel:groupName:ListAttachedGroupPolicies' :: ListAttachedGroupPolicies -> Text
groupName} -> Text
groupName) (\s :: ListAttachedGroupPolicies
s@ListAttachedGroupPolicies' {} Text
a -> ListAttachedGroupPolicies
s {$sel:groupName:ListAttachedGroupPolicies' :: Text
groupName = Text
a} :: ListAttachedGroupPolicies)

instance Core.AWSPager ListAttachedGroupPolicies where
  page :: ListAttachedGroupPolicies
-> AWSResponse ListAttachedGroupPolicies
-> Maybe ListAttachedGroupPolicies
page ListAttachedGroupPolicies
rq AWSResponse ListAttachedGroupPolicies
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAttachedGroupPolicies
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAttachedGroupPoliciesResponse (Maybe Bool)
listAttachedGroupPoliciesResponse_isTruncated
            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. Maybe a -> Bool
Prelude.isNothing
        ( AWSResponse ListAttachedGroupPolicies
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAttachedGroupPoliciesResponse (Maybe Text)
listAttachedGroupPoliciesResponse_marker
            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
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListAttachedGroupPolicies
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListAttachedGroupPolicies (Maybe Text)
listAttachedGroupPolicies_marker
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAttachedGroupPolicies
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAttachedGroupPoliciesResponse (Maybe Text)
listAttachedGroupPoliciesResponse_marker
          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 ListAttachedGroupPolicies where
  type
    AWSResponse ListAttachedGroupPolicies =
      ListAttachedGroupPoliciesResponse
  request :: (Service -> Service)
-> ListAttachedGroupPolicies -> Request ListAttachedGroupPolicies
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListAttachedGroupPolicies
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListAttachedGroupPolicies)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"ListAttachedGroupPoliciesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [AttachedPolicy]
-> Maybe Bool
-> Maybe Text
-> Int
-> ListAttachedGroupPoliciesResponse
ListAttachedGroupPoliciesResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x
                            forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"AttachedPolicies"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                            forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"IsTruncated")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Marker")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListAttachedGroupPolicies where
  hashWithSalt :: Int -> ListAttachedGroupPolicies -> Int
hashWithSalt Int
_salt ListAttachedGroupPolicies' {Maybe Natural
Maybe Text
Text
groupName :: Text
pathPrefix :: Maybe Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:groupName:ListAttachedGroupPolicies' :: ListAttachedGroupPolicies -> Text
$sel:pathPrefix:ListAttachedGroupPolicies' :: ListAttachedGroupPolicies -> Maybe Text
$sel:maxItems:ListAttachedGroupPolicies' :: ListAttachedGroupPolicies -> Maybe Natural
$sel:marker:ListAttachedGroupPolicies' :: ListAttachedGroupPolicies -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
marker
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxItems
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
pathPrefix
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
groupName

instance Prelude.NFData ListAttachedGroupPolicies where
  rnf :: ListAttachedGroupPolicies -> ()
rnf ListAttachedGroupPolicies' {Maybe Natural
Maybe Text
Text
groupName :: Text
pathPrefix :: Maybe Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:groupName:ListAttachedGroupPolicies' :: ListAttachedGroupPolicies -> Text
$sel:pathPrefix:ListAttachedGroupPolicies' :: ListAttachedGroupPolicies -> Maybe Text
$sel:maxItems:ListAttachedGroupPolicies' :: ListAttachedGroupPolicies -> Maybe Natural
$sel:marker:ListAttachedGroupPolicies' :: ListAttachedGroupPolicies -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxItems
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
pathPrefix
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
groupName

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

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

instance Data.ToQuery ListAttachedGroupPolicies where
  toQuery :: ListAttachedGroupPolicies -> QueryString
toQuery ListAttachedGroupPolicies' {Maybe Natural
Maybe Text
Text
groupName :: Text
pathPrefix :: Maybe Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:groupName:ListAttachedGroupPolicies' :: ListAttachedGroupPolicies -> Text
$sel:pathPrefix:ListAttachedGroupPolicies' :: ListAttachedGroupPolicies -> Maybe Text
$sel:maxItems:ListAttachedGroupPolicies' :: ListAttachedGroupPolicies -> Maybe Natural
$sel:marker:ListAttachedGroupPolicies' :: ListAttachedGroupPolicies -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"ListAttachedGroupPolicies" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
        ByteString
"Marker" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
marker,
        ByteString
"MaxItems" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxItems,
        ByteString
"PathPrefix" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
pathPrefix,
        ByteString
"GroupName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
groupName
      ]

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

-- |
-- Create a value of 'ListAttachedGroupPoliciesResponse' 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:
--
-- 'attachedPolicies', 'listAttachedGroupPoliciesResponse_attachedPolicies' - A list of the attached policies.
--
-- 'isTruncated', 'listAttachedGroupPoliciesResponse_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.
--
-- 'marker', 'listAttachedGroupPoliciesResponse_marker' - When @IsTruncated@ is @true@, this element is present and contains the
-- value to use for the @Marker@ parameter in a subsequent pagination
-- request.
--
-- 'httpStatus', 'listAttachedGroupPoliciesResponse_httpStatus' - The response's http status code.
newListAttachedGroupPoliciesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAttachedGroupPoliciesResponse
newListAttachedGroupPoliciesResponse :: Int -> ListAttachedGroupPoliciesResponse
newListAttachedGroupPoliciesResponse Int
pHttpStatus_ =
  ListAttachedGroupPoliciesResponse'
    { $sel:attachedPolicies:ListAttachedGroupPoliciesResponse' :: Maybe [AttachedPolicy]
attachedPolicies =
        forall a. Maybe a
Prelude.Nothing,
      $sel:isTruncated:ListAttachedGroupPoliciesResponse' :: Maybe Bool
isTruncated = forall a. Maybe a
Prelude.Nothing,
      $sel:marker:ListAttachedGroupPoliciesResponse' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAttachedGroupPoliciesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of the attached policies.
listAttachedGroupPoliciesResponse_attachedPolicies :: Lens.Lens' ListAttachedGroupPoliciesResponse (Prelude.Maybe [AttachedPolicy])
listAttachedGroupPoliciesResponse_attachedPolicies :: Lens' ListAttachedGroupPoliciesResponse (Maybe [AttachedPolicy])
listAttachedGroupPoliciesResponse_attachedPolicies = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttachedGroupPoliciesResponse' {Maybe [AttachedPolicy]
attachedPolicies :: Maybe [AttachedPolicy]
$sel:attachedPolicies:ListAttachedGroupPoliciesResponse' :: ListAttachedGroupPoliciesResponse -> Maybe [AttachedPolicy]
attachedPolicies} -> Maybe [AttachedPolicy]
attachedPolicies) (\s :: ListAttachedGroupPoliciesResponse
s@ListAttachedGroupPoliciesResponse' {} Maybe [AttachedPolicy]
a -> ListAttachedGroupPoliciesResponse
s {$sel:attachedPolicies:ListAttachedGroupPoliciesResponse' :: Maybe [AttachedPolicy]
attachedPolicies = Maybe [AttachedPolicy]
a} :: ListAttachedGroupPoliciesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

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

instance
  Prelude.NFData
    ListAttachedGroupPoliciesResponse
  where
  rnf :: ListAttachedGroupPoliciesResponse -> ()
rnf ListAttachedGroupPoliciesResponse' {Int
Maybe Bool
Maybe [AttachedPolicy]
Maybe Text
httpStatus :: Int
marker :: Maybe Text
isTruncated :: Maybe Bool
attachedPolicies :: Maybe [AttachedPolicy]
$sel:httpStatus:ListAttachedGroupPoliciesResponse' :: ListAttachedGroupPoliciesResponse -> Int
$sel:marker:ListAttachedGroupPoliciesResponse' :: ListAttachedGroupPoliciesResponse -> Maybe Text
$sel:isTruncated:ListAttachedGroupPoliciesResponse' :: ListAttachedGroupPoliciesResponse -> Maybe Bool
$sel:attachedPolicies:ListAttachedGroupPoliciesResponse' :: ListAttachedGroupPoliciesResponse -> Maybe [AttachedPolicy]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [AttachedPolicy]
attachedPolicies
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isTruncated
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus