list_roles ( $opt )

Lists the roles that have the specified path prefix. If there are none, the action returns an empty list. For more information about roles, go to Working with Roles.

You can paginate the results using the MaxItems and Marker parameters.

The returned policy is URL-encoded according to RFC 3986. For more information about RFC 3986, go to http://www.faqs.org/rfcs/rfc3986.html.

Access

public

Parameters

Parameter

Type

Required

Description

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • PathPrefix - string - Optional - The path prefix for filtering the results. For example: /application_abc/component_xyz/, which would get all roles whose path starts with /application_abc/component_xyz/. This parameter is optional. If it is not included, it defaults to a slash (/), listing all roles. [Constraints: The value must be between 1 and 512 characters, and must match the following regular expression pattern: \u002F[\u0021-\u007F]*]
  • Marker - string - Optional - Use this parameter only when paginating results, and only in a subsequent request after you’ve received a response where the results are truncated. Set it to the value of the Marker element in the response you just received. [Constraints: The value must be between 1 and 320 characters, and must match the following regular expression pattern: [\u0020-\u00FF]*]
  • MaxItems - integer - Optional - Use this parameter only when paginating results to indicate the maximum number of user names you want in the response. If there are additional user names beyond the maximum you specify, the IsTruncated response element is true.
  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Test the preparation of instance profiles and roles.

// Instantiate the client
$iam = new AmazonIAM();

// List instance profiles
$response = $iam->list_instance_profiles();
var_dump($response->isOK());

// List roles
$response = $iam->list_roles();
var_dump($response->isOK());

// List instance profiles for role
$response = $iam->list_instance_profiles_for_role('example-role');
var_dump($response->isOK());

// List role policies
$response = $iam->list_role_policies('example-role');
var_dump($response->isOK());
Result:
bool(true)
bool(true)
bool(true)
bool(true)

Source

Method defined in services/iam.class.php | Toggle source view (6 lines) | View on GitHub

public function list_roles($opt = null)
{
    if (!$opt) $opt = array();
            
    return $this->authenticate('ListRoles', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback