Amazon AWS SDK Guía de usuario Pagina 104

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 155
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 103
var action = new ActionIdentifier("sts:AssumeRole");
var actions = new List<ActionIdentifier>();
actions.Add(action);
var principal = new Principal("ec2.amazonaws.com")
{
Provider = "Service"
};
var principals = new List<Principal>();
principals.Add(principal);
var statement = new Statement(Statement.StatementEffect.Allow)
{
Actions = actions,
Id = "DemoEC2TrustStatement",
Principals = principals
};
var statements = new List<Statement>();
statements.Add(statement);
var policy = new Policy
{
Id = "DemoEC2Trust",
Version = "2012-10-17",
Statements = statements
};
return policy.ToJson();
}
Add a User Account to a Group
The following example adds an existing user account to an existing group and then displays a list of the
group's associated user accounts:
// using Amazon.IdentityManagement.Resources;
// using Amazon.IdentityManagement.Model;
var iam = new IdentityManagementService();
try
{
var group = iam.GetGroupByName("DemoGroup");
group.AddUser("DemoUser");
Console.WriteLine("Users in group {0}:", group.Name);
foreach (var user in group.GetUsers())
{
Console.WriteLine(" {0}", user.Name);
}
Version v2.0.0
100
AWS SDK for .NET Developer Guide
IAM Resource API Examples
Vista de pagina 103
1 2 ... 99 100 101 102 103 104 105 106 107 108 109 ... 154 155

Comentarios a estos manuales

Sin comentarios