Jump to Content

This API Documentation is now deprecated

We are excited to announce our new API Documentation.

Class ListRolesCommandProtected

Lists the IAM roles that have the specified path prefix. If there are none, the operation returns an empty list. For more information about roles, see IAM roles in the IAM User Guide.

IAM resource-listing operations return a subset of the available attributes for the resource. This operation does not return the following attributes, even though they are an attribute of the returned object:

  • PermissionsBoundary

  • RoleLastUsed

  • Tags

To view all of the information for a role, see GetRole.

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

Example

Use a bare-bones client and the command you need to make an API call.

import { IAMClient, ListRolesCommand } from "@aws-sdk/client-iam"; // ES Modules import
// const { IAMClient, ListRolesCommand } = require("@aws-sdk/client-iam"); // CommonJS import
const client = new IAMClient(config);
const input = { // ListRolesRequest
PathPrefix: "STRING_VALUE",
Marker: "STRING_VALUE",
MaxItems: Number("int"),
};
const command = new ListRolesCommand(input);
const response = await client.send(command);
// { // ListRolesResponse
// Roles: [ // roleListType // required
// { // Role
// Path: "STRING_VALUE", // required
// RoleName: "STRING_VALUE", // required
// RoleId: "STRING_VALUE", // required
// Arn: "STRING_VALUE", // required
// CreateDate: new Date("TIMESTAMP"), // required
// AssumeRolePolicyDocument: "STRING_VALUE",
// Description: "STRING_VALUE",
// MaxSessionDuration: Number("int"),
// PermissionsBoundary: { // AttachedPermissionsBoundary
// PermissionsBoundaryType: "PermissionsBoundaryPolicy",
// PermissionsBoundaryArn: "STRING_VALUE",
// },
// Tags: [ // tagListType
// { // Tag
// Key: "STRING_VALUE", // required
// Value: "STRING_VALUE", // required
// },
// ],
// RoleLastUsed: { // RoleLastUsed
// LastUsedDate: new Date("TIMESTAMP"),
// Region: "STRING_VALUE",
// },
// },
// ],
// IsTruncated: true || false,
// Marker: "STRING_VALUE",
// };

Param

ListRolesCommandInput

Returns

ListRolesCommandOutput

See

Throws

ServiceFailureException (server fault)

The request processing has failed because of an unknown error, exception or failure.

Throws

IAMServiceException

Base exception class for all service exceptions from IAM service.

Hierarchy

Constructors

Properties

Methods

Constructors

Properties

Methods