{-# 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-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 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_pathPrefix,
    listAttachedGroupPolicies_marker,
    listAttachedGroupPolicies_maxItems,
    listAttachedGroupPolicies_groupName,

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

    -- * Response Lenses
    listAttachedGroupPoliciesResponse_attachedPolicies,
    listAttachedGroupPoliciesResponse_marker,
    listAttachedGroupPoliciesResponse_isTruncated,
    listAttachedGroupPoliciesResponse_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:/ 'newListAttachedGroupPolicies' smart constructor.
data ListAttachedGroupPolicies = 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 -> Maybe Text
pathPrefix :: Prelude.Maybe Prelude.Text,
    -- | 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 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
(ListAttachedGroupPolicies -> ListAttachedGroupPolicies -> Bool)
-> (ListAttachedGroupPolicies -> ListAttachedGroupPolicies -> Bool)
-> Eq ListAttachedGroupPolicies
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]
(Int -> ReadS ListAttachedGroupPolicies)
-> ReadS [ListAttachedGroupPolicies]
-> ReadPrec ListAttachedGroupPolicies
-> ReadPrec [ListAttachedGroupPolicies]
-> Read 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
(Int -> ListAttachedGroupPolicies -> ShowS)
-> (ListAttachedGroupPolicies -> String)
-> ([ListAttachedGroupPolicies] -> ShowS)
-> Show ListAttachedGroupPolicies
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.
 ListAttachedGroupPolicies -> Rep ListAttachedGroupPolicies x)
-> (forall x.
    Rep ListAttachedGroupPolicies x -> ListAttachedGroupPolicies)
-> Generic ListAttachedGroupPolicies
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:
--
-- '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.
--
-- '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.
--
-- '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' :: Maybe Text
-> Maybe Text -> Maybe Natural -> Text -> ListAttachedGroupPolicies
ListAttachedGroupPolicies'
    { $sel:pathPrefix:ListAttachedGroupPolicies' :: Maybe Text
pathPrefix =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:ListAttachedGroupPolicies' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxItems:ListAttachedGroupPolicies' :: Maybe Natural
maxItems = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:groupName:ListAttachedGroupPolicies' :: Text
groupName = Text
pGroupName_
    }

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> ListAttachedGroupPolicies -> f ListAttachedGroupPolicies
listAttachedGroupPolicies_pathPrefix = (ListAttachedGroupPolicies -> Maybe Text)
-> (ListAttachedGroupPolicies
    -> Maybe Text -> ListAttachedGroupPolicies)
-> Lens
     ListAttachedGroupPolicies
     ListAttachedGroupPolicies
     (Maybe Text)
     (Maybe Text)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> ListAttachedGroupPolicies -> f ListAttachedGroupPolicies
listAttachedGroupPolicies_marker = (ListAttachedGroupPolicies -> Maybe Text)
-> (ListAttachedGroupPolicies
    -> Maybe Text -> ListAttachedGroupPolicies)
-> Lens
     ListAttachedGroupPolicies
     ListAttachedGroupPolicies
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe Natural -> f (Maybe Natural))
-> ListAttachedGroupPolicies -> f ListAttachedGroupPolicies
listAttachedGroupPolicies_maxItems = (ListAttachedGroupPolicies -> Maybe Natural)
-> (ListAttachedGroupPolicies
    -> Maybe Natural -> ListAttachedGroupPolicies)
-> Lens
     ListAttachedGroupPolicies
     ListAttachedGroupPolicies
     (Maybe Natural)
     (Maybe Natural)
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 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 :: (Text -> f Text)
-> ListAttachedGroupPolicies -> f ListAttachedGroupPolicies
listAttachedGroupPolicies_groupName = (ListAttachedGroupPolicies -> Text)
-> (ListAttachedGroupPolicies -> Text -> ListAttachedGroupPolicies)
-> Lens
     ListAttachedGroupPolicies ListAttachedGroupPolicies Text Text
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
    | Maybe Bool -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAttachedGroupPolicies
ListAttachedGroupPoliciesResponse
rs
            ListAttachedGroupPoliciesResponse
