AWSSDK_DotNet.IntegrationTests.Tests.IAM.IAMUtil.DeleteTestUsers C# (CSharp) Метод

DeleteTestUsers() публичный статический Метод

public static DeleteTestUsers ( AmazonIdentityManagementServiceClient client ) : void
client Amazon.IdentityManagement.AmazonIdentityManagementServiceClient
Результат void
        public static void DeleteTestUsers(AmazonIdentityManagementServiceClient client, params string[] usernames)
        {
            UtilityMethods.WaitUntilSuccess(() => {
                foreach (string s in usernames)
                {
                    DeleteAccessKeysForUser(client, s);
                    DeleteUserPoliciesForUser(client, s);
                    DeleteCertificatesForUser(client, s);
                    try 
                    {
                        client.DeleteLoginProfileAsync(new DeleteLoginProfileRequest() { UserName = s }).Wait(); 
                    } catch { }

                    client.DeleteUserAsync(new DeleteUserRequest() { UserName = s }).Wait();
                }
            },10,500);
        }
    }

Usage Example

Пример #1
0
        //[ExpectedException(typeof(NoSuchEntityException))]
        public void TestDeleteLoginProfile()
        {
            string username = IAMUtil.CreateTestUser(Client);
            string password = "******";

            try
            {
                Client.CreateLoginProfileAsync(new CreateLoginProfileRequest()
                {
                    UserName = username, Password = password
                }).Wait();
                UtilityMethods.Sleep(TimeSpan.FromSeconds(10));
                Client.DeleteLoginProfileAsync(new DeleteLoginProfileRequest()
                {
                    UserName = username
                }).Wait();
                UtilityMethods.Sleep(TimeSpan.FromSeconds(10));
                GetLoginProfileResponse getRes =
                    Client.GetLoginProfileAsync(new GetLoginProfileRequest()
                {
                    UserName = username
                }).Result;
            }
            catch (AggregateException ae)
            {
                AssertExtensions.VerifyException <NoSuchEntityException>(ae);
            }
            finally
            {
                IAMUtil.DeleteTestUsers(Client, username);
            }
        }
All Usage Examples Of AWSSDK_DotNet.IntegrationTests.Tests.IAM.IAMUtil::DeleteTestUsers