コード例 #1
0
        /// <summary>
        /// UserGrantRoleAsync grants a role to a specified user in async
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <AuthUserGrantRoleResponse> UserGrantRoleAsync(AuthUserGrantRoleRequest request, Metadata headers = null)
        {
            AuthUserGrantRoleResponse response = new AuthUserGrantRoleResponse();
            bool success    = false;
            int  retryCount = 0;

            while (!success)
            {
                try
                {
                    response = await _balancer.GetConnection().authClient.UserGrantRoleAsync(request, headers);

                    success = true;
                }
                catch (RpcException ex) when(ex.StatusCode == StatusCode.Unavailable)
                {
                    retryCount++;
                    if (retryCount >= _balancer._numNodes)
                    {
                        throw ex;
                    }
                }
            }
            return(response);
        }
コード例 #2
0
        /// <summary>
        /// UserGrantRoleAsync grants a role to a specified user in async
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <AuthUserGrantRoleResponse> UserGrantRoleAsync(AuthUserGrantRoleRequest request, Metadata headers = null)
        {
            AuthUserGrantRoleResponse response = new AuthUserGrantRoleResponse();

            response = await _balancer.GetConnection().authClient.UserGrantRoleAsync(request, headers);

            return(response);
        }
コード例 #3
0
        /// <summary>
        /// UserGrant grants a role to a specified user
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public AuthUserGrantRoleResponse UserGrantRole(AuthUserGrantRoleRequest request, Metadata headers = null)
        {
            AuthUserGrantRoleResponse response = new AuthUserGrantRoleResponse();

            response = _balancer.GetConnection().authClient.UserGrantRole(request, headers);

            return(response);
        }
コード例 #4
0
        public AuthUserGrantRoleResponse UserGrantRole(ByteSequence user,
                                                       ByteSequence role)
        {
            Etcdserverpb.AuthUserGrantRoleRequest userGrantRoleRequest = new Etcdserverpb.AuthUserGrantRoleRequest();
            userGrantRoleRequest.User = user.ToString();
            userGrantRoleRequest.Role = role.ToString();
            var rsp = authClient.UserGrantRole(userGrantRoleRequest);
            AuthUserGrantRoleResponse response = new AuthUserGrantRoleResponse(rsp);

            return(response);
            // return Util.ToCompletableFuture(
            //    new FunctionResponse<Etcdserverpb.AuthUserGrantRoleRequest, AuthUserGrantRoleResponse>());
        }
コード例 #5
0
ファイル: authClient.cs プロジェクト: llkey221/dotnet-etcd
        /// <summary>
        /// UserGrantRoleAsync grants a role to a specified user in async
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <AuthUserGrantRoleResponse> UserGrantRoleAsync(AuthUserGrantRoleRequest request)
        {
            AuthUserGrantRoleResponse response = new AuthUserGrantRoleResponse();

            try
            {
                response = await _authClient.UserGrantRoleAsync(request, _headers);
            }
            catch (RpcException ex)
            {
                ResetConnection(ex);
                throw;
            }
            catch
            {
                throw;
            }
            return(response);
        }
コード例 #6
0
ファイル: authClient.cs プロジェクト: llkey221/dotnet-etcd
        /// <summary>
        /// UserGrant grants a role to a specified user
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public AuthUserGrantRoleResponse UserGrantRole(AuthUserGrantRoleRequest request)
        {
            AuthUserGrantRoleResponse response = new AuthUserGrantRoleResponse();

            try
            {
                response = _authClient.UserGrantRole(request, _headers);
            }
            catch (RpcException ex)
            {
                ResetConnection(ex);
                throw;
            }
            catch
            {
                throw;
            }
            return(response);
        }