{-# 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.ListInstanceProfilesForRole
-- 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 instance profiles that have the specified associated IAM role.
-- If there are none, the operation returns an empty list. For more
-- information about instance profiles, go to
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/AboutInstanceProfiles.html About instance profiles>.
--
-- You can paginate the results using the @MaxItems@ and @Marker@
-- parameters.
--
-- This operation returns paginated results.
module Amazonka.IAM.ListInstanceProfilesForRole
  ( -- * Creating a Request
    ListInstanceProfilesForRole (..),
    newListInstanceProfilesForRole,

    -- * Request Lenses
    listInstanceProfilesForRole_marker,
    listInstanceProfilesForRole_maxItems,
    listInstanceProfilesForRole_roleName,

    -- * Destructuring the Response
    ListInstanceProfilesForRoleResponse (..),
    newListInstanceProfilesForRoleResponse,

    -- * Response Lenses
    listInstanceProfilesForRoleResponse_marker,
    listInstanceProfilesForRoleResponse_isTruncated,
    listInstanceProfilesForRoleResponse_httpStatus,
    listInstanceProfilesForRoleResponse_instanceProfiles,
  )
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:/ 'newListInstanceProfilesForRole' smart constructor.
data ListInstanceProfilesForRole = ListInstanceProfilesForRole'
  { -- | 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.
    ListInstanceProfilesForRole -> 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.
    ListInstanceProfilesForRole -> Maybe Natural
maxItems :: Prelude.Maybe Prelude.Natural,
    -- | The name of the role to list instance profiles 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: _+=,.\@-
    ListInstanceProfilesForRole -> Text
roleName :: Prelude.Text
  }
  deriving (ListInstanceProfilesForRole -> ListInstanceProfilesForRole -> Bool
(ListInstanceProfilesForRole
 -> ListInstanceProfilesForRole -> Bool)
-> (ListInstanceProfilesForRole
    -> ListInstanceProfilesForRole -> Bool)
-> Eq ListInstanceProfilesForRole
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListInstanceProfilesForRole -> ListInstanceProfilesForRole -> Bool
$c/= :: ListInstanceProfilesForRole -> ListInstanceProfilesForRole -> Bool
== :: ListInstanceProfilesForRole -> ListInstanceProfilesForRole -> Bool
$c== :: ListInstanceProfilesForRole -> ListInstanceProfilesForRole -> Bool
Prelude.Eq, ReadPrec [ListInstanceProfilesForRole]
ReadPrec ListInstanceProfilesForRole
Int -> ReadS ListInstanceProfilesForRole
ReadS [ListInstanceProfilesForRole]
(Int -> ReadS ListInstanceProfilesForRole)
-> ReadS [ListInstanceProfilesForRole]
-> ReadPrec ListInstanceProfilesForRole
-> ReadPrec [ListInstanceProfilesForRole]
-> Read ListInstanceProfilesForRole
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListInstanceProfilesForRole]
$creadListPrec :: ReadPrec [ListInstanceProfilesForRole]
readPrec :: ReadPrec ListInstanceProfilesForRole
$creadPrec :: ReadPrec ListInstanceProfilesForRole
readList :: ReadS [ListInstanceProfilesForRole]
$creadList :: ReadS [ListInstanceProfilesForRole]
readsPrec :: Int -> ReadS ListInstanceProfilesForRole
$creadsPrec :: Int -> ReadS ListInstanceProfilesForRole
Prelude.Read, Int -> ListInstanceProfilesForRole -> ShowS
[ListInstanceProfilesForRole] -> ShowS
ListInstanceProfilesForRole -> String
(Int -> ListInstanceProfilesForRole -> ShowS)
-> (ListInstanceProfilesForRole -> String)
-> ([ListInstanceProfilesForRole] -> ShowS)
-> Show ListInstanceProfilesForRole
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListInstanceProfilesForRole] -> ShowS
$cshowList :: [ListInstanceProfilesForRole] -> ShowS
show :: ListInstanceProfilesForRole -> String
$cshow :: ListInstanceProfilesForRole -> String
showsPrec :: Int -> ListInstanceProfilesForRole -> ShowS
$cshowsPrec :: Int -> ListInstanceProfilesForRole -> ShowS
Prelude.Show, (forall x.
 ListInstanceProfilesForRole -> Rep ListInstanceProfilesForRole x)
-> (forall x.
    Rep ListInstanceProfilesForRole x -> ListInstanceProfilesForRole)
