/// <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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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>());
        }
Exemple #5
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)
        {
            AuthUserGrantRoleResponse response = new AuthUserGrantRoleResponse();

            try
            {
                response = await _authClient.UserGrantRoleAsync(request, _headers);
            }
            catch (RpcException ex)
            {
                ResetConnection(ex);
                throw;
            }
            catch
            {
                throw;
            }
            return(response);
        }
Exemple #6
0
        /// <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);
        }