-> Getting (First Bool) ListAttachedGroupPoliciesResponse Bool
-> Maybe Bool
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Bool -> Const (First Bool) (Maybe Bool))
-> ListAttachedGroupPoliciesResponse
-> Const (First Bool) ListAttachedGroupPoliciesResponse
Lens' ListAttachedGroupPoliciesResponse (Maybe Bool)
listAttachedGroupPoliciesResponse_isTruncated
              ((Maybe Bool -> Const (First Bool) (Maybe Bool))
 -> ListAttachedGroupPoliciesResponse
 -> Const (First Bool) ListAttachedGroupPoliciesResponse)
-> ((Bool -> Const (First Bool) Bool)
    -> Maybe Bool -> Const (First Bool) (Maybe Bool))
-> Getting (First Bool) ListAttachedGroupPoliciesResponse 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 ListAttachedGroupPolicies
forall a. Maybe a
Prelude.Nothing
    | Maybe Text -> Bool
forall a. Maybe a -> Bool
Prelude.isNothing
        ( AWSResponse ListAttachedGroupPolicies
ListAttachedGroupPoliciesResponse
rs
            ListAttachedGroupPoliciesResponse
-> Getting (First Text) ListAttachedGroupPoliciesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListAttachedGroupPoliciesResponse
-> Const (First Text) ListAttachedGroupPoliciesResponse
Lens' ListAttachedGroupPoliciesResponse (Maybe Text)
listAttachedGroupPoliciesResponse_marker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListAttachedGroupPoliciesResponse
 -> Const (First Text) ListAttachedGroupPoliciesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListAttachedGroupPoliciesResponse 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 ListAttachedGroupPolicies
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListAttachedGroupPolicies -> Maybe ListAttachedGroupPolicies
forall a. a -> Maybe a
Prelude.Just (ListAttachedGroupPolicies -> Maybe ListAttachedGroupPolicies)
-> ListAttachedGroupPolicies -> Maybe ListAttachedGroupPolicies
forall a b. (a -> b) -> a -> b
Prelude.$
        ListAttachedGroupPolicies
rq
          ListAttachedGroupPolicies
-> (ListAttachedGroupPolicies -> ListAttachedGroupPolicies)
-> ListAttachedGroupPolicies
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListAttachedGroupPolicies -> Identity ListAttachedGroupPolicies
Lens
  ListAttachedGroupPolicies
  ListAttachedGroupPolicies
  (Maybe Text)
  (Maybe Text)
listAttachedGroupPolicies_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> ListAttachedGroupPolicies -> Identity ListAttachedGroupPolicies)
-> Maybe Text
-> ListAttachedGroupPolicies
-> ListAttachedGroupPolicies
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAttachedGroupPolicies
ListAttachedGroupPoliciesResponse
rs
          ListAttachedGroupPoliciesResponse
-> Getting (First Text) ListAttachedGroupPoliciesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListAttachedGroupPoliciesResponse
-> Const (First Text) ListAttachedGroupPoliciesResponse
Lens' ListAttachedGroupPoliciesResponse (Maybe Text)
listAttachedGroupPoliciesResponse_marker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListAttachedGroupPoliciesResponse
 -> Const (First Text) ListAttachedGroupPoliciesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListAttachedGroupPoliciesResponse 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 ListAttachedGroupPolicies where
  type
    AWSResponse ListAttachedGroupPolicies =
      ListAttachedGroupPoliciesResponse
  request :: ListAttachedGroupPolicies -> Request ListAttachedGroupPolicies
request = Service
-> ListAttachedGroupPolicies -> Request ListAttachedGroupPolicies
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy ListAttachedGroupPolicies
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListAttachedGroupPolicies)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse ListAttachedGroupPolicies))
-> Logger
-> Service
-> Proxy ListAttachedGroupPolicies
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListAttachedGroupPolicies)))
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
"ListAttachedGroupPoliciesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [AttachedPolicy]
-> Maybe Text
-> Maybe Bool
-> Int
-> ListAttachedGroupPoliciesResponse
ListAttachedGroupPoliciesResponse'
            (Maybe [AttachedPolicy]
 -> Maybe Text
 -> Maybe Bool
 -> Int
 -> ListAttachedGroupPoliciesResponse)
