Amazon AWS SDK Betriebsanweisung Seite 96

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 155
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 95
Programming Models
The SDK for .NET provides two programming models for working with IAM. These programming models
are known as the low-level model and the resource model. The following information describes these
models and how to use them.
Low-Level APIs
The SDK for .NET provides low-level APIs for programming with IAM.These low-level APIs typically
consist of sets of matching request-and-response objects that correspond to HTTP-based API calls
focusing on their corresponding service-level constructs.
The following example shows how to use the low-level APIs 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;
// using Amazon.IdentityManagement.Model;
var client = new AmazonIdentityManagementServiceClient();
var requestUsers = new ListUsersRequest();
var responseUsers = client.ListUsers(requestUsers);
foreach (var user in responseUsers.Users)
{
Console.WriteLine("For user {0}:", user.UserName);
Console.WriteLine(" In groups:");
var requestGroups = new ListGroupsForUserRequest
{
UserName = user.UserName
};
var responseGroups = client.ListGroupsForUser(requestGroups);
foreach (var group in responseGroups.Groups)
{
Console.WriteLine(" {0}", group.GroupName);
}
Console.WriteLine(" Policies:");
var requestPolicies = new ListUserPoliciesRequest
{
UserName = user.UserName
};
var responsePolicies = client.ListUserPolicies(requestPolicies);
foreach (var policy in responsePolicies.PolicyNames)
{
Console.WriteLine(" {0}", policy);
}
var requestAccessKeys = new ListAccessKeysRequest
{
UserName = user.UserName
};
var responseAccessKeys = client.ListAccessKeys(requestAccessKeys);
Version v2.0.0
92
AWS SDK for .NET Developer Guide
Programming Models
Seitenansicht 95
1 2 ... 91 92 93 94 95 96 97 98 99 100 101 ... 154 155

Kommentare zu diesen Handbüchern

Keine Kommentare