add vm cleanup endpoint
Some checks are pending
CI / Test (push) Waiting to run
CI / End-to-End (push) Waiting to run
CI / Publish Docker (push) Blocked by required conditions
CI / Lint (push) Waiting to run
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-09-26 13:29:02 +10:00
parent f712c7254f
commit 00d474b937
5 changed files with 114 additions and 1 deletions

View File

@@ -329,6 +329,22 @@ func (q *Queries) GetInventoryVmId(ctx context.Context, arg GetInventoryVmIdPara
return i, err
}
const inventoryCleanup = `-- name: InventoryCleanup :exec
DELETE FROM "Inventory"
WHERE "VmId" = ?1 AND "Datacenter" = ?2
RETURNING Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, SrmPlaceholder, IsTemplate, PowerState
`
type InventoryCleanupParams struct {
VmId sql.NullString
DatacenterName sql.NullString
}
func (q *Queries) InventoryCleanup(ctx context.Context, arg InventoryCleanupParams) error {
_, err := q.db.ExecContext(ctx, inventoryCleanup, arg.VmId, arg.DatacenterName)
return err
}
const inventoryMarkDeleted = `-- name: InventoryMarkDeleted :exec
UPDATE "Inventory"
SET "DeletionTime" = ?1