vm_set_ttl
Set an expiration time on a VM to auto-delete it when the countdown ends. Preview the deletion blast radius first, then confirm to schedule cleanup for short-lived lab VMs.
Instructions
[WRITE] Set a Time-To-Live (TTL) for a VM. The daemon auto-deletes it when expired.
Without confirm=True this only previews: it returns blast_radius — the VM that will be deleted (identity, host, disks, total size, snapshot count), when (expires_at), and any TTL it replaces — and schedules nothing. Show that to the user and get their explicit decision. Do not set confirm=True on your own because the user asked earlier: they have not seen the preview yet. Refused when the VM's identity or disks cannot be read.
Use this for short-lived lab VMs so cleanup is not forgotten; cancel with
vm_cancel_ttl and review pending expiries with vm_list_ttl. The scheduler
daemon must be running (vmware-knight daemon start) or nothing is ever
deleted; it powers a running VM off first. TTLs persist in
~/.vmware-knight/ttl.json. Returns a dict (action, blast_radius).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | No | Optional vCenter/ESXi target name from config. | |
| confirm | No | False (default) returns the blast radius and changes nothing. True applies it. | |
| minutes | Yes | Minutes until deletion (minimum 1). | |
| vm_name | Yes | Name of the VM to auto-delete. |