/// <summary>
        /// UserGet gets detailed user information
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public AuthUserGetResponse UserGet(AuthUserGetRequest request, Metadata headers = null)
        {
            AuthUserGetResponse response = new AuthUserGetResponse();
            bool success    = false;
            int  retryCount = 0;

            while (!success)
            {
                try
                {
                    response = _balancer.GetConnection().authClient.UserGet(request, headers);
                    success  = true;
                }
                catch (RpcException ex) when(ex.StatusCode == StatusCode.Unavailable)
                {
                    retryCount++;
                    if (retryCount >= _balancer._numNodes)
                    {
                        throw ex;
                    }
                }
            }
            return(response);
        }
Example #2
0
 /// <summary>
 /// UserGetAsync gets detailed user information in 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 <AuthUserGetResponse> UserGetAsync(AuthUserGetRequest request,
                                                      Grpc.Core.Metadata headers          = null, DateTime?deadline = null,
                                                      CancellationToken cancellationToken = default) => await CallEtcdAsync(async (connection) => await connection._authClient
                                                                                                                            .UserGetAsync(request, headers, deadline, cancellationToken)).ConfigureAwait(false);
Example #3
0
 /// <summary>
 /// UserGet gets detailed user information
 /// </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 AuthUserGetResponse UserGet(AuthUserGetRequest request, Grpc.Core.Metadata headers = null,
                                    DateTime?deadline = null,
                                    CancellationToken cancellationToken = default) => CallEtcd((connection) => connection._authClient
                                                                                               .UserGet(request, headers, deadline, cancellationToken));