mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-13 04:40:05 +01:00
281 lines
10 KiB
TypeScript
281 lines
10 KiB
TypeScript
/* tslint:disable */
|
|
/* eslint-disable */
|
|
/**
|
|
* AutoGlue API
|
|
* API for managing K3s clusters across cloud providers
|
|
*
|
|
* The version of the OpenAPI document: 1.0
|
|
*
|
|
*
|
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
* https://openapi-generator.tech
|
|
* Do not edit the class manually.
|
|
*/
|
|
|
|
|
|
import * as runtime from "../runtime"
|
|
import type { DtoEnqueueRequest, DtoJob, DtoPageJob, DtoQueueInfo, } from "../models/index"
|
|
import { DtoEnqueueRequestToJSON, DtoJobFromJSON, DtoPageJobFromJSON, DtoQueueInfoFromJSON, } from "../models/index"
|
|
|
|
export interface AdminCancelArcherJobRequest {
|
|
id: string;
|
|
}
|
|
|
|
export interface AdminEnqueueArcherJobRequest {
|
|
body: DtoEnqueueRequest;
|
|
}
|
|
|
|
export interface AdminListArcherJobsRequest {
|
|
status?: AdminListArcherJobsStatusEnum;
|
|
queue?: string;
|
|
q?: string;
|
|
page?: number;
|
|
pageSize?: number;
|
|
}
|
|
|
|
export interface AdminRetryArcherJobRequest {
|
|
id: string;
|
|
}
|
|
|
|
/**
|
|
*
|
|
*/
|
|
export class ArcherAdminApi extends runtime.BaseAPI {
|
|
|
|
/**
|
|
* Set job status to canceled if cancellable. For running jobs, this only affects future picks; wire to Archer if you need active kill.
|
|
* Cancel an Archer job (admin)
|
|
*/
|
|
async adminCancelArcherJobRaw(requestParameters: AdminCancelArcherJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DtoJob>> {
|
|
if (requestParameters['id'] == null) {
|
|
throw new runtime.RequiredError(
|
|
'id',
|
|
'Required parameter "id" was null or undefined when calling adminCancelArcherJob().'
|
|
);
|
|
}
|
|
|
|
const queryParameters: any = {};
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
if (this.configuration && this.configuration.apiKey) {
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // BearerAuth authentication
|
|
}
|
|
|
|
|
|
let urlPath = `/admin/archer/jobs/{id}/cancel`;
|
|
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
|
|
|
|
const response = await this.request({
|
|
path: urlPath,
|
|
method: 'POST',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
}, initOverrides);
|
|
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => DtoJobFromJSON(jsonValue));
|
|
}
|
|
|
|
/**
|
|
* Set job status to canceled if cancellable. For running jobs, this only affects future picks; wire to Archer if you need active kill.
|
|
* Cancel an Archer job (admin)
|
|
*/
|
|
async adminCancelArcherJob(requestParameters: AdminCancelArcherJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DtoJob> {
|
|
const response = await this.adminCancelArcherJobRaw(requestParameters, initOverrides);
|
|
return await response.value();
|
|
}
|
|
|
|
/**
|
|
* Create a job immediately or schedule it for the future via `run_at`.
|
|
* Enqueue a new Archer job (admin)
|
|
*/
|
|
async adminEnqueueArcherJobRaw(requestParameters: AdminEnqueueArcherJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DtoJob>> {
|
|
if (requestParameters['body'] == null) {
|
|
throw new runtime.RequiredError(
|
|
'body',
|
|
'Required parameter "body" was null or undefined when calling adminEnqueueArcherJob().'
|
|
);
|
|
}
|
|
|
|
const queryParameters: any = {};
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
headerParameters['Content-Type'] = 'application/json';
|
|
|
|
if (this.configuration && this.configuration.apiKey) {
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // BearerAuth authentication
|
|
}
|
|
|
|
|
|
let urlPath = `/admin/archer/jobs`;
|
|
|
|
const response = await this.request({
|
|
path: urlPath,
|
|
method: 'POST',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
body: DtoEnqueueRequestToJSON(requestParameters['body']),
|
|
}, initOverrides);
|
|
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => DtoJobFromJSON(jsonValue));
|
|
}
|
|
|
|
/**
|
|
* Create a job immediately or schedule it for the future via `run_at`.
|
|
* Enqueue a new Archer job (admin)
|
|
*/
|
|
async adminEnqueueArcherJob(requestParameters: AdminEnqueueArcherJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DtoJob> {
|
|
const response = await this.adminEnqueueArcherJobRaw(requestParameters, initOverrides);
|
|
return await response.value();
|
|
}
|
|
|
|
/**
|
|
* Paginated background jobs with optional filters. Search `q` may match id, type, error, payload (implementation-dependent).
|
|
* List Archer jobs (admin)
|
|
*/
|
|
async adminListArcherJobsRaw(requestParameters: AdminListArcherJobsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DtoPageJob>> {
|
|
const queryParameters: any = {};
|
|
|
|
if (requestParameters['status'] != null) {
|
|
queryParameters['status'] = requestParameters['status'];
|
|
}
|
|
|
|
if (requestParameters['queue'] != null) {
|
|
queryParameters['queue'] = requestParameters['queue'];
|
|
}
|
|
|
|
if (requestParameters['q'] != null) {
|
|
queryParameters['q'] = requestParameters['q'];
|
|
}
|
|
|
|
if (requestParameters['page'] != null) {
|
|
queryParameters['page'] = requestParameters['page'];
|
|
}
|
|
|
|
if (requestParameters['pageSize'] != null) {
|
|
queryParameters['page_size'] = requestParameters['pageSize'];
|
|
}
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
if (this.configuration && this.configuration.apiKey) {
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // BearerAuth authentication
|
|
}
|
|
|
|
|
|
let urlPath = `/admin/archer/jobs`;
|
|
|
|
const response = await this.request({
|
|
path: urlPath,
|
|
method: 'GET',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
}, initOverrides);
|
|
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => DtoPageJobFromJSON(jsonValue));
|
|
}
|
|
|
|
/**
|
|
* Paginated background jobs with optional filters. Search `q` may match id, type, error, payload (implementation-dependent).
|
|
* List Archer jobs (admin)
|
|
*/
|
|
async adminListArcherJobs(requestParameters: AdminListArcherJobsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DtoPageJob> {
|
|
const response = await this.adminListArcherJobsRaw(requestParameters, initOverrides);
|
|
return await response.value();
|
|
}
|
|
|
|
/**
|
|
* Summary metrics per queue (pending, running, failed, scheduled).
|
|
* List Archer queues (admin)
|
|
*/
|
|
async adminListArcherQueuesRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<DtoQueueInfo>>> {
|
|
const queryParameters: any = {};
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
if (this.configuration && this.configuration.apiKey) {
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // BearerAuth authentication
|
|
}
|
|
|
|
|
|
let urlPath = `/admin/archer/queues`;
|
|
|
|
const response = await this.request({
|
|
path: urlPath,
|
|
method: 'GET',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
}, initOverrides);
|
|
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(DtoQueueInfoFromJSON));
|
|
}
|
|
|
|
/**
|
|
* Summary metrics per queue (pending, running, failed, scheduled).
|
|
* List Archer queues (admin)
|
|
*/
|
|
async adminListArcherQueues(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<DtoQueueInfo>> {
|
|
const response = await this.adminListArcherQueuesRaw(initOverrides);
|
|
return await response.value();
|
|
}
|
|
|
|
/**
|
|
* Marks the job retriable (DB flip). Swap this for an Archer admin call if you expose one.
|
|
* Retry a failed/canceled Archer job (admin)
|
|
*/
|
|
async adminRetryArcherJobRaw(requestParameters: AdminRetryArcherJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DtoJob>> {
|
|
if (requestParameters['id'] == null) {
|
|
throw new runtime.RequiredError(
|
|
'id',
|
|
'Required parameter "id" was null or undefined when calling adminRetryArcherJob().'
|
|
);
|
|
}
|
|
|
|
const queryParameters: any = {};
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
if (this.configuration && this.configuration.apiKey) {
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // BearerAuth authentication
|
|
}
|
|
|
|
|
|
let urlPath = `/admin/archer/jobs/{id}/retry`;
|
|
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
|
|
|
|
const response = await this.request({
|
|
path: urlPath,
|
|
method: 'POST',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
}, initOverrides);
|
|
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => DtoJobFromJSON(jsonValue));
|
|
}
|
|
|
|
/**
|
|
* Marks the job retriable (DB flip). Swap this for an Archer admin call if you expose one.
|
|
* Retry a failed/canceled Archer job (admin)
|
|
*/
|
|
async adminRetryArcherJob(requestParameters: AdminRetryArcherJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DtoJob> {
|
|
const response = await this.adminRetryArcherJobRaw(requestParameters, initOverrides);
|
|
return await response.value();
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
* @export
|
|
*/
|
|
export const AdminListArcherJobsStatusEnum = {
|
|
queued: 'queued',
|
|
running: 'running',
|
|
succeeded: 'succeeded',
|
|
failed: 'failed',
|
|
canceled: 'canceled',
|
|
retrying: 'retrying',
|
|
scheduled: 'scheduled'
|
|
} as const;
|
|
export type AdminListArcherJobsStatusEnum = typeof AdminListArcherJobsStatusEnum[keyof typeof AdminListArcherJobsStatusEnum];
|