User guide

Console.WriteLine(" Access keys:");
foreach (var accessKey in responseAccessKeys.AccessKeyMetadata)
{
Console.WriteLine(" {0}", accessKey.AccessKeyId);
}
}
For additional examples, see Tutorial: Using an IAM Role (p. 108).
For related API reference information, see Amazon.IdentityManagement and
Amazon.IdentityManagement.Model.
Resource APIs
The SDK for .NET provides the AWS Resource APIs for .NET for programming with IAM.These resource
APIs provide a resource-level programming model that enables you to write code to work more directly
with IAM resources as compared to their low-level API counterparts. (For more information about the
AWS Resource APIs for .NET, including how to download and reference these resource APIs, see AWS
Resource APIs for .NET (p. 41).)
Caution
The AWS Resource APIs for .NET are currently provided as a preview. This means that these
resource APIs may frequently change in response to customer feedback, and these changes
may happen without advance notice. Until these resource APIs exit the preview stage, please
be cautious about writing and distributing production-quality code that relies on them.
The following example shows how to use the AWS Resource APIs for .NET to list accessible user accounts
in IAM. For each user account, its associated groups, policies, and access key IDs are also listed:
// using Amazon.IdentityManagement.Resources;
var iam = new IdentityManagementService();
var users = iam.GetUsers();
foreach (var user in users)
{
Console.WriteLine("For user {0}:", user.Name);
Console.WriteLine(" In groups:");
foreach (var group in user.GetGroups())
{
Console.WriteLine(" {0}", group.Name);
}
Console.WriteLine(" Policies:");
foreach (var policy in user.GetPolicies())
{
Console.WriteLine(" {0}", policy.Name);
}
Console.WriteLine(" Access keys:");
foreach (var accessKey in user.GetAccessKeys())
{
Version v2.0.0
93
AWS SDK for .NET Developer Guide
Programming Models