/// <summary>
 /// RoleDeleteAsync deletes a specified role 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 <AuthRoleDeleteResponse> RoleDeleteAsync(AuthRoleDeleteRequest request,
                                                            Grpc.Core.Metadata headers          = null, DateTime?deadline = null,
                                                            CancellationToken cancellationToken = default)
 {
     return(await CallEtcdAsync(async (connection) => await connection._authClient
                                .RoleDeleteAsync(request, headers, deadline, cancellationToken)).ConfigureAwait(false));
 }
 /// <summary>
 /// RoleDelete deletes a specified role
 /// </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 AuthRoleDeleteResponse RoleDelete(AuthRoleDeleteRequest request, Grpc.Core.Metadata headers = null,
                                          DateTime?deadline = null,
                                          CancellationToken cancellationToken = default)
 {
     return(CallEtcd((connection) => connection._authClient
                     .RoleDelete(request, headers, deadline, cancellationToken)));
 }
        /// <summary>
        /// RoleDeleteAsync deletes a specified role in async
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <AuthRoleDeleteResponse> RoleDeleteAsync(AuthRoleDeleteRequest request, Metadata headers = null)
        {
            AuthRoleDeleteResponse response = new AuthRoleDeleteResponse();
            bool success    = false;
            int  retryCount = 0;

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

                    success = true;
                }
                catch (RpcException ex) when(ex.StatusCode == StatusCode.Unavailable)
                {
                    retryCount++;
                    if (retryCount >= _balancer._numNodes)
                    {
                        throw ex;
                    }
                }
            }
            return(response);
        }
Beispiel #4
0
        /// <summary>
        /// RoleDeleteAsync deletes a specified role in async
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <AuthRoleDeleteResponse> RoleDeleteAsync(AuthRoleDeleteRequest request, Metadata headers = null)
        {
            AuthRoleDeleteResponse response = new AuthRoleDeleteResponse();

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

            return(response);
        }
Beispiel #5
0
        /// <summary>
        /// RoleDelete deletes a specified role
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public AuthRoleDeleteResponse RoleDelete(AuthRoleDeleteRequest request, Metadata headers = null)
        {
            AuthRoleDeleteResponse response = new AuthRoleDeleteResponse();

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

            return(response);
        }
Beispiel #6
0
        /// <summary>
        /// RoleDeleteAsync deletes a specified role in async
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <AuthRoleDeleteResponse> RoleDeleteAsync(AuthRoleDeleteRequest request)
        {
            AuthRoleDeleteResponse response = new AuthRoleDeleteResponse();

            try
            {
                response = await _authClient.RoleDeleteAsync(request, _headers);
            }
            catch (RpcException ex)
            {
                ResetConnection(ex);
                throw;
            }
            catch
            {
                throw;
            }
            return(response);
        }
Beispiel #7
0
        /// <summary>
        /// RoleDelete deletes a specified role
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public AuthRoleDeleteResponse RoleDelete(AuthRoleDeleteRequest request)
        {
            AuthRoleDeleteResponse response = new AuthRoleDeleteResponse();

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