4using System.Threading.Tasks;
6using Microsoft.AspNetCore.Mvc;
7using Microsoft.EntityFrameworkCore;
8using Microsoft.Extensions.Logging;
53 authenticationContext,
79 .Include(
x =>
x.StartedBy)
80 .Include(
x =>
x.CancelledBy)
81 .Include(
x =>
x.Instance)
82 .Where(
x =>
x.Instance!.Id ==
Instance.
Id && !
x.StoppedAt.HasValue)
83 .OrderByDescending(
x =>
x.StartedAt))),
107 .Include(
x =>
x.StartedBy)
108 .Include(
x =>
x.CancelledBy)
109 .Include(
x =>
x.Instance)
111 .OrderByDescending(
x =>
x.StartedAt))),
136 .Include(
x =>
x.StartedBy)
137 .Include(
x =>
x.Instance)
143 if (
job.StoppedAt !=
null)
171 .Include(
x =>
x.StartedBy)
172 .Include(
x =>
x.CancelledBy)
173 .Include(
x =>
x.Instance)
virtual ? long Id
The ID of the entity.
Metadata about a server instance.
Represents an error message returned by the server.
Represents a long running job on the server. Model is read-only, updates attempt to cancel the job.
Represents a paginated set of models.
Routes to a server actions.
const string List
The postfix for list operations.
const string Jobs
The jobs controller.
new NotFoundObjectResult NotFound()
Generic 404 response.
readonly IInstanceManager instanceManager
The IInstanceManager for the ComponentInterfacingController.
ComponentInterfacingController for operations that require an instance.
JobController(IDatabaseContext databaseContext, IAuthenticationContext authenticationContext, ILogger< JobController > logger, IInstanceManager instanceManager, IJobManager jobManager, IApiHeadersProvider apiHeaders)
Initializes a new instance of the JobController class.
ValueTask< IActionResult > List([FromQuery] int? page, [FromQuery] int? pageSize, CancellationToken cancellationToken)
List all JobResponse for the instance in reverse creation order.
ValueTask AddJobProgressResponseTransformer(JobResponse jobResponse)
Supplements JobResponse PaginatedResponse<TModel>s with their JobResponse.Progress.
async ValueTask< IActionResult > Delete(long id, CancellationToken cancellationToken)
Cancel a running JobResponse.
readonly IJobManager jobManager
The IJobManager for the JobController.
async ValueTask< IActionResult > GetId(long id, CancellationToken cancellationToken)
Get a specific JobResponse.
ValueTask< IActionResult > Read([FromQuery] int? page, [FromQuery] int? pageSize, CancellationToken cancellationToken)
Get active JobResponses for the instance.
Helper for returning paginated models.
Backend abstract implementation of IDatabaseContext.
DbSet< Job > Jobs
The Jobs in the DatabaseContext.
User User
The authenticated user.
ulong GetRight(RightsType rightsType)
Get the value of a given rightsType .The value of rightsType . Note that if InstancePermissionSet is ...
Manages the runtime of Jobs.
void SetJobProgress(JobResponse apiResponse)
Set the JobResponse.Progress and JobResponse.Stage for a given apiResponse .
ValueTask< Job?> CancelJob(Job job, User? user, bool blocking, CancellationToken cancellationToken)
Cancels a give job .
For creating and accessing authentication contexts.
ErrorCode
Types of Response.ErrorMessageResponses that the API may return.