Amazon AWS SDK Guía de usuario Pagina 107

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 155
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 106
group.CreatePolicy(policyDoc, "ListDeploymentConfigsPolicy");
Console.WriteLine("Policies for group {0}:", group.Name);
foreach (var policyItem in group.GetPolicies())
{
Console.WriteLine(" {0}", policyItem.Name);
}
}
catch (NoSuchEntityException)
{
Console.WriteLine("Group 'DemoGroup' does not exist.");
}
The preceding example relies on the following example to create the new policy.
The following example doesn't use the AWS Resource APIs for .NET, as the resource APIs currently
don't support creating a policy document. However, this example is presented for completeness:
public static string GenerateGroupPolicyDocument()
{
// using Amazon.Auth.AccessControlPolicy;
// Create a policy that looks like this:
/*
{
"Version" : "2012-10-17",
"Id": "ListDeploymentConfigsPolicy",
"Statement" : [
{
"Sid" : "ListDeploymentConfigsStatement",
"Effect" : "Allow",
"Action" : "codedeploy:ListDeploymentConfigs",
"Resource" : "*"
}
]
}
*/
var action = new ActionIdentifier("codedeploy:ListDeploymentConfigs");
var actions = new List<ActionIdentifier>();
actions.Add(action);
var resource = new Resource("*");
var resources = new List<Resource>();
resources.Add(resource);
var statement = new Statement(Statement.StatementEffect.Allow)
{
Actions = actions,
Id = "ListDeploymentConfigsStatement",
Resources = resources
};
var statements = new List<Statement>();
Version v2.0.0
103
AWS SDK for .NET Developer Guide
IAM Resource API Examples
Vista de pagina 106
1 2 ... 102 103 104 105 106 107 108 109 110 111 112 ... 154 155

Comentarios a estos manuales

Sin comentarios