|
|
|
@@ -72,11 +72,11 @@ func (q *Queries) CreateEvent(ctx context.Context, arg CreateEventParams) (Event
|
|
|
|
|
|
|
|
|
|
const createInventory = `-- name: CreateInventory :one
|
|
|
|
|
INSERT INTO "Inventory" (
|
|
|
|
|
"Name", "Vcenter", "VmId", "EventKey", "EventId", "CreationTime", "ResourcePool", "VmType", "IsTemplate", "Datacenter", "Cluster", "Folder", "ProvisionedDisk", "InitialVcpus", "InitialRam", "SrmPlaceholder", "PowerState"
|
|
|
|
|
"Name", "Vcenter", "VmId", "EventKey", "CloudId", "CreationTime", "ResourcePool", "VmType", "IsTemplate", "Datacenter", "Cluster", "Folder", "ProvisionedDisk", "InitialVcpus", "InitialRam", "SrmPlaceholder", "PowerState"
|
|
|
|
|
) VALUES(
|
|
|
|
|
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
|
|
|
|
|
)
|
|
|
|
|
RETURNING Iid, Name, Vcenter, VmId, EventKey, EventId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, SrmPlaceholder, IsTemplate, PowerState
|
|
|
|
|
RETURNING Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, SrmPlaceholder, IsTemplate, PowerState
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type CreateInventoryParams struct {
|
|
|
|
@@ -84,7 +84,7 @@ type CreateInventoryParams struct {
|
|
|
|
|
Vcenter string
|
|
|
|
|
VmId sql.NullString
|
|
|
|
|
EventKey sql.NullString
|
|
|
|
|
EventId sql.NullString
|
|
|
|
|
CloudId sql.NullString
|
|
|
|
|
CreationTime sql.NullInt64
|
|
|
|
|
ResourcePool sql.NullString
|
|
|
|
|
VmType sql.NullString
|
|
|
|
@@ -105,7 +105,7 @@ func (q *Queries) CreateInventory(ctx context.Context, arg CreateInventoryParams
|
|
|
|
|
arg.Vcenter,
|
|
|
|
|
arg.VmId,
|
|
|
|
|
arg.EventKey,
|
|
|
|
|
arg.EventId,
|
|
|
|
|
arg.CloudId,
|
|
|
|
|
arg.CreationTime,
|
|
|
|
|
arg.ResourcePool,
|
|
|
|
|
arg.VmType,
|
|
|
|
@@ -126,7 +126,7 @@ func (q *Queries) CreateInventory(ctx context.Context, arg CreateInventoryParams
|
|
|
|
|
&i.Vcenter,
|
|
|
|
|
&i.VmId,
|
|
|
|
|
&i.EventKey,
|
|
|
|
|
&i.EventId,
|
|
|
|
|
&i.CloudId,
|
|
|
|
|
&i.CreationTime,
|
|
|
|
|
&i.DeletionTime,
|
|
|
|
|
&i.ResourcePool,
|
|
|
|
@@ -191,7 +191,7 @@ func (q *Queries) CreateUpdate(ctx context.Context, arg CreateUpdateParams) (Upd
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getInventoryByName = `-- name: GetInventoryByName :many
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, EventId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, SrmPlaceholder, IsTemplate, PowerState FROM "Inventory"
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, SrmPlaceholder, IsTemplate, PowerState FROM "Inventory"
|
|
|
|
|
WHERE "Name" = ?
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
@@ -210,7 +210,7 @@ func (q *Queries) GetInventoryByName(ctx context.Context, name string) ([]Invent
|
|
|
|
|
&i.Vcenter,
|
|
|
|
|
&i.VmId,
|
|
|
|
|
&i.EventKey,
|
|
|
|
|
&i.EventId,
|
|
|
|
|
&i.CloudId,
|
|
|
|
|
&i.CreationTime,
|
|
|
|
|
&i.DeletionTime,
|
|
|
|
|
&i.ResourcePool,
|
|
|
|
@@ -239,12 +239,12 @@ func (q *Queries) GetInventoryByName(ctx context.Context, name string) ([]Invent
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getInventoryEventId = `-- name: GetInventoryEventId :one
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, EventId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, SrmPlaceholder, IsTemplate, PowerState FROM "Inventory"
|
|
|
|
|
WHERE "EventId" = ? LIMIT 1
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, SrmPlaceholder, IsTemplate, PowerState FROM "Inventory"
|
|
|
|
|
WHERE "CloudId" = ? LIMIT 1
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
func (q *Queries) GetInventoryEventId(ctx context.Context, eventid sql.NullString) (Inventory, error) {
|
|
|
|
|
row := q.db.QueryRowContext(ctx, getInventoryEventId, eventid)
|
|
|
|
|
func (q *Queries) GetInventoryEventId(ctx context.Context, cloudid sql.NullString) (Inventory, error) {
|
|
|
|
|
row := q.db.QueryRowContext(ctx, getInventoryEventId, cloudid)
|
|
|
|
|
var i Inventory
|
|
|
|
|
err := row.Scan(
|
|
|
|
|
&i.Iid,
|
|
|
|
@@ -252,7 +252,7 @@ func (q *Queries) GetInventoryEventId(ctx context.Context, eventid sql.NullStrin
|
|
|
|
|
&i.Vcenter,
|
|
|
|
|
&i.VmId,
|
|
|
|
|
&i.EventKey,
|
|
|
|
|
&i.EventId,
|
|
|
|
|
&i.CloudId,
|
|
|
|
|
&i.CreationTime,
|
|
|
|
|
&i.DeletionTime,
|
|
|
|
|
&i.ResourcePool,
|
|
|
|
@@ -271,7 +271,7 @@ func (q *Queries) GetInventoryEventId(ctx context.Context, eventid sql.NullStrin
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getInventoryVmId = `-- name: GetInventoryVmId :one
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, EventId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, SrmPlaceholder, IsTemplate, PowerState FROM "Inventory"
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, SrmPlaceholder, IsTemplate, PowerState FROM "Inventory"
|
|
|
|
|
WHERE "VmId" = ?1 AND "Datacenter" = ?2
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
@@ -289,7 +289,7 @@ func (q *Queries) GetInventoryVmId(ctx context.Context, arg GetInventoryVmIdPara
|
|
|
|
|
&i.Vcenter,
|
|
|
|
|
&i.VmId,
|
|
|
|
|
&i.EventKey,
|
|
|
|
|
&i.EventId,
|
|
|
|
|
&i.CloudId,
|
|
|
|
|
&i.CreationTime,
|
|
|
|
|
&i.DeletionTime,
|
|
|
|
|
&i.ResourcePool,
|
|
|
|
@@ -369,7 +369,7 @@ func (q *Queries) ListEvents(ctx context.Context) ([]Events, error) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const listInventory = `-- name: ListInventory :many
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, EventId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, SrmPlaceholder, IsTemplate, PowerState FROM "Inventory"
|
|
|
|
|
SELECT Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, SrmPlaceholder, IsTemplate, PowerState FROM "Inventory"
|
|
|
|
|
ORDER BY "Name"
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
@@ -388,7 +388,7 @@ func (q *Queries) ListInventory(ctx context.Context) ([]Inventory, error) {
|
|
|
|
|
&i.Vcenter,
|
|
|
|
|
&i.VmId,
|
|
|
|
|
&i.EventKey,
|
|
|
|
|
&i.EventId,
|
|
|
|
|
&i.CloudId,
|
|
|
|
|
&i.CreationTime,
|
|
|
|
|
&i.DeletionTime,
|
|
|
|
|
&i.ResourcePool,
|
|
|
|
|