How It Fits
A command belongs to the resource it acts on and is created at that resource’s-command endpoint. The command’s type names the action, and its spec holds the action’s inputs.
Creating a command returns
201 Created with a Location header that links to the new command. The work has started, but it hasn’t finished: poll the command to see where it is. Creating a workload command requires the matching exec permission, such as exec.runCronWorkload.
Lifecycle
ThelifecycleStage field shows where a command is. It starts at pending and normally ends in one of the three final stages.
completed means the action itself succeeded, not just the request. For example, a runCronWorkload command completes only when the job it started has finished. completed and cancelled are permanent. In rare cases, a failed command is corrected to completed once Control Plane sees the work actually finished.
Working with Commands
The examples usecpln rest, which sends an authenticated request to any API path. Any HTTP client works the same way against https://api.cpln.io.
Create a command by posting its type and spec:
?lifecycleStage=STAGE narrows it to one stage:
runCronWorkload run that is in progress, stop its replica: that deletes the run’s job and marks its command cancelled.
Gotchas
- A
201doesn’t mean the action finished. It means the command was accepted. ReadlifecycleStageuntil it reachescompleted,failed, orcancelled. - A command is read-only once created. A
PATCHfrom a user or service account is rejected with403 Cannot modify commands, and aDELETEisn’t allowed. A command stays as a record of what ran until the workload or volume set it belongs to is deleted, which deletes its commands too. - Some commands conflict, and they conflict in different ways.
- A second
stopReplicafor the same replica is rejected with400while the first is still in progress. - A volume set command that overlaps one already in progress on the same volume is rejected with
409. The exception isdeleteVolume, which fails the overlapping commands instead. runCronWorkloadhas no such check, so a second on-demand run starts alongside the first.
- A second
Learn More
Workload types: Run Now
The
runCronWorkload spec, including per-run container overrides and deadlines.Stop a Replica
The
stopReplica spec and what Control Plane does when a replica is stopped.Volume set commands
Expand, shrink, delete, snapshot, and restore the volumes of a volume set.
Workload security
The
exec permissions that allow a principal to create workload commands.