/// <summary> /// RoleGrantPermissionAsync grants a permission of a specified key or range to 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 <AuthRoleGrantPermissionResponse> RoleGrantPermissionAsync( AuthRoleGrantPermissionRequest request, Grpc.Core.Metadata headers = null, DateTime?deadline = null, CancellationToken cancellationToken = default) { return(await CallEtcdAsync(async (connection) => await connection._authClient .RoleGrantPermissionAsync(request, headers, deadline, cancellationToken)).ConfigureAwait(false)); }
/// <summary> /// RoleGrantPermission grants a permission of a specified key or range to 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 AuthRoleGrantPermissionResponse RoleGrantPermission(AuthRoleGrantPermissionRequest request, Grpc.Core.Metadata headers = null, DateTime?deadline = null, CancellationToken cancellationToken = default) { return(CallEtcd((connection) => connection._authClient .RoleGrantPermission(request, headers, deadline, cancellationToken))); }
/// <summary> /// RoleGrantPermissionAsync grants a permission of a specified key or range to a specified role in async /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <AuthRoleGrantPermissionResponse> RoleGrantPermissionAsync(AuthRoleGrantPermissionRequest request, Metadata headers = null) { AuthRoleGrantPermissionResponse response = new AuthRoleGrantPermissionResponse(); bool success = false; int retryCount = 0; while (!success) { try { response = await _balancer.GetConnection().authClient.RoleGrantPermissionAsync(request, headers); success = true; } catch (RpcException ex) when(ex.StatusCode == StatusCode.Unavailable) { retryCount++; if (retryCount >= _balancer._numNodes) { throw ex; } } } return(response); }
/// <summary> /// RoleGrantPermissionAsync grants a permission of a specified key or range to a specified role in async /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <AuthRoleGrantPermissionResponse> RoleGrantPermissionAsync(AuthRoleGrantPermissionRequest request, Metadata headers = null) { AuthRoleGrantPermissionResponse response = new AuthRoleGrantPermissionResponse(); response = await _balancer.GetConnection().authClient.RoleGrantPermissionAsync(request, headers); return(response); }
/// <summary> /// RoleGrantPermission grants a permission of a specified key or range to a specified role /// </summary> /// <param name="request"></param> /// <returns></returns> public AuthRoleGrantPermissionResponse RoleGrantPermission(AuthRoleGrantPermissionRequest request, Metadata headers = null) { AuthRoleGrantPermissionResponse response = new AuthRoleGrantPermissionResponse(); response = _balancer.GetConnection().authClient.RoleGrantPermission(request, headers); return(response); }
/// <summary> /// RoleGrantPermissionAsync grants a permission of a specified key or range to a specified role in async /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <AuthRoleGrantPermissionResponse> RoleGrantPermissionAsync(AuthRoleGrantPermissionRequest request) { AuthRoleGrantPermissionResponse response = new AuthRoleGrantPermissionResponse(); try { response = await _authClient.RoleGrantPermissionAsync(request, _headers); } catch (RpcException ex) { ResetConnection(ex); throw; } catch { throw; } return(response); }