User guide

"Statement" : [
{
"Sid" : "ListDeploymentsStatement",
"Effect" : "Allow",
"Action" : "codedeploy:ListDeployments",
"Resource" : "*"
}
]
}
*/
var action = new ActionIdentifier("codedeploy:ListDeployments");
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 = "ListDeploymentsStatement",
Resources = resources
};
var statements = new List<Statement>();
statements.Add(statement);
var policy = new Policy
{
Id = "ListDeploymentsPolicy",
Version = "2012-10-17",
Statements = statements
};
return policy.ToJson();
}
Add a Policy to a Group
The following example creates a new policy, adds the new policy to an existing group, and then displays
a list of the group's associated policies:
// using Amazon.IdentityManagement.Resources;
// using Amazon.IdentityManagement.Model;
var iam = new IdentityManagementService();
try
{
var group = iam.GetGroupByName("DemoGroup");
// GenerateGroupPolicyDocument() is a custom method.
string policyDoc = GenerateGroupPolicyDocument();
Version v2.0.0
102
AWS SDK for .NET Developer Guide
IAM Resource API Examples