Ejemplo n.º 1
0
 /// <summary>
 /// RoleRevokePermissionAsync revokes a key or range permission of 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 <AuthRoleRevokePermissionResponse> RoleRevokePermissionAsync(
     AuthRoleRevokePermissionRequest request, Grpc.Core.Metadata headers = null, DateTime?deadline = null,
     CancellationToken cancellationToken = default)
 {
     return(await CallEtcdAsync(async (connection) => await connection._authClient
                                .RoleRevokePermissionAsync(request, headers, deadline, cancellationToken)).ConfigureAwait(false));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// RoleRevokePermission revokes a key or range permission of 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 AuthRoleRevokePermissionResponse RoleRevokePermission(AuthRoleRevokePermissionRequest request,
                                                              Grpc.Core.Metadata headers          = null, DateTime?deadline = null,
                                                              CancellationToken cancellationToken = default)
 {
     return(CallEtcd((connection) => connection._authClient
                     .RoleRevokePermission(request, headers, deadline, cancellationToken)));
 }
Ejemplo n.º 3
0
        /// <summary>
        /// RoleRevokePermission revokes a key or range permission of a specified role
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public AuthRoleRevokePermissionResponse RoleRevokePermission(AuthRoleRevokePermissionRequest request, Metadata headers = null)
        {
            AuthRoleRevokePermissionResponse response = new AuthRoleRevokePermissionResponse();

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

            return(response);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// RoleRevokePermission revokes a key or range permission of a specified role
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public AuthRoleRevokePermissionResponse RoleRevokePermission(AuthRoleRevokePermissionRequest request)
        {
            AuthRoleRevokePermissionResponse response = new AuthRoleRevokePermissionResponse();

            try
            {
                response = _authClient.RoleRevokePermission(request, _headers);
            }
            catch (RpcException ex)
            {
                ResetConnection(ex);
                throw;
            }
            catch
            {
                throw;
            }
            return(response);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// RoleRevokePermission revokes a key or range permission of a specified role
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public AuthRoleRevokePermissionResponse RoleRevokePermission(AuthRoleRevokePermissionRequest request, Metadata headers = null)
        {
            AuthRoleRevokePermissionResponse response = new AuthRoleRevokePermissionResponse();
            bool success    = false;
            int  retryCount = 0;

            while (!success)
            {
                try
                {
                    response = _balancer.GetConnection().authClient.RoleRevokePermission(request, headers);
                    success  = true;
                }
                catch (RpcException ex) when(ex.StatusCode == StatusCode.Unavailable)
                {
                    retryCount++;
                    if (retryCount >= _balancer._numNodes)
                    {
                        throw ex;
                    }
                }
            }
            return(response);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// RoleRevokePermissionAsync revokes a key or range permission of a specified role in async
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <AuthRoleRevokePermissionResponse> RoleRevokePermissionAsync(AuthRoleRevokePermissionRequest request, Metadata headers = null)
        {
            AuthRoleRevokePermissionResponse response = new AuthRoleRevokePermissionResponse();

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

            return(response);
        }