public async Task CreatePolicyAsyncTest() { // Create a policy with permissions to list Amazon S3 buckets var policy = await IAM_Basics.CreatePolicyAsync(Client, S3PolicyName, testPolicyDocument); Assert.Equal(policy.PolicyName, S3PolicyName); TestPolicy = policy; }
public async Task CreateUserAsyncTest() { var user = await IAM_Basics.CreateUserAsync(Client, UserName); Assert.NotNull(user); Assert.Equal(user.UserName, UserName); UserArn = user.Arn; }
public async Task CreateAccessKeyAsyncTest() { var accessKey = await IAM_Basics.CreateAccessKeyAsync(Client, UserName); Assert.NotNull(accessKey); // Save the key values for use with other tests. AccessKeyId = accessKey.AccessKeyId; SecretKey = accessKey.SecretAccessKey; }
public async Task CreateRoleAsyncTest() { string testAssumeRolePolicy = "{" + "\"Version\": \"2012-10-17\"," + "\"Statement\": [{" + "\"Effect\": \"Allow\"," + "\"Principal\": {" + $" \"AWS\": \"{UserArn}\""+ "}," + "\"Action\": \"sts:AssumeRole\"" + "}]" + "}"; // Create the role to allow listing the Amazon Simple Storage Service // (Amazon S3) buckets. Role names are not case sensitive and must // be unique to the account for which it is created. var role = await IAM_Basics.CreateRoleAsync(Client, RoleName, testAssumeRolePolicy); var roleArn = role.Arn; Assert.NotNull(role); Assert.Equal(role.RoleName, RoleName); }
public async Task AttachRoleAsyncTest() { // Attach the policy to the role we created earlier. await IAM_Basics.AttachRoleAsync(Client, TestPolicy.Arn, RoleName); }
public void DeleteResourcesTest() { // Delete all the resources created for the various tests. var success = IAM_Basics.DeleteResourcesAsync(Client, AccessKeyId, UserName, TestPolicy.Arn, RoleName); }