Пример #1
0
        /// <summary>
        /// Internal method that cleans up the created identity pool (along with associated
        /// clients/roles) for testing
        /// </summary>
        public override async void Dispose()
        {
            try
            {
                await identityClient.DeleteIdentityPoolAsync(new DeleteIdentityPoolRequest()
                {
                    IdentityPoolId = identityPoolId
                }).ConfigureAwait(false);

                await managementClient.DetachRolePolicyAsync(new DetachRolePolicyRequest()
                {
                    PolicyArn = policyArn,
                    RoleName  = roleName
                }).ConfigureAwait(false);

                await managementClient.DeletePolicyAsync(new DeletePolicyRequest()
                {
                    PolicyArn = policyArn
                }).ConfigureAwait(false);

                await managementClient.DeleteRoleAsync(new DeleteRoleRequest()
                {
                    RoleName = roleName
                }).ConfigureAwait(false);

                identityClient.Dispose();
                managementClient.Dispose();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }

            base.Dispose();
        }
Пример #2
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposed && disposing)
            {
                cognitoClient.Dispose();
                stsClient.Dispose();

                _disposed = true;
            }
        }