-> Either String (Maybe [AttachedPolicy])
-> Either
     String
     (Maybe Text
      -> Maybe Bool -> Int -> ListAttachedGroupPoliciesResponse)
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
"AttachedPolicies"
                            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 [AttachedPolicy]))
-> Either String (Maybe [AttachedPolicy])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [AttachedPolicy])
-> [Node] -> Either String (Maybe [AttachedPolicy])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [AttachedPolicy]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            Either
  String
  (Maybe Text
   -> Maybe Bool -> Int -> ListAttachedGroupPoliciesResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Bool -> Int -> ListAttachedGroupPoliciesResponse)
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 Bool -> Int -> ListAttachedGroupPoliciesResponse)
-> Either String (Maybe Bool)
-> Either String (Int -> ListAttachedGroupPoliciesResponse)
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 -> ListAttachedGroupPoliciesResponse)
-> Either String Int
-> Either String ListAttachedGroupPoliciesResponse
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 ListAttachedGroupPolicies

instance Prelude.NFData ListAttachedGroupPolicies

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

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

instance Core.ToQuery ListAttachedGroupPolicies where
  toQuery :: ListAttachedGroupPolicies -> QueryString
toQuery ListAttachedGroupPolicies' {Maybe Natural
Maybe Text
Text
groupName :: Text
maxItems :: Maybe Natural
marker :: Maybe Text
pathPrefix :: Maybe Text
$sel:groupName:ListAttachedGroupPolicies' :: ListAttachedGroupPolicies -> Text
$sel:maxItems:ListAttachedGroupPolicies' :: ListAttachedGroupPolicies -> Maybe Natural
$sel:marker:ListAttachedGroupPolicies' :: ListAttachedGroupPolicies -> Maybe Text
$sel:pathPrefix:ListAttachedGroupPolicies' :: ListAttachedGroupPolicies -> 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
"ListAttachedGroupPolicies" :: 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
"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
"GroupName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: 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],
    -- | 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,
    -- | 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,
    -- | The response's http status code.
    ListAttachedGroupPoliciesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListAttachedGroupPoliciesResponse
-> ListAttachedGroupPoliciesResponse -> Bool
(ListAttachedGroupPoliciesResponse
 -> ListAttachedGroupPoliciesResponse -> Bool)
-> (ListAttachedGroupPoliciesResponse
    -> ListAttachedGroupPoliciesResponse -> Bool)
-> Eq ListAttachedGroupPoliciesResponse
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]
(Int -> ReadS ListAttachedGroupPoliciesResponse)
-> ReadS [ListAttachedGroupPoliciesResponse]
-> ReadPrec ListAttachedGroupPoliciesResponse
-> ReadPrec [ListAttachedGroupPoliciesResponse]
-> Read 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
(Int -> ListAttachedGroupPoliciesResponse -> ShowS)
-> (ListAttachedGroupPoliciesResponse -> String)
-> ([ListAttachedGroupPoliciesResponse] -> ShowS)
-> Show ListAttachedGroupPoliciesResponse
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.
 ListAttachedGroupPoliciesResponse
 -> Rep ListAttachedGroupPoliciesResponse x)
-> (forall x.
    Rep ListAttachedGroupPoliciesResponse x
    -> ListAttachedGroupPoliciesResponse)
-> Generic ListAttachedGroupPoliciesResponse
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.
--
-- '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.
--
-- '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.
--
-- 'httpStatus', 'listAttachedGroupPoliciesResponse_httpStatus' - The response's http status code.
newListAttachedGroupPoliciesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAttachedGroupPoliciesResponse
newListAttachedGroupPoliciesResponse :: Int -> ListAttachedGroupPoliciesResponse
newListAttachedGroupPoliciesResponse Int
pHttpStatus_ =
  ListAttachedGroupPoliciesResponse' :: Maybe [AttachedPolicy]
