Пример #1
0
        /// <summary>
        /// RoleGetASync gets detailed role information in async
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <AuthRoleGetResponse> RoleGetASync(AuthRoleGetRequest request, Metadata headers = null)
        {
            AuthRoleGetResponse response = new AuthRoleGetResponse();
            bool success    = false;
            int  retryCount = 0;

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

                    success = true;
                }
                catch (RpcException ex) when(ex.StatusCode == StatusCode.Unavailable)
                {
                    retryCount++;
                    if (retryCount >= _balancer._numNodes)
                    {
                        throw ex;
                    }
                }
            }
            return(response);
        }
Пример #2
0
        /// <summary>
        /// RoleGetASync gets detailed role information in async
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <AuthRoleGetResponse> RoleGetASync(AuthRoleGetRequest request, Metadata headers = null)
        {
            AuthRoleGetResponse response = new AuthRoleGetResponse();

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

            return(response);
        }
Пример #3
0
        /// <summary>
        /// RoleGet gets detailed role information
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public AuthRoleGetResponse RoleGet(AuthRoleGetRequest request, Metadata headers = null)
        {
            AuthRoleGetResponse response = new AuthRoleGetResponse();


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

            return(response);
        }
Пример #4
0
        public AuthRoleGetResponse RoleGet(ByteSequence role)
        {
            Etcdserverpb.AuthRoleGetRequest roleGetRequest = new Etcdserverpb.AuthRoleGetRequest();
            roleGetRequest.Role = role.ToString();
            var rsp = authClient.RoleGet(roleGetRequest);
            AuthRoleGetResponse response = new AuthRoleGetResponse(rsp);

            return(response);
            //return Util.ToCompletableFuture(
            //    this.stub.roleGet(roleGetRequest),
            //    new FunctionResponse<Etcdserverpb.AuthRoleGetRequest, AuthRoleGetResponse>());
        }
Пример #5
0
        /// <summary>
        /// RoleGetASync gets detailed role information in async
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <AuthRoleGetResponse> RoleGetASync(AuthRoleGetRequest request)
        {
            AuthRoleGetResponse response = new AuthRoleGetResponse();

            try
            {
                response = await _authClient.RoleGetAsync(request, _headers);
            }
            catch (RpcException ex)
            {
                ResetConnection(ex);
                throw;
            }
            catch
            {
                throw;
            }
            return(response);
        }
Пример #6
0
        /// <summary>
        /// RoleGet gets detailed role information
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public AuthRoleGetResponse RoleGet(AuthRoleGetRequest request)
        {
            AuthRoleGetResponse response = new AuthRoleGetResponse();

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