Amazon AWS SDK User's Guide Page 100

  • Download
  • Add to my manuals
  • Print
  • Page
    / 155
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 99
{
Console.WriteLine(" {0}", accessKey.Id);
}
}
Get Group Information
The following example displays information about an existing group, including its associated policies and
user accounts:
// using Amazon.IdentityManagement.Resources;
// using Amazon.IdentityManagement.Model;
var iam = new IdentityManagementService();
try
{
var group = iam.GetGroupByName("DemoGroup");
Console.WriteLine("For group {0}:", group.Name);
Console.WriteLine(" Policies:");
foreach (var policy in group.GetPolicies())
{
Console.WriteLine(" {0}", policy.Name);
}
Console.WriteLine(" Users:");
foreach (var user in group.GetUsers())
{
Console.WriteLine(" {0}", user.Name);
}
}
catch (NoSuchEntityException)
{
Console.WriteLine("Group 'DemoGroup' does not exist.");
}
The following example displays a list of all accessible groups. For each group, its associated policies and
user accounts are also displayed:
// using Amazon.IdentityManagement.Resources;
var iam = new IdentityManagementService();
var groups = iam.GetGroups();
foreach (var group in groups)
{
Console.WriteLine("For group {0}:", group.Name);
Console.WriteLine(" Policies:");
foreach (var policy in group.GetPolicies())
{
Console.WriteLine(" {0}", policy.Name);
Version v2.0.0
96
AWS SDK for .NET Developer Guide
IAM Resource API Examples
Page view 99
1 2 ... 95 96 97 98 99 100 101 102 103 104 105 ... 154 155

Comments to this Manuals

No comments