|
|
|
|
@@ -101,11 +101,11 @@ func (q *Queries) CreateEvent(ctx context.Context, arg CreateEventParams) (Event
|
|
|
|
|
|
|
|
|
|
const createInventory = `-- name: CreateInventory :one
|
|
|
|
|
INSERT INTO inventory (
|
|
|
|
|
"Name", "Vcenter", "VmId", "VmUuid", "EventKey", "CloudId", "CreationTime", "ResourcePool", "VmType", "IsTemplate", "Datacenter", "Cluster", "Folder", "ProvisionedDisk", "InitialVcpus", "InitialRam", "SrmPlaceholder", "PoweredOn"
|
|
|
|
|
"Name", "Vcenter", "VmId", "VmUuid", "EventKey", "CloudId", "CreationTime", "ResourcePool", "IsTemplate", "Datacenter", "Cluster", "Folder", "ProvisionedDisk", "InitialVcpus", "InitialRam", "SrmPlaceholder", "PoweredOn"
|
|
|
|
|
) VALUES(
|
|
|
|
|
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
|
|
|
|
|
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
|
|
|
|
|
)
|
|
|
|
|
RETURNING Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid
|
|
|
|
|
RETURNING Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type CreateInventoryParams struct {
|
|
|
|
|
@@ -117,7 +117,6 @@ type CreateInventoryParams struct {
|
|
|
|
|
CloudId sql.NullString `db:"CloudId" json:"CloudId"`
|
|
|
|
|
CreationTime sql.NullInt64 `db:"CreationTime" json:"CreationTime"`
|
|
|
|
|
ResourcePool sql.NullString `db:"ResourcePool" json:"ResourcePool"`
|
|
|
|
|
VmType sql.NullString `db:"VmType" json:"VmType"`
|
|
|
|
|
IsTemplate interface{} `db:"IsTemplate" json:"IsTemplate"`
|
|
|
|
|
Datacenter sql.NullString `db:"Datacenter" json:"Datacenter"`
|
|
|
|
|
Cluster sql.NullString `db:"Cluster" json:"Cluster"`
|
|
|
|
|
@@ -139,7 +138,6 @@ func (q *Queries) CreateInventory(ctx context.Context, arg CreateInventoryParams
|
|
|
|
|
arg.CloudId,
|
|
|
|
|
arg.CreationTime,
|
|
|
|
|
arg.ResourcePool,
|
|
|
|
|
arg.VmType,
|
|
|
|
|
arg.IsTemplate,
|
|
|
|
|
arg.Datacenter,
|
|
|
|
|
arg.Cluster,
|
|
|
|
|
@@ -161,7 +159,6 @@ func (q *Queries) CreateInventory(ctx context.Context, arg CreateInventoryParams
|
|
|
|
|
&i.CreationTime,
|
|
|
|
|
&i.DeletionTime,
|
|
|
|
|
&i.ResourcePool,
|
|
|
|
|
&i.VmType,
|
|
|
|
|
&i.Datacenter,
|
|
|
|
|
&i.Cluster,
|
|
|
|
|
&i.Folder,
|
|
|
|
|
@@ -281,7 +278,7 @@ func (q *Queries) CreateUpdate(ctx context.Context, arg CreateUpdateParams) (Upd
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getInventoryByName = `-- name: GetInventoryByName :many
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid FROM inventory
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid FROM inventory
|
|
|
|
|
WHERE "Name" = ?
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
@@ -304,7 +301,6 @@ func (q *Queries) GetInventoryByName(ctx context.Context, name string) ([]Invent
|
|
|
|
|
&i.CreationTime,
|
|
|
|
|
&i.DeletionTime,
|
|
|
|
|
&i.ResourcePool,
|
|
|
|
|
&i.VmType,
|
|
|
|
|
&i.Datacenter,
|
|
|
|
|
&i.Cluster,
|
|
|
|
|
&i.Folder,
|
|
|
|
|
@@ -330,7 +326,7 @@ func (q *Queries) GetInventoryByName(ctx context.Context, name string) ([]Invent
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getInventoryByVcenter = `-- name: GetInventoryByVcenter :many
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid FROM inventory
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid FROM inventory
|
|
|
|
|
WHERE "Vcenter" = ?
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
@@ -353,7 +349,6 @@ func (q *Queries) GetInventoryByVcenter(ctx context.Context, vcenter string) ([]
|
|
|
|
|
&i.CreationTime,
|
|
|
|
|
&i.DeletionTime,
|
|
|
|
|
&i.ResourcePool,
|
|
|
|
|
&i.VmType,
|
|
|
|
|
&i.Datacenter,
|
|
|
|
|
&i.Cluster,
|
|
|
|
|
&i.Folder,
|
|
|
|
|
@@ -379,7 +374,7 @@ func (q *Queries) GetInventoryByVcenter(ctx context.Context, vcenter string) ([]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getInventoryEventId = `-- name: GetInventoryEventId :one
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid FROM inventory
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid FROM inventory
|
|
|
|
|
WHERE "CloudId" = ? LIMIT 1
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
@@ -396,7 +391,6 @@ func (q *Queries) GetInventoryEventId(ctx context.Context, cloudid sql.NullStrin
|
|
|
|
|
&i.CreationTime,
|
|
|
|
|
&i.DeletionTime,
|
|
|
|
|
&i.ResourcePool,
|
|
|
|
|
&i.VmType,
|
|
|
|
|
&i.Datacenter,
|
|
|
|
|
&i.Cluster,
|
|
|
|
|
&i.Folder,
|
|
|
|
|
@@ -412,7 +406,7 @@ func (q *Queries) GetInventoryEventId(ctx context.Context, cloudid sql.NullStrin
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getInventoryVcUrl = `-- name: GetInventoryVcUrl :many
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid FROM inventory
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid FROM inventory
|
|
|
|
|
WHERE "Vcenter" = ?1
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
@@ -435,7 +429,6 @@ func (q *Queries) GetInventoryVcUrl(ctx context.Context, vc string) ([]Inventory
|
|
|
|
|
&i.CreationTime,
|
|
|
|
|
&i.DeletionTime,
|
|
|
|
|
&i.ResourcePool,
|
|
|
|
|
&i.VmType,
|
|
|
|
|
&i.Datacenter,
|
|
|
|
|
&i.Cluster,
|
|
|
|
|
&i.Folder,
|
|
|
|
|
@@ -461,7 +454,7 @@ func (q *Queries) GetInventoryVcUrl(ctx context.Context, vc string) ([]Inventory
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getInventoryVmId = `-- name: GetInventoryVmId :one
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid FROM inventory
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid FROM inventory
|
|
|
|
|
WHERE "VmId" = ?1 AND "Datacenter" = ?2
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
@@ -483,7 +476,6 @@ func (q *Queries) GetInventoryVmId(ctx context.Context, arg GetInventoryVmIdPara
|
|
|
|
|
&i.CreationTime,
|
|
|
|
|
&i.DeletionTime,
|
|
|
|
|
&i.ResourcePool,
|
|
|
|
|
&i.VmType,
|
|
|
|
|
&i.Datacenter,
|
|
|
|
|
&i.Cluster,
|
|
|
|
|
&i.Folder,
|
|
|
|
|
@@ -499,7 +491,7 @@ func (q *Queries) GetInventoryVmId(ctx context.Context, arg GetInventoryVmIdPara
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getInventoryVmUuid = `-- name: GetInventoryVmUuid :one
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid FROM inventory
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid FROM inventory
|
|
|
|
|
WHERE "VmUuid" = ?1 AND "Datacenter" = ?2
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
@@ -521,7 +513,6 @@ func (q *Queries) GetInventoryVmUuid(ctx context.Context, arg GetInventoryVmUuid
|
|
|
|
|
&i.CreationTime,
|
|
|
|
|
&i.DeletionTime,
|
|
|
|
|
&i.ResourcePool,
|
|
|
|
|
&i.VmType,
|
|
|
|
|
&i.Datacenter,
|
|
|
|
|
&i.Cluster,
|
|
|
|
|
&i.Folder,
|
|
|
|
|
@@ -537,7 +528,7 @@ func (q *Queries) GetInventoryVmUuid(ctx context.Context, arg GetInventoryVmUuid
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getReportInventory = `-- name: GetReportInventory :many
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid FROM inventory
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid FROM inventory
|
|
|
|
|
ORDER BY "CreationTime"
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
@@ -560,7 +551,6 @@ func (q *Queries) GetReportInventory(ctx context.Context) ([]Inventory, error) {
|
|
|
|
|
&i.CreationTime,
|
|
|
|
|
&i.DeletionTime,
|
|
|
|
|
&i.ResourcePool,
|
|
|
|
|
&i.VmType,
|
|
|
|
|
&i.Datacenter,
|
|
|
|
|
&i.Cluster,
|
|
|
|
|
&i.Folder,
|
|
|
|
|
@@ -679,7 +669,7 @@ func (q *Queries) GetVmUpdates(ctx context.Context, arg GetVmUpdatesParams) ([]U
|
|
|
|
|
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, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid
|
|
|
|
|
RETURNING Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type InventoryCleanupParams struct {
|
|
|
|
|
@@ -695,7 +685,7 @@ func (q *Queries) InventoryCleanup(ctx context.Context, arg InventoryCleanupPara
|
|
|
|
|
const inventoryCleanupTemplates = `-- name: InventoryCleanupTemplates :exec
|
|
|
|
|
DELETE FROM inventory
|
|
|
|
|
WHERE "IsTemplate" = 'TRUE'
|
|
|
|
|
RETURNING Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid
|
|
|
|
|
RETURNING Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
func (q *Queries) InventoryCleanupTemplates(ctx context.Context) error {
|
|
|
|
|
@@ -706,7 +696,7 @@ func (q *Queries) InventoryCleanupTemplates(ctx context.Context) error {
|
|
|
|
|
const inventoryCleanupVcenter = `-- name: InventoryCleanupVcenter :exec
|
|
|
|
|
DELETE FROM inventory
|
|
|
|
|
WHERE "Vcenter" = ?1
|
|
|
|
|
RETURNING Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid
|
|
|
|
|
RETURNING Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
func (q *Queries) InventoryCleanupVcenter(ctx context.Context, vc string) error {
|
|
|
|
|
@@ -793,7 +783,7 @@ func (q *Queries) ListEvents(ctx context.Context) ([]Event, error) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const listInventory = `-- name: ListInventory :many
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid FROM inventory
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid FROM inventory
|
|
|
|
|
ORDER BY "Name"
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
@@ -816,7 +806,6 @@ func (q *Queries) ListInventory(ctx context.Context) ([]Inventory, error) {
|
|
|
|
|
&i.CreationTime,
|
|
|
|
|
&i.DeletionTime,
|
|
|
|
|
&i.ResourcePool,
|
|
|
|
|
&i.VmType,
|
|
|
|
|
&i.Datacenter,
|
|
|
|
|
&i.Cluster,
|
|
|
|
|
&i.Folder,
|
|
|
|
|
|