Class JobClient
Implements
Inherited Members
Namespace: Noxum.Nova.Cms.Client
Assembly: Noxum.Nova.Cms.Client.dll
Syntax
public class JobClient : IJobClient
Constructors
JobClient(string, HttpClient)
Declaration
public JobClient(string baseUrl, HttpClient httpClient)
Parameters
| Type | Name | Description |
|---|---|---|
| string | baseUrl | |
| HttpClient | httpClient |
Properties
BaseUrl
Declaration
public string BaseUrl { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
JsonSerializerSettings
Declaration
protected JsonSerializerOptions JsonSerializerSettings { get; }
Property Value
| Type | Description |
|---|---|
| JsonSerializerOptions |
ReadResponseAsString
Declaration
public bool ReadResponseAsString { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
CreateJobAsync(CreateJobRequest, string, CancellationToken)
Create a job.
Declaration
public virtual Task<CmsJob> CreateJobAsync(CreateJobRequest model, string username = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CreateJobRequest | model | |
| string | username | The username this transaction is committed for. This must be set for internal access, otherwise, the transaction will be committed as the user who is currently logged in. |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task<CmsJob> |
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |
DeleteJobAsync(int, string, CancellationToken)
Deletes a job.
Declaration
public virtual Task DeleteJobAsync(int jobId, string username = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | jobId | The job id. |
| string | username | The username this transaction is committed for. This must be set for internal access, otherwise, the transaction will be committed as the user who is currently logged in. |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task |
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |
GetJobArtifactAsync(int, string, CancellationToken)
Get a single artifact file.
Declaration
public virtual Task<FileResponse> GetJobArtifactAsync(int jobId, string path, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | jobId | The job ID. |
| string | path | The relative path of the file. |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task<FileResponse> | OK |
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |
GetJobArtifactsAsync(int, CancellationToken)
Provides a listing of job artifacts.
Declaration
public virtual Task<JobArtifactList> GetJobArtifactsAsync(int jobId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | jobId | The job ID. |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task<JobArtifactList> | OK |
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |
GetJobArtifactsZipAsync(int, CancellationToken)
Get job artifacts by Job Id as a ZIP file
Declaration
public virtual Task<FileResponse> GetJobArtifactsZipAsync(int jobId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | jobId | The job ID. |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task<FileResponse> | OK |
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |
GetJobAsync(int, CancellationToken)
Get a single job by ID
Declaration
public virtual Task<CmsJob> GetJobAsync(int jobId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | jobId | The job ID. |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task<CmsJob> | OK |
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |
GetJobLogsAsync(int, CancellationToken)
Get job logs by Job Id
Declaration
public virtual Task<FileResponse> GetJobLogsAsync(int jobId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | jobId | The job ID. |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task<FileResponse> | OK |
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |
GetJobMetricsAsync(int, int?, CancellationToken)
Get job metrics by Job Id
Declaration
public virtual Task<IList<JobMetrics>> GetJobMetricsAsync(int jobId, int? maxItems = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | jobId | The job ID. |
| int? | maxItems | Optional parameter to limit the number of metric points returned. |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task<IList<JobMetrics>> | OK |
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |
GetJobObjectIdsAsync(int, CancellationToken)
Gets the ids of the job's context objects.
Declaration
public virtual Task<IList<int>> GetJobObjectIdsAsync(int jobId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | jobId | The job id. |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task<IList<int>> |
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |
GetJobProgressAsync(int, CancellationToken)
Get job progress information by Job Id
Declaration
public virtual Task<JobProgress> GetJobProgressAsync(int jobId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | jobId | The job ID. |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task<JobProgress> | OK |
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |
GetJobsAsync(int?, int?, JobStatus?, int?, string, bool?, string, int?, CancellationToken)
Get Jobs
Declaration
public virtual Task<CmsJobList> GetJobsAsync(int? branchId = null, int? definitionRef = null, JobStatus? state = null, int? triggerRef = null, string createdBy = null, bool? isDeleted = null, string @continue = null, int? take = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | branchId | The id of the branch. |
| int? | definitionRef | The id of the job definition. |
| JobStatus? | state | Job state. if null, all states will be included. (0=New, 1=Running, 2=Succeeded, 3=Error, 4=KillRequest, 5=RestartRequest) |
| int? | triggerRef | If not null, only jobs triggered by the specified Id will be included. |
| string | createdBy | Job Created by. If not null, only jobs created by the specified user will be included. |
| bool? | isDeleted | If true, include only deleted, if false include only not-deleted, if null include all jobs. |
| string | continue | An opaque token that encapsulates information how to continue the list request |
| int? | take | The number of jobs to take. |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task<CmsJobList> | OK |
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |
JobInputCancelAsync(string, CancellationToken)
Cancel uploading a file to be used as job input.
Declaration
public virtual Task JobInputCancelAsync(string token, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | token | The key of the temporary data |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task | Ok |
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |
JobInputContinueAsync(string, FileParameter, CancellationToken)
Continue uploading a file to be used as job input.
Declaration
public virtual Task<JobInputUploadResult> JobInputContinueAsync(string token, FileParameter file = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | token | The key of the temporary data |
| FileParameter | file | |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task<JobInputUploadResult> | Ok |
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |
JobInputUploadAsync(FileParameter, CancellationToken)
Start uploading a file to be used as job input.
Declaration
public virtual Task<JobInputUploadResult> JobInputUploadAsync(FileParameter file = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| FileParameter | file | |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task<JobInputUploadResult> | Ok |
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |
ReadObjectResponseAsync<T>(HttpResponseMessage, IReadOnlyDictionary<string, IEnumerable<string>>, CancellationToken)
Declaration
protected virtual Task<JobClient.ObjectResponseResult<T>> ReadObjectResponseAsync<T>(HttpResponseMessage response, IReadOnlyDictionary<string, IEnumerable<string>> headers, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| HttpResponseMessage | response | |
| IReadOnlyDictionary<string, IEnumerable<string>> | headers | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<JobClient.ObjectResponseResult<T>> |
Type Parameters
| Name | Description |
|---|---|
| T |
UpdateJobAsync(int, UpdateJobRequest, string, CancellationToken)
Updates a job.
Declaration
public virtual Task UpdateJobAsync(int jobId, UpdateJobRequest model, string username = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | jobId | The job id. |
| UpdateJobRequest | model | The update model |
| string | username | The username this transaction is committed for. This must be set for internal access, otherwise, the transaction will be committed as the user who is currently logged in. |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task |
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |