Exemplo n.º 1
0
 /// <summary>
 /// RoleListAsync gets lists of all roles async
 /// </summary>
 /// <param name="request">The request to send to the server.</param>
 /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
 /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
 /// <param name="cancellationToken">An optional token for canceling the call.</param>
 /// <returns>The response received from the server.</returns>
 public async Task <AuthRoleListResponse> RoleListAsync(AuthRoleListRequest request,
                                                        Grpc.Core.Metadata headers          = null, DateTime?deadline = null,
                                                        CancellationToken cancellationToken = default)
 {
     return(await CallEtcdAsync(async (connection) => await connection._authClient
                                .RoleListAsync(request, headers, deadline, cancellationToken)).ConfigureAwait(false));
 }
Exemplo n.º 2
0
 /// <summary>
 /// RoleList gets lists of all roles
 /// </summary>
 /// <param name="request">The request to send to the server.</param>
 /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
 /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
 /// <param name="cancellationToken">An optional token for canceling the call.</param>
 /// <returns>The response received from the server.</returns>
 public AuthRoleListResponse RoleList(AuthRoleListRequest request, Grpc.Core.Metadata headers = null,
                                      DateTime?deadline = null,
                                      CancellationToken cancellationToken = default)
 {
     return(CallEtcd((connection) => connection._authClient
                     .RoleList(request, headers, deadline, cancellationToken)));
 }
Exemplo n.º 3
0
        /// <summary>
        /// RoleListAsync gets lists of all roles async
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <AuthRoleListResponse> RoleListAsync(AuthRoleListRequest request, Metadata headers = null)
        {
            AuthRoleListResponse response = new AuthRoleListResponse();
            bool success    = false;
            int  retryCount = 0;

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

                    success = true;
                }
                catch (RpcException ex) when(ex.StatusCode == StatusCode.Unavailable)
                {
                    retryCount++;
                    if (retryCount >= _balancer._numNodes)
                    {
                        throw ex;
                    }
                }
            }
            return(response);
        }
Exemplo n.º 4
0
        /// <summary>
        /// RoleListAsync gets lists of all roles async
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <AuthRoleListResponse> RoleListAsync(AuthRoleListRequest request, Metadata headers = null)
        {
            AuthRoleListResponse response = new AuthRoleListResponse();

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

            return(response);
        }
Exemplo n.º 5
0
        /// <summary>
        /// RoleList gets lists of all roles
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public AuthRoleListResponse RoleList(AuthRoleListRequest request, Metadata headers = null)
        {
            AuthRoleListResponse response = new AuthRoleListResponse();

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

            return(response);
        }
Exemplo n.º 6
0
        /// <summary>
        /// RoleListAsync gets lists of all roles async
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <AuthRoleListResponse> RoleListAsync(AuthRoleListRequest request)
        {
            AuthRoleListResponse response = new AuthRoleListResponse();

            try
            {
                response = await _authClient.RoleListAsync(request, _headers);
            }
            catch (RpcException ex)
            {
                ResetConnection(ex);
                throw;
            }
            catch
            {
                throw;
            }
            return(response);
        }
Exemplo n.º 7
0
        /// <summary>
        /// RoleList gets lists of all roles
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public AuthRoleListResponse RoleList(AuthRoleListRequest request)
        {
            AuthRoleListResponse response = new AuthRoleListResponse();

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