mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-09 03:20:56 +00:00
feat(server): add archive/unarchive endpoints and include_archived listing
Extends the OpenAPI spec with POST /api/v1/runs/{id}/archive and /unarchive
operations, adds `archived` to the RunStatus enum, and adds an
`include_archived` query param to listRuns. Regenerates the progenitor-built
Rust types and the typescript-axios client. Implements `archive_run` and
`unarchive_run` handlers via `operations::archive/unarchive`, and extends
`list_runs` to filter archived runs unless opted in. Archived runs continue
to map through `api_status_from_workflow` and bypass the board column.
This commit is contained in:
parent
ce85151b37
commit
03fc375cdd
4 changed files with 360 additions and 23 deletions
|
|
@ -401,10 +401,11 @@ paths:
|
|||
operationId: listRuns
|
||||
tags: [Runs]
|
||||
summary: List Runs
|
||||
description: Returns durable run summaries from the backing store, including runs persisted before the current server boot.
|
||||
description: Returns durable run summaries from the backing store, including runs persisted before the current server boot. Archived runs are hidden by default; pass `include_archived=true` to include them in the response.
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/PageLimit"
|
||||
- $ref: "#/components/parameters/PageOffset"
|
||||
- $ref: "#/components/parameters/IncludeArchived"
|
||||
responses:
|
||||
"200":
|
||||
description: Paginated durable run summaries
|
||||
|
|
@ -646,6 +647,69 @@ paths:
|
|||
schema:
|
||||
$ref: "#/components/schemas/ErrorResponse"
|
||||
|
||||
/api/v1/runs/{id}/archive:
|
||||
post:
|
||||
operationId: archiveRun
|
||||
tags: [Runs]
|
||||
summary: Archive Run
|
||||
description: >
|
||||
Marks a terminal run (`succeeded`, `failed`, or `dead`) as `archived`.
|
||||
Archived runs are hidden from default listings and are read-only until
|
||||
unarchived. Idempotent on already-archived runs. Returns 409 if the run
|
||||
is not terminal.
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/RunId"
|
||||
responses:
|
||||
"200":
|
||||
description: Run archived (or already archived)
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/RunStatusResponse"
|
||||
"404":
|
||||
description: Run not found
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ErrorResponse"
|
||||
"409":
|
||||
description: Run is not terminal and cannot be archived
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ErrorResponse"
|
||||
|
||||
/api/v1/runs/{id}/unarchive:
|
||||
post:
|
||||
operationId: unarchiveRun
|
||||
tags: [Runs]
|
||||
summary: Unarchive Run
|
||||
description: >
|
||||
Restores an archived run to its prior terminal status. Idempotent on
|
||||
runs that are terminal but not archived (returns the current status
|
||||
without emitting an event). Returns 409 if the run is active.
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/RunId"
|
||||
responses:
|
||||
"200":
|
||||
description: Run unarchived (or already not archived)
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/RunStatusResponse"
|
||||
"404":
|
||||
description: Run not found
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ErrorResponse"
|
||||
"409":
|
||||
description: Run is active and cannot be unarchived
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ErrorResponse"
|
||||
|
||||
/api/v1/runs/{id}/graph:
|
||||
get:
|
||||
operationId: retrieveRunGraph
|
||||
|
|
@ -1933,6 +1997,16 @@ components:
|
|||
default: 0
|
||||
example: 0
|
||||
|
||||
IncludeArchived:
|
||||
name: include_archived
|
||||
in: query
|
||||
required: false
|
||||
description: Whether to include archived runs in the response. Defaults to `false`.
|
||||
schema:
|
||||
type: boolean
|
||||
default: false
|
||||
example: false
|
||||
|
||||
ModelProviderFilter:
|
||||
name: provider
|
||||
in: query
|
||||
|
|
@ -2593,7 +2667,11 @@ components:
|
|||
# ── Run Schemas ──────────────────────────────────────────────────────
|
||||
|
||||
RunStatus:
|
||||
description: Lifecycle status of a run.
|
||||
description: >
|
||||
Lifecycle status of a run. `archived` is a terminal status reached by
|
||||
an explicit user action on a previously terminal (`succeeded`, `failed`,
|
||||
or `dead`) run; archived runs are hidden from default listings and are
|
||||
read-only until unarchived.
|
||||
type: string
|
||||
enum:
|
||||
- submitted
|
||||
|
|
@ -2606,6 +2684,7 @@ components:
|
|||
- succeeded
|
||||
- failed
|
||||
- dead
|
||||
- archived
|
||||
|
||||
RunManifest:
|
||||
description: Self-contained workflow run manifest.
|
||||
|
|
|
|||
|
|
@ -136,6 +136,25 @@ pub struct PaginationParams {
|
|||
pub offset: u32,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
struct ListRunsParams {
|
||||
#[serde(rename = "page[limit]", default = "default_page_limit")]
|
||||
limit: u32,
|
||||
#[serde(rename = "page[offset]", default)]
|
||||
offset: u32,
|
||||
#[serde(default)]
|
||||
include_archived: bool,
|
||||
}
|
||||
|
||||
impl ListRunsParams {
|
||||
fn pagination(&self) -> PaginationParams {
|
||||
PaginationParams {
|
||||
limit: self.limit,
|
||||
offset: self.offset,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
struct ModelListParams {
|
||||
#[serde(rename = "page[limit]", default = "default_page_limit")]
|
||||
|
|
@ -1107,6 +1126,8 @@ fn real_routes() -> Router<Arc<AppState>> {
|
|||
.route("/runs/{id}/start", post(start_run))
|
||||
.route("/runs/{id}/pause", post(pause_run))
|
||||
.route("/runs/{id}/unpause", post(unpause_run))
|
||||
.route("/runs/{id}/archive", post(archive_run))
|
||||
.route("/runs/{id}/unarchive", post(unarchive_run))
|
||||
.route("/runs/{id}/graph", get(get_graph))
|
||||
.route("/runs/{id}/stages", get(list_run_stages))
|
||||
.route("/runs/{id}/artifacts", get(list_run_artifacts))
|
||||
|
|
@ -2593,8 +2614,6 @@ fn board_column(status: WorkflowRunStatus) -> Option<&'static str> {
|
|||
WorkflowRunStatus::Blocked => Some("blocked"),
|
||||
WorkflowRunStatus::Succeeded => Some("succeeded"),
|
||||
WorkflowRunStatus::Failed | WorkflowRunStatus::Dead => Some("failed"),
|
||||
// TODO(unit-5): revisit once `archived` is a board-column first-class
|
||||
// citizen; for now archived runs have no column.
|
||||
WorkflowRunStatus::Removing | WorkflowRunStatus::Archived => None,
|
||||
}
|
||||
}
|
||||
|
|
@ -2773,7 +2792,7 @@ async fn list_board_runs(
|
|||
async fn list_runs(
|
||||
_auth: AuthenticatedService,
|
||||
State(state): State<Arc<AppState>>,
|
||||
Query(pagination): Query<PaginationParams>,
|
||||
Query(params): Query<ListRunsParams>,
|
||||
) -> Response {
|
||||
match state
|
||||
.store
|
||||
|
|
@ -2781,11 +2800,13 @@ async fn list_runs(
|
|||
.await
|
||||
{
|
||||
Ok(runs) => {
|
||||
let include_archived = params.include_archived;
|
||||
let items = runs
|
||||
.into_iter()
|
||||
.filter(|summary| include_archived || summary.status != WorkflowRunStatus::Archived)
|
||||
.map(summary_to_api_run_summary)
|
||||
.collect::<Vec<_>>();
|
||||
let (data, has_more) = paginate_items(items, &pagination);
|
||||
let (data, has_more) = paginate_items(items, ¶ms.pagination());
|
||||
(
|
||||
StatusCode::OK,
|
||||
Json(serde_json::json!({
|
||||
|
|
@ -3348,12 +3369,10 @@ fn api_status_from_workflow(status: WorkflowRunStatus) -> RunStatus {
|
|||
WorkflowRunStatus::Blocked => RunStatus::Blocked,
|
||||
WorkflowRunStatus::Paused => RunStatus::Paused,
|
||||
WorkflowRunStatus::Removing => RunStatus::Removing,
|
||||
// TODO(unit-5): add `Archived` variant to the public `InternalRunStatus`
|
||||
// enum in the OpenAPI spec and map to it here. Temporary: mirror
|
||||
// `Succeeded` so the wire shape stays valid.
|
||||
WorkflowRunStatus::Succeeded | WorkflowRunStatus::Archived => RunStatus::Succeeded,
|
||||
WorkflowRunStatus::Succeeded => RunStatus::Succeeded,
|
||||
WorkflowRunStatus::Failed => RunStatus::Failed,
|
||||
WorkflowRunStatus::Dead => RunStatus::Dead,
|
||||
WorkflowRunStatus::Archived => RunStatus::Archived,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -6344,6 +6363,88 @@ async fn unpause_run(
|
|||
.into_response()
|
||||
}
|
||||
|
||||
async fn archive_run(
|
||||
subject: AuthenticatedSubject,
|
||||
State(state): State<Arc<AppState>>,
|
||||
Path(id): Path<String>,
|
||||
) -> Response {
|
||||
let id = match parse_run_id_path(&id) {
|
||||
Ok(id) => id,
|
||||
Err(response) => return response,
|
||||
};
|
||||
let actor = actor_from_subject(&subject);
|
||||
match operations::archive(&state.store, &id, actor).await {
|
||||
Ok(_) => archive_status_response(state.as_ref(), id).await,
|
||||
Err(WorkflowError::Precondition(message)) => {
|
||||
ApiError::new(StatusCode::CONFLICT, message).into_response()
|
||||
}
|
||||
Err(err) => {
|
||||
ApiError::new(StatusCode::INTERNAL_SERVER_ERROR, err.to_string()).into_response()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn unarchive_run(
|
||||
subject: AuthenticatedSubject,
|
||||
State(state): State<Arc<AppState>>,
|
||||
Path(id): Path<String>,
|
||||
) -> Response {
|
||||
let id = match parse_run_id_path(&id) {
|
||||
Ok(id) => id,
|
||||
Err(response) => return response,
|
||||
};
|
||||
let actor = actor_from_subject(&subject);
|
||||
match operations::unarchive(&state.store, &id, actor).await {
|
||||
Ok(_) => archive_status_response(state.as_ref(), id).await,
|
||||
Err(WorkflowError::Precondition(message)) => {
|
||||
ApiError::new(StatusCode::CONFLICT, message).into_response()
|
||||
}
|
||||
Err(err) => {
|
||||
ApiError::new(StatusCode::INTERNAL_SERVER_ERROR, err.to_string()).into_response()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Build a `RunStatusResponse` reflecting the durable projection after an
|
||||
/// archive/unarchive transition. The run is terminal in both directions, so no
|
||||
/// live queue position or worker-only fields apply.
|
||||
async fn archive_status_response(state: &AppState, id: RunId) -> Response {
|
||||
let Ok(run_store) = state.store.open_run_reader(&id).await else {
|
||||
return ApiError::not_found("Run not found.").into_response();
|
||||
};
|
||||
let projection = match run_store.state().await {
|
||||
Ok(projection) => projection,
|
||||
Err(err) => {
|
||||
return ApiError::new(StatusCode::INTERNAL_SERVER_ERROR, err.to_string())
|
||||
.into_response();
|
||||
}
|
||||
};
|
||||
let Some(record) = projection.status.as_ref() else {
|
||||
return ApiError::new(
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
"run has no status record after archive/unarchive",
|
||||
)
|
||||
.into_response();
|
||||
};
|
||||
let status = api_status_from_workflow(record.status);
|
||||
let status_reason = record.status_reason.map(api_status_reason);
|
||||
let blocked_reason = record.blocked_reason.map(api_blocked_reason);
|
||||
(
|
||||
StatusCode::OK,
|
||||
Json(RunStatusResponse {
|
||||
id: id.to_string(),
|
||||
blocked_reason,
|
||||
status,
|
||||
error: None,
|
||||
queue_position: None,
|
||||
status_reason,
|
||||
pending_control: None,
|
||||
created_at: id.created_at(),
|
||||
}),
|
||||
)
|
||||
.into_response()
|
||||
}
|
||||
|
||||
/// Persist a synchronous pause/unpause transition: append the caller-supplied
|
||||
/// events to the run store and mirror the new status in the in-memory run map.
|
||||
/// Returns `Some(Response)` on error, `None` on success.
|
||||
|
|
|
|||
|
|
@ -44,6 +44,46 @@ import type { StoreRunSummary } from '../models';
|
|||
*/
|
||||
export const RunsApiAxiosParamCreator = function (configuration?: Configuration) {
|
||||
return {
|
||||
/**
|
||||
* Marks a terminal run (`succeeded`, `failed`, or `dead`) as `archived`. Archived runs are hidden from default listings and are read-only until unarchived. Idempotent on already-archived runs. Returns 409 if the run is not terminal.
|
||||
* @summary Archive Run
|
||||
* @param {string} id Unique run identifier (ULID).
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
archiveRun: async (id: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'id' is not null or undefined
|
||||
assertParamExists('archiveRun', 'id', id)
|
||||
const localVarPath = `/api/v1/runs/{id}/archive`
|
||||
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||
let baseOptions;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
}
|
||||
|
||||
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
|
||||
const localVarHeaderParameter = {} as any;
|
||||
const localVarQueryParameter = {} as any;
|
||||
|
||||
// authentication SessionCookie required
|
||||
|
||||
// authentication BearerAuth required
|
||||
// http bearer authentication required
|
||||
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
||||
|
||||
localVarHeaderParameter['Accept'] = 'application/json';
|
||||
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
/**
|
||||
* Cancels a running or queued run. Returns 409 if the run has already completed or been cancelled.
|
||||
* @summary Cancel Run
|
||||
|
|
@ -212,14 +252,15 @@ export const RunsApiAxiosParamCreator = function (configuration?: Configuration)
|
|||
};
|
||||
},
|
||||
/**
|
||||
* Returns durable run summaries from the backing store, including runs persisted before the current server boot.
|
||||
* Returns durable run summaries from the backing store, including runs persisted before the current server boot. Archived runs are hidden by default; pass `include_archived=true` to include them in the response.
|
||||
* @summary List Runs
|
||||
* @param {number} [pageLimit] Maximum number of items to return per page.
|
||||
* @param {number} [pageOffset] Number of items to skip before returning results.
|
||||
* @param {boolean} [includeArchived] Whether to include archived runs in the response. Defaults to `false`.
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
listRuns: async (pageLimit?: number, pageOffset?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
listRuns: async (pageLimit?: number, pageOffset?: number, includeArchived?: boolean, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
const localVarPath = `/api/v1/runs`;
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||
|
|
@ -246,6 +287,10 @@ export const RunsApiAxiosParamCreator = function (configuration?: Configuration)
|
|||
localVarQueryParameter['page[offset]'] = pageOffset;
|
||||
}
|
||||
|
||||
if (includeArchived !== undefined) {
|
||||
localVarQueryParameter['include_archived'] = includeArchived;
|
||||
}
|
||||
|
||||
localVarHeaderParameter['Accept'] = 'application/json';
|
||||
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
||||
|
|
@ -502,6 +547,46 @@ export const RunsApiAxiosParamCreator = function (configuration?: Configuration)
|
|||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
/**
|
||||
* Restores an archived run to its prior terminal status. Idempotent on runs that are terminal but not archived (returns the current status without emitting an event). Returns 409 if the run is active.
|
||||
* @summary Unarchive Run
|
||||
* @param {string} id Unique run identifier (ULID).
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
unarchiveRun: async (id: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'id' is not null or undefined
|
||||
assertParamExists('unarchiveRun', 'id', id)
|
||||
const localVarPath = `/api/v1/runs/{id}/unarchive`
|
||||
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||
let baseOptions;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
}
|
||||
|
||||
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
|
||||
const localVarHeaderParameter = {} as any;
|
||||
const localVarQueryParameter = {} as any;
|
||||
|
||||
// authentication SessionCookie required
|
||||
|
||||
// authentication BearerAuth required
|
||||
// http bearer authentication required
|
||||
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
||||
|
||||
localVarHeaderParameter['Accept'] = 'application/json';
|
||||
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
/**
|
||||
* Resumes a paused run. Returns 409 if the run is not paused.
|
||||
* @summary Unpause Run
|
||||
|
|
@ -551,6 +636,19 @@ export const RunsApiAxiosParamCreator = function (configuration?: Configuration)
|
|||
export const RunsApiFp = function(configuration?: Configuration) {
|
||||
const localVarAxiosParamCreator = RunsApiAxiosParamCreator(configuration)
|
||||
return {
|
||||
/**
|
||||
* Marks a terminal run (`succeeded`, `failed`, or `dead`) as `archived`. Archived runs are hidden from default listings and are read-only until unarchived. Idempotent on already-archived runs. Returns 409 if the run is not terminal.
|
||||
* @summary Archive Run
|
||||
* @param {string} id Unique run identifier (ULID).
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async archiveRun(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<RunStatusResponse>> {
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.archiveRun(id, options);
|
||||
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
||||
const localVarOperationServerBasePath = operationServerMap['RunsApi.archiveRun']?.[localVarOperationServerIndex]?.url;
|
||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||
},
|
||||
/**
|
||||
* Cancels a running or queued run. Returns 409 if the run has already completed or been cancelled.
|
||||
* @summary Cancel Run
|
||||
|
|
@ -605,15 +703,16 @@ export const RunsApiFp = function(configuration?: Configuration) {
|
|||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||
},
|
||||
/**
|
||||
* Returns durable run summaries from the backing store, including runs persisted before the current server boot.
|
||||
* Returns durable run summaries from the backing store, including runs persisted before the current server boot. Archived runs are hidden by default; pass `include_archived=true` to include them in the response.
|
||||
* @summary List Runs
|
||||
* @param {number} [pageLimit] Maximum number of items to return per page.
|
||||
* @param {number} [pageOffset] Number of items to skip before returning results.
|
||||
* @param {boolean} [includeArchived] Whether to include archived runs in the response. Defaults to `false`.
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async listRuns(pageLimit?: number, pageOffset?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PaginatedRunList>> {
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.listRuns(pageLimit, pageOffset, options);
|
||||
async listRuns(pageLimit?: number, pageOffset?: number, includeArchived?: boolean, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PaginatedRunList>> {
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.listRuns(pageLimit, pageOffset, includeArchived, options);
|
||||
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
||||
const localVarOperationServerBasePath = operationServerMap['RunsApi.listRuns']?.[localVarOperationServerIndex]?.url;
|
||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||
|
|
@ -697,6 +796,19 @@ export const RunsApiFp = function(configuration?: Configuration) {
|
|||
const localVarOperationServerBasePath = operationServerMap['RunsApi.startRun']?.[localVarOperationServerIndex]?.url;
|
||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||
},
|
||||
/**
|
||||
* Restores an archived run to its prior terminal status. Idempotent on runs that are terminal but not archived (returns the current status without emitting an event). Returns 409 if the run is active.
|
||||
* @summary Unarchive Run
|
||||
* @param {string} id Unique run identifier (ULID).
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async unarchiveRun(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<RunStatusResponse>> {
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.unarchiveRun(id, options);
|
||||
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
||||
const localVarOperationServerBasePath = operationServerMap['RunsApi.unarchiveRun']?.[localVarOperationServerIndex]?.url;
|
||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||
},
|
||||
/**
|
||||
* Resumes a paused run. Returns 409 if the run is not paused.
|
||||
* @summary Unpause Run
|
||||
|
|
@ -719,6 +831,16 @@ export const RunsApiFp = function(configuration?: Configuration) {
|
|||
export const RunsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
||||
const localVarFp = RunsApiFp(configuration)
|
||||
return {
|
||||
/**
|
||||
* Marks a terminal run (`succeeded`, `failed`, or `dead`) as `archived`. Archived runs are hidden from default listings and are read-only until unarchived. Idempotent on already-archived runs. Returns 409 if the run is not terminal.
|
||||
* @summary Archive Run
|
||||
* @param {string} id Unique run identifier (ULID).
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
archiveRun(id: string, options?: RawAxiosRequestConfig): AxiosPromise<RunStatusResponse> {
|
||||
return localVarFp.archiveRun(id, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
* Cancels a running or queued run. Returns 409 if the run has already completed or been cancelled.
|
||||
* @summary Cancel Run
|
||||
|
|
@ -761,15 +883,16 @@ export const RunsApiFactory = function (configuration?: Configuration, basePath?
|
|||
return localVarFp.listBoardRuns(pageLimit, pageOffset, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
* Returns durable run summaries from the backing store, including runs persisted before the current server boot.
|
||||
* Returns durable run summaries from the backing store, including runs persisted before the current server boot. Archived runs are hidden by default; pass `include_archived=true` to include them in the response.
|
||||
* @summary List Runs
|
||||
* @param {number} [pageLimit] Maximum number of items to return per page.
|
||||
* @param {number} [pageOffset] Number of items to skip before returning results.
|
||||
* @param {boolean} [includeArchived] Whether to include archived runs in the response. Defaults to `false`.
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
listRuns(pageLimit?: number, pageOffset?: number, options?: RawAxiosRequestConfig): AxiosPromise<PaginatedRunList> {
|
||||
return localVarFp.listRuns(pageLimit, pageOffset, options).then((request) => request(axios, basePath));
|
||||
listRuns(pageLimit?: number, pageOffset?: number, includeArchived?: boolean, options?: RawAxiosRequestConfig): AxiosPromise<PaginatedRunList> {
|
||||
return localVarFp.listRuns(pageLimit, pageOffset, includeArchived, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
* Pauses a running run. Returns 409 if the run is not running.
|
||||
|
|
@ -832,6 +955,16 @@ export const RunsApiFactory = function (configuration?: Configuration, basePath?
|
|||
startRun(id: string, startRunRequest?: StartRunRequest, options?: RawAxiosRequestConfig): AxiosPromise<RunStatusResponse> {
|
||||
return localVarFp.startRun(id, startRunRequest, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
* Restores an archived run to its prior terminal status. Idempotent on runs that are terminal but not archived (returns the current status without emitting an event). Returns 409 if the run is active.
|
||||
* @summary Unarchive Run
|
||||
* @param {string} id Unique run identifier (ULID).
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
unarchiveRun(id: string, options?: RawAxiosRequestConfig): AxiosPromise<RunStatusResponse> {
|
||||
return localVarFp.unarchiveRun(id, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
* Resumes a paused run. Returns 409 if the run is not paused.
|
||||
* @summary Unpause Run
|
||||
|
|
@ -849,6 +982,17 @@ export const RunsApiFactory = function (configuration?: Configuration, basePath?
|
|||
* RunsApi - object-oriented interface
|
||||
*/
|
||||
export class RunsApi extends BaseAPI {
|
||||
/**
|
||||
* Marks a terminal run (`succeeded`, `failed`, or `dead`) as `archived`. Archived runs are hidden from default listings and are read-only until unarchived. Idempotent on already-archived runs. Returns 409 if the run is not terminal.
|
||||
* @summary Archive Run
|
||||
* @param {string} id Unique run identifier (ULID).
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
public archiveRun(id: string, options?: RawAxiosRequestConfig) {
|
||||
return RunsApiFp(this.configuration).archiveRun(id, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels a running or queued run. Returns 409 if the run has already completed or been cancelled.
|
||||
* @summary Cancel Run
|
||||
|
|
@ -895,15 +1039,16 @@ export class RunsApi extends BaseAPI {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns durable run summaries from the backing store, including runs persisted before the current server boot.
|
||||
* Returns durable run summaries from the backing store, including runs persisted before the current server boot. Archived runs are hidden by default; pass `include_archived=true` to include them in the response.
|
||||
* @summary List Runs
|
||||
* @param {number} [pageLimit] Maximum number of items to return per page.
|
||||
* @param {number} [pageOffset] Number of items to skip before returning results.
|
||||
* @param {boolean} [includeArchived] Whether to include archived runs in the response. Defaults to `false`.
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
public listRuns(pageLimit?: number, pageOffset?: number, options?: RawAxiosRequestConfig) {
|
||||
return RunsApiFp(this.configuration).listRuns(pageLimit, pageOffset, options).then((request) => request(this.axios, this.basePath));
|
||||
public listRuns(pageLimit?: number, pageOffset?: number, includeArchived?: boolean, options?: RawAxiosRequestConfig) {
|
||||
return RunsApiFp(this.configuration).listRuns(pageLimit, pageOffset, includeArchived, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -973,6 +1118,17 @@ export class RunsApi extends BaseAPI {
|
|||
return RunsApiFp(this.configuration).startRun(id, startRunRequest, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores an archived run to its prior terminal status. Idempotent on runs that are terminal but not archived (returns the current status without emitting an event). Returns 409 if the run is active.
|
||||
* @summary Unarchive Run
|
||||
* @param {string} id Unique run identifier (ULID).
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
public unarchiveRun(id: string, options?: RawAxiosRequestConfig) {
|
||||
return RunsApiFp(this.configuration).unarchiveRun(id, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
|
||||
/**
|
||||
* Resumes a paused run. Returns 409 if the run is not paused.
|
||||
* @summary Unpause Run
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
|
||||
/**
|
||||
* Lifecycle status of a run.
|
||||
* Lifecycle status of a run. `archived` is a terminal status reached by an explicit user action on a previously terminal (`succeeded`, `failed`, or `dead`) run; archived runs are hidden from default listings and are read-only until unarchived.
|
||||
*/
|
||||
|
||||
export const RunStatus = {
|
||||
|
|
@ -28,7 +28,8 @@ export const RunStatus = {
|
|||
REMOVING: 'removing',
|
||||
SUCCEEDED: 'succeeded',
|
||||
FAILED: 'failed',
|
||||
DEAD: 'dead'
|
||||
DEAD: 'dead',
|
||||
ARCHIVED: 'archived'
|
||||
} as const;
|
||||
|
||||
export type RunStatus = typeof RunStatus[keyof typeof RunStatus];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue