AWSSDK.Tests.Framework.UtilityMethods.DoesRoleHavePolicy C# (CSharp) Метод

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

public static DoesRoleHavePolicy ( IAmazonIdentityManagementService iamClient, string policyName, string roleName ) : bool
iamClient IAmazonIdentityManagementService
policyName string
roleName string
Результат bool
        public static bool DoesRoleHavePolicy(IAmazonIdentityManagementService iamClient, string policyName, string roleName)
        {
            AutoResetEvent ars = new AutoResetEvent(false);
            Exception responseException = new Exception();
            List<string> policyNames = null;
            iamClient.ListRolePoliciesAsync(new ListRolePoliciesRequest()
            {
                RoleName = roleName,
            }, (response) =>
            {
                responseException = response.Exception;
                if (responseException == null)
                {
                    policyNames = response.Response.PolicyNames;
                }
                ars.Set();
            }, new AsyncOptions { ExecuteCallbackOnMainThread = false });
            ars.WaitOne();
            Assert.IsNull(responseException);
            Assert.IsNotNull(policyNames);
            return policyNames.Contains(policyName);
        }