-> Generic ListInstanceProfilesForRole
forall x.
Rep ListInstanceProfilesForRole x -> ListInstanceProfilesForRole
forall x.
ListInstanceProfilesForRole -> Rep ListInstanceProfilesForRole x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListInstanceProfilesForRole x -> ListInstanceProfilesForRole
$cfrom :: forall x.
ListInstanceProfilesForRole -> Rep ListInstanceProfilesForRole x
Prelude.Generic)

-- |
-- Create a value of 'ListInstanceProfilesForRole' 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', 'listInstanceProfilesForRole_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', 'listInstanceProfilesForRole_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.
--
-- 'roleName', 'listInstanceProfilesForRole_roleName' - The name of the role to list instance profiles 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: _+=,.\@-
newListInstanceProfilesForRole ::
  -- | 'roleName'
  Prelude.Text ->
  ListInstanceProfilesForRole
newListInstanceProfilesForRole :: Text -> ListInstanceProfilesForRole
newListInstanceProfilesForRole Text
pRoleName_ =
  ListInstanceProfilesForRole' :: Maybe Text -> Maybe Natural -> Text -> ListInstanceProfilesForRole
ListInstanceProfilesForRole'
    { $sel:marker:ListInstanceProfilesForRole' :: Maybe Text
marker =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxItems:ListInstanceProfilesForRole' :: Maybe Natural
maxItems = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:roleName:ListInstanceProfilesForRole' :: Text
roleName = Text
pRoleName_
    }

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

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

-- | The name of the role to list instance profiles 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: _+=,.\@-
listInstanceProfilesForRole_roleName :: Lens.Lens' ListInstanceProfilesForRole Prelude.Text
listInstanceProfilesForRole_roleName :: (Text -> f Text)
-> ListInstanceProfilesForRole -> f ListInstanceProfilesForRole
listInstanceProfilesForRole_roleName = (ListInstanceProfilesForRole -> Text)
-> (ListInstanceProfilesForRole
    -> Text -> ListInstanceProfilesForRole)
-> Lens
     ListInstanceProfilesForRole ListInstanceProfilesForRole Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInstanceProfilesForRole' {Text
roleName :: Text
$sel:roleName:ListInstanceProfilesForRole' :: ListInstanceProfilesForRole -> Text
roleName} -> Text
roleName) (\s :: ListInstanceProfilesForRole
s@ListInstanceProfilesForRole' {} Text
a -> ListInstanceProfilesForRole
s {$sel:roleName:ListInstanceProfilesForRole' :: Text
roleName = Text
a} :: ListInstanceProfilesForRole)

instance Core.AWSPager ListInstanceProfilesForRole where
  page :: ListInstanceProfilesForRole
-> AWSResponse ListInstanceProfilesForRole
-> Maybe ListInstanceProfilesForRole
page ListInstanceProfilesForRole
rq AWSResponse ListInstanceProfilesForRole
rs
    | Maybe Bool -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListInstanceProfilesForRole
ListInstanceProfilesForRoleResponse
rs
            ListInstanceProfilesForRoleResponse
-> Getting (First Bool) ListInstanceProfilesForRoleResponse Bool
-> Maybe Bool
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Bool -> Const (First Bool) (Maybe Bool))
-> ListInstanceProfilesForRoleResponse
-> Const (First Bool) ListInstanceProfilesForRoleResponse
Lens' ListInstanceProfilesForRoleResponse (Maybe Bool)
listInstanceProfilesForRoleResponse_isTruncated
              ((Maybe Bool -> Const (First Bool) (Maybe Bool))
 -> ListInstanceProfilesForRoleResponse
 -> Const (First Bool) ListInstanceProfilesForRoleResponse)
-> ((Bool -> Const (First Bool) Bool)
    -> Maybe Bool -> Const (First Bool) (Maybe Bool))
-> Getting (First Bool) ListInstanceProfilesForRoleResponse 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 ListInstanceProfilesForRole
forall a. Maybe a
Prelude.Nothing
    | Maybe Text -> Bool
