Esempio n. 1
0
 private void DeleteRole(string roleName)
 {
     using (var identityClient = new Amazon.IdentityManagement.AmazonIdentityManagementServiceClient(TestRunner.Credentials))
     {
         identityClient.DeleteRolePolicyAsync(new Amazon.IdentityManagement.Model.DeleteRolePolicyRequest
         {
             PolicyName = policyName,
             RoleName   = roleName
         }).Wait();
         UtilityMethods.Sleep(TimeSpan.FromMilliseconds(2000));
         identityClient.DeleteRoleAsync(new Amazon.IdentityManagement.Model.DeleteRoleRequest
         {
             RoleName = roleName
         }).Wait();
         UtilityMethods.Sleep(TimeSpan.FromMilliseconds(2000));
     }
 }
Esempio n. 2
0
        private void DeleteRole(string roleName)
        {
            AutoResetEvent ars = new AutoResetEvent(false);
            Exception      responseException = new Exception();

            using (var identityClient = new Amazon.IdentityManagement.AmazonIdentityManagementServiceClient(TestRunner.Credentials))
            {
                identityClient.DeleteRolePolicyAsync(new Amazon.IdentityManagement.Model.DeleteRolePolicyRequest
                {
                    PolicyName = policyName,
                    RoleName   = roleName
                }, (response) =>
                {
                    responseException = response.Exception;
                    ars.Set();
                }, new AsyncOptions {
                    ExecuteCallbackOnMainThread = false
                });
                ars.WaitOne();
                Utils.AssertExceptionIsNull(responseException);
                Thread.Sleep(2000);
                identityClient.DeleteRoleAsync(new Amazon.IdentityManagement.Model.DeleteRoleRequest
                {
                    RoleName = roleName
                }, (response) =>
                {
                    responseException = response.Exception;
                    ars.Set();
                }, new AsyncOptions {
                    ExecuteCallbackOnMainThread = false
                });
                ars.WaitOne();
                Utils.AssertExceptionIsNull(responseException);
                Thread.Sleep(2000);
            }
        }