跳转到内容
EN

Delete a unit

Code Mode: praxis.devops.units.delete

HTTP: DELETE /devops/v1/units/{id}

Destroy the unit and the machine behind it: the sandbox kills the machine, the unit moves to deleted, and its record stays for history. A unit holding uncommitted or unpushed work is refused with 409 UNIT_UNPUSHED_WORK so that work is not lost by accident; send force true to delete it anyway, which is what the Console offers behind a confirmation. Deleting an already deleted unit succeeds and changes nothing. Deleting is one-way: a deleted unit is never started again; open a new one for the change instead.

签名

praxis.devops.units.delete(args:{path:{/** e.g. "wsu_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string};query?:{/** e.g. false */ force?:boolean}}):Promise<{/** Always true on success; a refusal answers an error instead, so a caller never reads deleted false here. e.g. true */ deleted:boolean}>;

参数

名称位置类型必填说明
idpathstring是The unit identifier returned by the unit create answer or a unit list, such as wsu_…; not the id of the change it was opened for.
forcequeryboolean否Delete even when the unit holds uncommitted or unpushed work; omitted or false refuses such a unit with UNIT_UNPUSHED_WORK.

响应

状态码内容类型说明
200application/jsonThe unit is gone and its machine was killed; the answer carries deleted true.
401application/jsonThe API key is missing or invalid; send a valid Praxis API key in the Authorization header before retrying.
403application/jsonThe credential carries no organization, or that organization cannot reach this project; use a key belonging to the project’s organization. No cross-organization read is possible.
404application/jsonUNIT_NOT_FOUND means no unit with that id is visible to this organization — a unit belonging to another organization answers the same way, so its existence is not revealed; list the project’s units and use an id from that answer.
409application/jsonUNIT_UNPUSHED_WORK means the unit holds uncommitted or unpushed work, so deleting it would lose that work; push it first, or send force true to delete it anyway. Nothing was deleted.
500application/jsonINTERNAL means the service could not complete the request; retry once, and if it repeats report the request id. A read is safe to repeat; a write that failed this way should be re-read before it is sent again.