forall a. Maybe a -> Bool
Prelude.isNothing
        ( AWSResponse ListInstanceProfilesForRole
ListInstanceProfilesForRoleResponse
rs
            ListInstanceProfilesForRoleResponse
-> Getting (First Text) ListInstanceProfilesForRoleResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListInstanceProfilesForRoleResponse
-> Const (First Text) ListInstanceProfilesForRoleResponse
Lens' ListInstanceProfilesForRoleResponse (Maybe Text)
listInstanceProfilesForRoleResponse_marker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListInstanceProfilesForRoleResponse
 -> Const (First Text) ListInstanceProfilesForRoleResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListInstanceProfilesForRoleResponse 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 ListInstanceProfilesForRole
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListInstanceProfilesForRole -> Maybe ListInstanceProfilesForRole
forall a. a -> Maybe a
Prelude.Just (ListInstanceProfilesForRole -> Maybe ListInstanceProfilesForRole)
-> ListInstanceProfilesForRole -> Maybe ListInstanceProfilesForRole
forall a b. (a -> b) -> a -> b
Prelude.$
        ListInstanceProfilesForRole
rq
          ListInstanceProfilesForRole
-> (ListInstanceProfilesForRole -> ListInstanceProfilesForRole)
-> ListInstanceProfilesForRole
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListInstanceProfilesForRole
-> Identity ListInstanceProfilesForRole
Lens
  ListInstanceProfilesForRole
  ListInstanceProfilesForRole
  (Maybe Text)
  (Maybe Text)
listInstanceProfilesForRole_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> ListInstanceProfilesForRole
 -> Identity ListInstanceProfilesForRole)
-> Maybe Text
-> ListInstanceProfilesForRole
-> ListInstanceProfilesForRole
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListInstanceProfilesForRole
ListInstanceProfilesForRoleResponse
rs
          ListInstanceProfilesForRoleResponse
-> Getting (First Text) ListInstanceProfilesForRoleResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListInstanceProfilesForRoleResponse
-> Const (First Text) ListInstanceProfilesForRoleResponse
Lens' ListInstanceProfilesForRoleResponse (Maybe Text)
listInstanceProfilesForRoleResponse_marker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListInstanceProfilesForRoleResponse
 -> Const (First Text) ListInstanceProfilesForRoleResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListInstanceProfilesForRoleResponse 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 ListInstanceProfilesForRole where
  type
    AWSResponse ListInstanceProfilesForRole =
      ListInstanceProfilesForRoleResponse
  request :: ListInstanceProfilesForRole -> Request ListInstanceProfilesForRole
request = Service
-> ListInstanceProfilesForRole
-> Request ListInstanceProfilesForRole
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy ListInstanceProfilesForRole
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListInstanceProfilesForRole)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse ListInstanceProfilesForRole))
-> Logger
-> Service
-> Proxy ListInstanceProfilesForRole
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListInstanceProfilesForRole)))
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
"ListInstanceProfilesForRoleResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text
-> Maybe Bool
-> Int
-> [InstanceProfile]
-> ListInstanceProfilesForRoleResponse
ListInstanceProfilesForRoleResponse'
            (Maybe Text
 -> Maybe Bool
 -> Int
 -> [InstanceProfile]
 -> ListInstanceProfilesForRoleResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Bool
      -> Int -> [InstanceProfile] -> ListInstanceProfilesForRoleResponse)
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 -> [InstanceProfile] -> ListInstanceProfilesForRoleResponse)
-> Either String (Maybe Bool)
-> Either
     String
     (Int -> [InstanceProfile] -> ListInstanceProfilesForRoleResponse)
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 -> [InstanceProfile] -> ListInstanceProfilesForRoleResponse)
-> Either String Int
-> Either
     String ([InstanceProfile] -> ListInstanceProfilesForRoleResponse)
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 ([InstanceProfile] -> ListInstanceProfilesForRoleResponse)
-> Either String [InstanceProfile]
-> Either String ListInstanceProfilesForRoleResponse
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
"InstanceProfiles"
                            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 [InstanceProfile])
-> Either String [InstanceProfile]
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= Text -> [Node] -> Either String [InstanceProfile]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member"
                        )
      )

instance Prelude.Hashable ListInstanceProfilesForRole

instance Prelude.NFData ListInstanceProfilesForRole

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

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

instance Core.ToQuery ListInstanceProfilesForRole where
  toQuery :: ListInstanceProfilesForRole -> QueryString
toQuery ListInstanceProfilesForRole' {Maybe Natural
Maybe Text
Text
roleName :: Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:roleName:ListInstanceProfilesForRole' :: ListInstanceProfilesForRole -> Text
$sel:maxItems:ListInstanceProfilesForRole' :: ListInstanceProfilesForRole -> Maybe Natural
$sel:marker:ListInstanceProfilesForRole' :: ListInstanceProfilesForRole -> 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
"ListInstanceProfilesForRole" ::
                      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
"RoleName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
roleName
      ]

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