-> Maybe Text
-> Maybe Bool
-> Int
-> ListAttachedGroupPoliciesResponse
ListAttachedGroupPoliciesResponse'
    { $sel:attachedPolicies:ListAttachedGroupPoliciesResponse' :: Maybe [AttachedPolicy]
attachedPolicies =
        Maybe [AttachedPolicy]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:ListAttachedGroupPoliciesResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isTruncated:ListAttachedGroupPoliciesResponse' :: Maybe Bool
isTruncated = Maybe Bool
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 :: (Maybe [AttachedPolicy] -> f (Maybe [AttachedPolicy]))
-> ListAttachedGroupPoliciesResponse
-> f ListAttachedGroupPoliciesResponse
listAttachedGroupPoliciesResponse_attachedPolicies = (ListAttachedGroupPoliciesResponse -> Maybe [AttachedPolicy])
-> (ListAttachedGroupPoliciesResponse
    -> Maybe [AttachedPolicy] -> ListAttachedGroupPoliciesResponse)
-> Lens
     ListAttachedGroupPoliciesResponse
     ListAttachedGroupPoliciesResponse
     (Maybe [AttachedPolicy])
     (Maybe [AttachedPolicy])
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) ((Maybe [AttachedPolicy] -> f (Maybe [AttachedPolicy]))
 -> ListAttachedGroupPoliciesResponse
 -> f ListAttachedGroupPoliciesResponse)
-> ((Maybe [AttachedPolicy] -> f (Maybe [AttachedPolicy]))
    -> Maybe [AttachedPolicy] -> f (Maybe [AttachedPolicy]))
-> (Maybe [AttachedPolicy] -> f (Maybe [AttachedPolicy]))
-> ListAttachedGroupPoliciesResponse
-> f ListAttachedGroupPoliciesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AttachedPolicy] [AttachedPolicy] [AttachedPolicy] [AttachedPolicy]
-> Iso
     (Maybe [AttachedPolicy])
     (Maybe [AttachedPolicy])
     (Maybe [AttachedPolicy])
     (Maybe [AttachedPolicy])
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
  [AttachedPolicy] [AttachedPolicy] [AttachedPolicy] [AttachedPolicy]
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.
listAttachedGroupPoliciesResponse_marker :: Lens.Lens' ListAttachedGroupPoliciesResponse (Prelude.Maybe Prelude.Text)
listAttachedGroupPoliciesResponse_marker :: (Maybe Text -> f (Maybe Text))
-> ListAttachedGroupPoliciesResponse
-> f ListAttachedGroupPoliciesResponse
listAttachedGroupPoliciesResponse_marker = (ListAttachedGroupPoliciesResponse -> Maybe Text)
-> (ListAttachedGroupPoliciesResponse
    -> Maybe Text -> ListAttachedGroupPoliciesResponse)
-> Lens' ListAttachedGroupPoliciesResponse (Maybe Text)
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)

-- | 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 :: (Maybe Bool -> f (Maybe Bool))
-> ListAttachedGroupPoliciesResponse
-> f ListAttachedGroupPoliciesResponse
listAttachedGroupPoliciesResponse_isTruncated = (ListAttachedGroupPoliciesResponse -> Maybe Bool)
-> (ListAttachedGroupPoliciesResponse
    -> Maybe Bool -> ListAttachedGroupPoliciesResponse)
-> Lens' ListAttachedGroupPoliciesResponse (Maybe Bool)
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)

-- | The response's http status code.
listAttachedGroupPoliciesResponse_httpStatus :: Lens.Lens' ListAttachedGroupPoliciesResponse Prelude.Int
listAttachedGroupPoliciesResponse_httpStatus :: (Int -> f Int)
-> ListAttachedGroupPoliciesResponse
-> f ListAttachedGroupPoliciesResponse
listAttachedGroupPoliciesResponse_httpStatus = (ListAttachedGroupPoliciesResponse -> Int)
-> (ListAttachedGroupPoliciesResponse
    -> Int -> ListAttachedGroupPoliciesResponse)
-> Lens
     ListAttachedGroupPoliciesResponse
     ListAttachedGroupPoliciesResponse
     Int
     Int
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