-- |
-- Create a value of 'ListInstanceProfilesForRoleResponse' 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', 'listInstanceProfilesForRoleResponse_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', 'listInstanceProfilesForRoleResponse_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', 'listInstanceProfilesForRoleResponse_httpStatus' - The response's http status code.
--
-- 'instanceProfiles', 'listInstanceProfilesForRoleResponse_instanceProfiles' - A list of instance profiles.
newListInstanceProfilesForRoleResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListInstanceProfilesForRoleResponse
newListInstanceProfilesForRoleResponse :: Int -> ListInstanceProfilesForRoleResponse
newListInstanceProfilesForRoleResponse Int
pHttpStatus_ =
  ListInstanceProfilesForRoleResponse' :: Maybe Text
-> Maybe Bool
-> Int
-> [InstanceProfile]
-> ListInstanceProfilesForRoleResponse
ListInstanceProfilesForRoleResponse'
    { $sel:marker:ListInstanceProfilesForRoleResponse' :: Maybe Text
marker =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isTruncated:ListInstanceProfilesForRoleResponse' :: Maybe Bool
isTruncated = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListInstanceProfilesForRoleResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:instanceProfiles:ListInstanceProfilesForRoleResponse' :: [InstanceProfile]
instanceProfiles = [InstanceProfile]
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.
listInstanceProfilesForRoleResponse_marker :: Lens.Lens' ListInstanceProfilesForRoleResponse (Prelude.Maybe Prelude.Text)
listInstanceProfilesForRoleResponse_marker :: (Maybe Text -> f (Maybe Text))
-> ListInstanceProfilesForRoleResponse
-> f ListInstanceProfilesForRoleResponse
listInstanceProfilesForRoleResponse_marker = (ListInstanceProfilesForRoleResponse -> Maybe Text)
-> (ListInstanceProfilesForRoleResponse
    -> Maybe Text -> ListInstanceProfilesForRoleResponse)
-> Lens' ListInstanceProfilesForRoleResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInstanceProfilesForRoleResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:ListInstanceProfilesForRoleResponse' :: ListInstanceProfilesForRoleResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListInstanceProfilesForRoleResponse
s@ListInstanceProfilesForRoleResponse' {} Maybe Text
a -> ListInstanceProfilesForRoleResponse
s {$sel:marker:ListInstanceProfilesForRoleResponse' :: Maybe Text
marker = Maybe Text
a} :: ListInstanceProfilesForRoleResponse)

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

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

-- | A list of instance profiles.
listInstanceProfilesForRoleResponse_instanceProfiles :: Lens.Lens' ListInstanceProfilesForRoleResponse [InstanceProfile]
listInstanceProfilesForRoleResponse_instanceProfiles :: ([InstanceProfile] -> f [InstanceProfile])
-> ListInstanceProfilesForRoleResponse
-> f ListInstanceProfilesForRoleResponse
listInstanceProfilesForRoleResponse_instanceProfiles = (ListInstanceProfilesForRoleResponse -> [InstanceProfile])
-> (ListInstanceProfilesForRoleResponse
    -> [InstanceProfile] -> ListInstanceProfilesForRoleResponse)
-> Lens
     ListInstanceProfilesForRoleResponse
     ListInstanceProfilesForRoleResponse
     [InstanceProfile]
     [InstanceProfile]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInstanceProfilesForRoleResponse' {[InstanceProfile]
instanceProfiles :: [InstanceProfile]
$sel:instanceProfiles:ListInstanceProfilesForRoleResponse' :: ListInstanceProfilesForRoleResponse -> [InstanceProfile]
instanceProfiles} -> [InstanceProfile]
instanceProfiles) (\s :: ListInstanceProfilesForRoleResponse
s@ListInstanceProfilesForRoleResponse' {} [InstanceProfile]
a -> ListInstanceProfilesForRoleResponse
s {$sel:instanceProfiles:ListInstanceProfilesForRoleResponse' :: [InstanceProfile]
instanceProfiles = [InstanceProfile]
a} :: ListInstanceProfilesForRoleResponse) (([InstanceProfile] -> f [InstanceProfile])
 -> ListInstanceProfilesForRoleResponse
 -> f ListInstanceProfilesForRoleResponse)
-> (([InstanceProfile] -> f [InstanceProfile])
    -> [InstanceProfile] -> f [InstanceProfile])
-> ([InstanceProfile] -> f [InstanceProfile])
-> ListInstanceProfilesForRoleResponse
-> f ListInstanceProfilesForRoleResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([InstanceProfile] -> f [InstanceProfile])
-> [InstanceProfile] -> f [InstanceProfile]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.NFData
    ListInstanceProfilesForRoleResponse