diff --git a/cdb/db_apps.go b/cdb/db_apps.go index b325e45..726bfa2 100644 --- a/cdb/db_apps.go +++ b/cdb/db_apps.go @@ -5,15 +5,141 @@ import ( "database/sql" "errors" "fmt" + "strconv" + "strings" + + "github.com/opensvc/oc3/schema" ) type ( - DBApp struct { - id int64 - app string + App struct { + ID int64 `json:"id"` + App string `json:"app"` + Updated string `json:"updated"` + AppDomain string `json:"app_domain"` + AppTeamOps string `json:"app_team_ops"` + Description string `json:"description"` + } + + AuthGroup struct { + ID int64 `json:"id"` + Role string `json:"role"` + Privilege bool `json:"privilege"` + Description string `json:"description"` } ) +func scanApps(rows *sql.Rows) ([]App, error) { + apps := make([]App, 0) + for rows.Next() { + var ( + item App + updated sql.NullString + appDomain sql.NullString + appTeamOps sql.NullString + description sql.NullString + ) + if err := rows.Scan(&item.ID, &item.App, &updated, &appDomain, &appTeamOps, &description); err != nil { + return nil, fmt.Errorf("scanApps: %w", err) + } + if updated.Valid { + item.Updated = updated.String + } + if appDomain.Valid { + item.AppDomain = appDomain.String + } + if appTeamOps.Valid { + item.AppTeamOps = appTeamOps.String + } + if description.Valid { + item.Description = description.String + } + apps = append(apps, item) + } + if err := rows.Err(); err != nil { + return nil, fmt.Errorf("scanApps rows: %w", err) + } + return apps, nil +} + +func buildAppsQuery(groups []string, isManager bool, selectExprs []string) (string, []any) { + q := From(schema.TApps). + Distinct(). + RawSelect(selectExprs...) + + if !isManager { + cleanGroups := cleanGroups(groups) + q = q.Via(schema.TAppsResponsibles). + WhereIn(schema.AuthGroupRole, cleanGroups) + } else { + q = q.Where(schema.AppsID, ">", 0) + } + + query, args, err := q.Build() + if err != nil { + panic(fmt.Sprintf("buildAppsQuery: %v", err)) + } + return query, args +} + +func buildAppsQueryAll(groups []string, isManager bool) (string, []any) { + return buildAppsQuery(groups, isManager, []string{ + "apps.id", "apps.app", + "COALESCE(apps.updated, '')", "COALESCE(apps.app_domain, '')", + "COALESCE(apps.app_team_ops, '')", "COALESCE(apps.description, '')", + }) +} + +func (oDb *DB) GetApps(ctx context.Context, p ListParams) ([]map[string]any, error) { + query, args := buildAppsQuery(p.Groups, p.IsManager, p.SelectExprs) + if gb := p.GroupByClause(""); gb != "" { + query += " " + gb + } + query += " " + p.OrderByClause("apps.app, apps.id") + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("getApps: %w", err) + } + defer func() { _ = rows.Close() }() + + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} + +func (oDb *DB) GetApp(ctx context.Context, appIDOrName string, groups []string, isManager bool) (*App, error) { + query, args := buildAppsQueryAll(groups, isManager) + + if id, err := strconv.ParseInt(appIDOrName, 10, 64); err == nil { + query += " AND apps.id = ?" + args = append(args, id) + } else { + query += " AND apps.app = ?" + args = append(args, appIDOrName) + } + query += " ORDER BY apps.app, apps.id LIMIT 2" + + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("getApp: %w", err) + } + defer func() { _ = rows.Close() }() + + apps, err := scanApps(rows) + if err != nil { + return nil, fmt.Errorf("getApp: %w", err) + } + + switch len(apps) { + case 0: + return nil, nil + case 1: + return &apps[0], nil + default: + return nil, fmt.Errorf("getApp: multiple apps found for %q", appIDOrName) + } +} + // AuthGroupIdsForNode is the oc3 implementation of oc2 node_responsibles(node_id): // // q = db.nodes.node_id == node_id @@ -94,7 +220,7 @@ func (oDb *DB) ResponsibleAppsForNode(ctx context.Context, nodeID string) (apps return } -func (oDb *DB) appFromAppName(ctx context.Context, app string) (bool, *DBApp, error) { +func (oDb *DB) appFromAppName(ctx context.Context, app string) (bool, *App, error) { const query = "SELECT id, app FROM apps WHERE app = ?" var ( foundID int64 @@ -110,8 +236,172 @@ func (oDb *DB) appFromAppName(ctx context.Context, app string) (bool, *DBApp, er case err != nil: return false, nil, err default: - return true, &DBApp{id: foundID, app: foundApp}, nil + return true, &App{ID: foundID, App: foundApp}, nil + } +} + +func (oDb *DB) AppExists(ctx context.Context, app string) (bool, error) { + ok, _, err := oDb.appFromAppName(ctx, app) + if err != nil { + return false, fmt.Errorf("appExists: %w", err) + } + return ok, nil +} + +func (oDb *DB) AppResponsible(ctx context.Context, appIDOrName string, groups []string, isManager bool, nodeID string) (bool, error) { + if isManager { + return true, nil + } + + targetApp, err := oDb.GetApp(ctx, appIDOrName, nil, true) + if err != nil { + return false, fmt.Errorf("appResponsible: %w", err) + } + if targetApp == nil { + return false, nil + } + + if nodeID != "" { + nodeAppID, ok, err := oDb.AppIDFromNodeID(ctx, nodeID) + if err != nil { + return false, fmt.Errorf("appResponsible: %w", err) + } + return ok && nodeAppID == targetApp.ID, nil + } + + visibleApp, err := oDb.GetApp(ctx, appIDOrName, groups, false) + if err != nil { + return false, fmt.Errorf("appResponsible: %w", err) + } + return visibleApp != nil, nil +} + +func (oDb *DB) GetAppResponsibles(ctx context.Context, appIDOrName string, groups []string, isManager bool, limit, offset int) ([]AuthGroup, error) { + targetApp, err := oDb.GetApp(ctx, appIDOrName, nil, true) + if err != nil { + return nil, fmt.Errorf("getAppResponsibles: %w", err) + } + if targetApp == nil { + return nil, nil + } + + if !isManager { + visibleApp, err := oDb.GetApp(ctx, appIDOrName, groups, false) + if err != nil { + return nil, fmt.Errorf("getAppResponsibles: %w", err) + } + if visibleApp == nil { + return []AuthGroup{}, nil + } + } + + query := ` + SELECT auth_group.id, auth_group.role, auth_group.privilege, auth_group.description + FROM auth_group + JOIN apps_responsibles ON auth_group.id = apps_responsibles.group_id + WHERE apps_responsibles.app_id = ? + ORDER BY auth_group.role, auth_group.id + ` + args := []any{targetApp.ID} + query, args = appendLimitOffset(query, args, limit, offset) + + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("getAppResponsibles: %w", err) + } + defer func() { _ = rows.Close() }() + + items := make([]AuthGroup, 0) + for rows.Next() { + var ( + item AuthGroup + role sql.NullString + privilege sql.NullString + description sql.NullString + ) + if err := rows.Scan(&item.ID, &role, &privilege, &description); err != nil { + return nil, fmt.Errorf("getAppResponsibles scan: %w", err) + } + if role.Valid { + item.Role = role.String + } + if privilege.Valid { + item.Privilege = privilege.String == "T" + } + if description.Valid { + item.Description = description.String + } + items = append(items, item) + } + if err := rows.Err(); err != nil { + return nil, fmt.Errorf("getAppResponsibles rows: %w", err) } + + return items, nil +} + +func (oDb *DB) GetAppPublications(ctx context.Context, appIDOrName string, groups []string, isManager bool, limit, offset int) ([]AuthGroup, error) { + targetApp, err := oDb.GetApp(ctx, appIDOrName, nil, true) + if err != nil { + return nil, fmt.Errorf("getAppPublications: %w", err) + } + if targetApp == nil { + return nil, nil + } + + if !isManager { + visibleApp, err := oDb.GetApp(ctx, appIDOrName, groups, false) + if err != nil { + return nil, fmt.Errorf("getAppPublications: %w", err) + } + if visibleApp == nil { + return []AuthGroup{}, nil + } + } + + query := ` + SELECT auth_group.id, auth_group.role, auth_group.privilege, auth_group.description + FROM auth_group + JOIN apps_publications ON auth_group.id = apps_publications.group_id + WHERE apps_publications.app_id = ? + ORDER BY auth_group.role, auth_group.id + ` + args := []any{targetApp.ID} + query, args = appendLimitOffset(query, args, limit, offset) + + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("getAppPublications: %w", err) + } + defer func() { _ = rows.Close() }() + + items := make([]AuthGroup, 0) + for rows.Next() { + var ( + item AuthGroup + role sql.NullString + privilege sql.NullString + description sql.NullString + ) + if err := rows.Scan(&item.ID, &role, &privilege, &description); err != nil { + return nil, fmt.Errorf("getAppPublications scan: %w", err) + } + if role.Valid { + item.Role = role.String + } + if privilege.Valid { + item.Privilege = privilege.String == "T" + } + if description.Valid { + item.Description = description.String + } + items = append(items, item) + } + if err := rows.Err(); err != nil { + return nil, fmt.Errorf("getAppPublications rows: %w", err) + } + + return items, nil } func (oDb *DB) isAppAllowedForNodeID(ctx context.Context, nodeID, app string) (bool, error) { @@ -218,6 +508,168 @@ func (oDb *DB) AppIDFromObjectOrNodeIDs(ctx context.Context, nodeID, objectID st return oDb.AppIDFromNodeID(ctx, nodeID) } +// AppQuotaExceeded returns true if the user has reached their app creation quota. +// A quota of 0 or NULL means unlimited. +func (oDb *DB) AppQuotaExceeded(ctx context.Context, userID int64) (bool, error) { + var quota sql.NullInt64 + err := oDb.DB.QueryRowContext(ctx, + "SELECT quota_app FROM auth_user WHERE id = ?", userID, + ).Scan("a) + switch { + case errors.Is(err, sql.ErrNoRows): + return false, nil + case err != nil: + return false, fmt.Errorf("appQuotaExceeded: %w", err) + case !quota.Valid || quota.Int64 == 0: + return false, nil + } + + var count int64 + err = oDb.DB.QueryRowContext(ctx, + `SELECT COUNT(DISTINCT apps_responsibles.app_id) + FROM apps_responsibles + JOIN auth_membership ON apps_responsibles.group_id = auth_membership.group_id + WHERE auth_membership.user_id = ?`, userID, + ).Scan(&count) + if err != nil { + return false, fmt.Errorf("appQuotaExceeded count: %w", err) + } + return count >= quota.Int64, nil +} + +func (oDb *DB) InsertApp(ctx context.Context, app, description, appDomain, appTeamOps string) (*App, error) { + const query = `INSERT INTO apps (app, description, app_domain, app_team_ops) VALUES (?, ?, ?, ?)` + result, err := oDb.DB.ExecContext(ctx, query, app, + sql.NullString{String: description, Valid: description != ""}, + sql.NullString{String: appDomain, Valid: appDomain != ""}, + sql.NullString{String: appTeamOps, Valid: appTeamOps != ""}, + ) + if err != nil { + return nil, fmt.Errorf("insertApp: %w", err) + } + id, err := result.LastInsertId() + if err != nil { + return nil, fmt.Errorf("insertApp lastInsertId: %w", err) + } + oDb.SetChange("apps") + return &App{ID: id, App: app, Description: description, AppDomain: appDomain, AppTeamOps: appTeamOps}, nil +} + +type UpdateAppFields struct { + App *string + Description *string + AppDomain *string + AppTeamOps *string +} + +func (oDb *DB) UpdateApp(ctx context.Context, appID int64, fields UpdateAppFields) error { + setClauses := []string{} + args := []any{} + if fields.App != nil { + setClauses = append(setClauses, "app = ?") + args = append(args, *fields.App) + } + if fields.Description != nil { + setClauses = append(setClauses, "description = ?") + args = append(args, sql.NullString{String: *fields.Description, Valid: true}) + } + if fields.AppDomain != nil { + setClauses = append(setClauses, "app_domain = ?") + args = append(args, sql.NullString{String: *fields.AppDomain, Valid: true}) + } + if fields.AppTeamOps != nil { + setClauses = append(setClauses, "app_team_ops = ?") + args = append(args, sql.NullString{String: *fields.AppTeamOps, Valid: true}) + } + if len(setClauses) == 0 { + return nil + } + query := "UPDATE apps SET " + strings.Join(setClauses, ", ") + " WHERE id = ?" + args = append(args, appID) + if _, err := oDb.DB.ExecContext(ctx, query, args...); err != nil { + return fmt.Errorf("updateApp: %w", err) + } + oDb.SetChange("apps") + return nil +} + +func (oDb *DB) UpdateNodesApp(ctx context.Context, oldApp, newApp string) error { + const query = `UPDATE nodes SET app = ? WHERE app = ?` + if _, err := oDb.DB.ExecContext(ctx, query, newApp, oldApp); err != nil { + return fmt.Errorf("updateNodesApp: %w", err) + } + return nil +} + +func (oDb *DB) UpdateServicesApp(ctx context.Context, oldApp, newApp string) error { + const query = `UPDATE services SET svc_app = ? WHERE svc_app = ?` + if _, err := oDb.DB.ExecContext(ctx, query, newApp, oldApp); err != nil { + return fmt.Errorf("updateServicesApp: %w", err) + } + return nil +} + +func (oDb *DB) InsertAppResponsible(ctx context.Context, appID, groupID int64) error { + const query = `INSERT INTO apps_responsibles (app_id, group_id) VALUES (?, ?)` + if _, err := oDb.DB.ExecContext(ctx, query, appID, groupID); err != nil { + return fmt.Errorf("insertAppResponsible: %w", err) + } + oDb.SetChange("apps_responsibles") + return nil +} + +func (oDb *DB) InsertAppPublication(ctx context.Context, appID, groupID int64) error { + const query = `INSERT INTO apps_publications (app_id, group_id) VALUES (?, ?)` + if _, err := oDb.DB.ExecContext(ctx, query, appID, groupID); err != nil { + return fmt.Errorf("insertAppPublication: %w", err) + } + oDb.SetChange("apps_publications") + return nil +} + +func (oDb *DB) AppUsageCounts(ctx context.Context, app string) (nodesCount, servicesCount int64, err error) { + const nodeQuery = `SELECT COUNT(*) FROM nodes WHERE app = ?` + if err = oDb.DB.QueryRowContext(ctx, nodeQuery, app).Scan(&nodesCount); err != nil { + err = fmt.Errorf("appUsageCounts nodes: %w", err) + return + } + + const serviceQuery = `SELECT COUNT(*) FROM services WHERE svc_app = ?` + if err = oDb.DB.QueryRowContext(ctx, serviceQuery, app).Scan(&servicesCount); err != nil { + err = fmt.Errorf("appUsageCounts services: %w", err) + return + } + + return +} + +func (oDb *DB) DeleteApp(ctx context.Context, appID int64) error { + const query = `DELETE FROM apps WHERE id = ?` + if _, err := oDb.DB.ExecContext(ctx, query, appID); err != nil { + return fmt.Errorf("deleteApp: %w", err) + } + oDb.SetChange("apps") + return nil +} + +func (oDb *DB) DeleteAppResponsibles(ctx context.Context, appID int64) error { + const query = `DELETE FROM apps_responsibles WHERE app_id = ?` + if _, err := oDb.DB.ExecContext(ctx, query, appID); err != nil { + return fmt.Errorf("deleteAppResponsibles: %w", err) + } + oDb.SetChange("apps_responsibles") + return nil +} + +func (oDb *DB) DeleteAppPublications(ctx context.Context, appID int64) error { + const query = `DELETE FROM apps_publications WHERE app_id = ?` + if _, err := oDb.DB.ExecContext(ctx, query, appID); err != nil { + return fmt.Errorf("deleteAppPublications: %w", err) + } + oDb.SetChange("apps_publications") + return nil +} + func (oDb *DB) AppsWithoutResponsible(ctx context.Context) (apps []string, err error) { const query = `SELECT apps.app FROM apps diff --git a/cdb/db_arrays.go b/cdb/db_arrays.go new file mode 100644 index 0000000..3054b27 --- /dev/null +++ b/cdb/db_arrays.go @@ -0,0 +1,37 @@ +package cdb + +import ( + "context" + "fmt" + + "github.com/opensvc/oc3/schema" +) + +func buildArraysQuery(selectExprs []string) (string, []any) { + q := From(schema.TStorArray). + RawSelect(selectExprs...). + Where(schema.StorArrayID, ">", 0) + + query, args, err := q.Build() + if err != nil { + panic(fmt.Sprintf("buildArraysQuery: %v", err)) + } + return query, args +} + +func (oDb *DB) GetArrays(ctx context.Context, p ListParams) ([]map[string]any, error) { + query, args := buildArraysQuery(p.SelectExprs) + if gb := p.GroupByClause(""); gb != "" { + query += " " + gb + } + query += " " + p.OrderByClause("stor_array.array_name, stor_array.id") + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("getArrays: %w", err) + } + defer func() { _ = rows.Close() }() + + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} diff --git a/cdb/db_auth_node.go b/cdb/db_auth_node.go index e09e834..30fbc75 100644 --- a/cdb/db_auth_node.go +++ b/cdb/db_auth_node.go @@ -12,12 +12,13 @@ type DBAuthNode struct { Nodename string UUID string NodeID string + Updated string } // return the list of auth_node rows matching the given node_id func (oDb *DB) AuthNodesByNodeID(ctx context.Context, nodeID string) ([]DBAuthNode, error) { defer logDuration("AuthNodesByNodeID", time.Now()) - const query = `SELECT id, nodename, uuid, node_id FROM auth_node WHERE node_id = ?` + const query = `SELECT id, nodename, uuid, node_id, COALESCE(updated, '') FROM auth_node WHERE node_id = ?` rows, err := oDb.DB.QueryContext(ctx, query, nodeID) if err != nil { return nil, fmt.Errorf("AuthNodesByNodeID: %w", err) @@ -28,7 +29,7 @@ func (oDb *DB) AuthNodesByNodeID(ctx context.Context, nodeID string) ([]DBAuthNo for rows.Next() { var r DBAuthNode var nodename, uid, nid sql.NullString - if err := rows.Scan(&r.ID, &nodename, &uid, &nid); err != nil { + if err := rows.Scan(&r.ID, &nodename, &uid, &nid, &r.Updated); err != nil { return nil, fmt.Errorf("AuthNodesByNodeID scan: %w", err) } r.Nodename = nodename.String diff --git a/cdb/db_disks.go b/cdb/db_disks.go new file mode 100644 index 0000000..287b0b7 --- /dev/null +++ b/cdb/db_disks.go @@ -0,0 +1,101 @@ +package cdb + +import ( + "context" + "fmt" + + "github.com/opensvc/oc3/schema" +) + +func buildDisksQuery(groups []string, isManager bool, selectExprs []string) (string, []any) { + q := From(schema.TDiskinfo). + LeftJoin(schema.TSvcdisks, schema.TNodes, schema.TServices, schema.TApps). + RawSelect(selectExprs...) + + if !isManager { + cleanGroups := cleanGroups(groups) + if len(cleanGroups) == 0 { + q = q.WhereRaw("1=0") + } else { + args := make([]any, len(cleanGroups)) + for i, g := range cleanGroups { + args[i] = g + } + q = q.WhereRaw( + "diskinfo.disk_id IN ("+ + "SELECT sd.disk_id FROM svcdisks sd"+ + " JOIN nodes n ON sd.node_id = n.node_id"+ + " JOIN apps a ON n.app = a.app"+ + " JOIN apps_responsibles ar ON ar.app_id = a.id"+ + " JOIN auth_group ag ON ag.id = ar.group_id"+ + " WHERE ag.role IN ("+Placeholders(len(cleanGroups))+")"+ + ")", + args..., + ) + } + } else { + q = q.Where(schema.DiskinfoID, ">", 0) + } + + query, args, err := q.Build() + if err != nil { + // schema relations are static; a build error here is a programming mistake + panic(fmt.Sprintf("buildDisksQuery: %v", err)) + } + return query, args +} + +func (oDb *DB) GetDisk(ctx context.Context, diskID string, p ListParams) ([]map[string]any, error) { + query, args := buildDisksQuery(p.Groups, p.IsManager, p.SelectExprs) + query += " AND diskinfo.disk_id = ?" + args = append(args, diskID) + if gb := p.GroupByClause(""); gb != "" { + query += " " + gb + } + query += " " + p.OrderByClause("diskinfo.disk_id, diskinfo.disk_group") + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("getDisk: %w", err) + } + defer func() { _ = rows.Close() }() + + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} + +func (oDb *DB) GetNodeDisks(ctx context.Context, nodeID string, p ListParams) ([]map[string]any, error) { + query, args := buildDisksQuery(p.Groups, p.IsManager, p.SelectExprs) + query += " AND svcdisks.node_id = ?" + args = append(args, nodeID) + if gb := p.GroupByClause(""); gb != "" { + query += " " + gb + } + query += " " + p.OrderByClause("diskinfo.disk_id, diskinfo.disk_group") + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("getNodeDisks: %w", err) + } + defer func() { _ = rows.Close() }() + + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} + +func (oDb *DB) GetDisks(ctx context.Context, p ListParams) ([]map[string]any, error) { + query, args := buildDisksQuery(p.Groups, p.IsManager, p.SelectExprs) + if gb := p.GroupByClause(""); gb != "" { + query += " " + gb + } + query += " " + p.OrderByClause("diskinfo.disk_id, diskinfo.disk_group") + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("getDisks: %w", err) + } + defer func() { _ = rows.Close() }() + + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} diff --git a/cdb/db_hbas.go b/cdb/db_hbas.go new file mode 100644 index 0000000..71708d6 --- /dev/null +++ b/cdb/db_hbas.go @@ -0,0 +1,79 @@ +package cdb + +import ( + "context" + "fmt" + + "github.com/opensvc/oc3/schema" +) + +func buildHbasQuery(groups []string, isManager bool, selectExprs []string) (string, []any) { + q := From(schema.TNodeHBA). + RawSelect(selectExprs...) + + if !isManager { + cleanGroups := cleanGroups(groups) + if len(cleanGroups) == 0 { + q = q.WhereRaw("1=0") + } else { + args := make([]any, len(cleanGroups)) + for i, g := range cleanGroups { + args[i] = g + } + q = q.WhereRaw( + "node_hba.node_id IN ("+ + "SELECT n.node_id FROM nodes n"+ + " JOIN apps a ON n.app = a.app"+ + " JOIN apps_responsibles ar ON ar.app_id = a.id"+ + " JOIN auth_group ag ON ag.id = ar.group_id"+ + " WHERE ag.role IN ("+Placeholders(len(cleanGroups))+")"+ + ")", + args..., + ) + } + } else { + q = q.Where(schema.NodeHBAID, ">", 0) + } + + query, args, err := q.Build() + if err != nil { + panic(fmt.Sprintf("buildHbasQuery: %v", err)) + } + return query, args +} + +func (oDb *DB) GetHbas(ctx context.Context, p ListParams) ([]map[string]any, error) { + query, args := buildHbasQuery(p.Groups, p.IsManager, p.SelectExprs) + if gb := p.GroupByClause(""); gb != "" { + query += " " + gb + } + query += " " + p.OrderByClause("node_hba.node_id, node_hba.hba_id") + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("getHbas: %w", err) + } + defer func() { _ = rows.Close() }() + + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} + +func (oDb *DB) GetNodeHbas(ctx context.Context, nodeID string, p ListParams) ([]map[string]any, error) { + query, args := buildHbasQuery(p.Groups, p.IsManager, p.SelectExprs) + query += " AND node_hba.node_id = ?" + args = append(args, nodeID) + if gb := p.GroupByClause(""); gb != "" { + query += " " + gb + } + query += " " + p.OrderByClause("node_hba.hba_id") + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("getNodeHbas: %w", err) + } + defer func() { _ = rows.Close() }() + + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} diff --git a/cdb/db_node_interfaces.go b/cdb/db_node_interfaces.go new file mode 100644 index 0000000..0b96a5b --- /dev/null +++ b/cdb/db_node_interfaces.go @@ -0,0 +1,71 @@ +package cdb + +import ( + "context" + "fmt" + "strings" + + "github.com/opensvc/oc3/schema" +) + +func buildNodeInterfacesQuery(nodeID string, p ListParams) (string, []any) { + q := From(schema.TNodeIP). + RawSelect(p.SelectExprs...). + Where(schema.NodeIPNodeID, "=", nodeID) + + // LEFT JOIN nodes if needed. + for _, prop := range p.Props { + if strings.HasPrefix(prop, "nodes.") { + q = q.LeftJoin(schema.TNodes) + break + } + } + + if !p.IsManager { + cleanGroups := cleanGroups(p.Groups) + if len(cleanGroups) == 0 { + q = q.WhereRaw("1=0") + } else { + args := make([]any, len(cleanGroups)) + for i, g := range cleanGroups { + args[i] = g + } + q = q.WhereRaw( + "node_ip.node_id IN ("+ + "SELECT n.node_id FROM nodes n"+ + " JOIN apps a ON n.app = a.app"+ + " JOIN apps_responsibles ar ON ar.app_id = a.id"+ + " JOIN auth_group ag ON ag.id = ar.group_id"+ + " WHERE ag.role IN ("+Placeholders(len(cleanGroups))+")"+ + ")", + args..., + ) + } + } + + query, args, err := q.Build() + if err != nil { + panic(fmt.Sprintf("buildNodeInterfacesQuery: %v", err)) + } + return query, args +} + +func (oDb *DB) GetNodeInterfaces(ctx context.Context, nodeID string, p ListParams) ([]map[string]any, error) { + query, args := buildNodeInterfacesQuery(nodeID, p) + query += " " + p.GroupByClause("node_ip.intf") + " " + p.OrderByClause("node_ip.intf") + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("getNodeInterfaces: %w", err) + } + defer func() { _ = rows.Close() }() + + // Use nested output when cross-table props (containing a dot) are requested. + for _, prop := range p.Props { + if strings.Contains(prop, ".") { + return scanRowsToNestedMaps(rows, p.Props, "node_ip") + } + } + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} diff --git a/cdb/db_nodes.go b/cdb/db_nodes.go index 7624440..862a880 100644 --- a/cdb/db_nodes.go +++ b/cdb/db_nodes.go @@ -11,6 +11,7 @@ import ( "github.com/google/uuid" + "github.com/opensvc/oc3/schema" "github.com/opensvc/oc3/util/logkey" ) @@ -49,6 +50,73 @@ func (n *DBNode) String() string { return fmt.Sprintf("node: {nodename: %s, node_id: %s, cluster_id: %s, app: %s}", n.Nodename, n.NodeID, n.ClusterID, n.App) } +func buildNodesQuery(groups []string, isManager bool, selectExprs []string) (string, []any) { + q := From(schema.TNodes). + RawSelect(selectExprs...) + + if !isManager { + cleanGroups := cleanGroups(groups) + if len(cleanGroups) == 0 { + q = q.WhereRaw("1=0") + } else { + args := make([]any, len(cleanGroups)) + for i, g := range cleanGroups { + args[i] = g + } + q = q.WhereRaw( + "nodes.app IN ("+ + "SELECT a.app FROM apps a"+ + " JOIN apps_responsibles ar ON ar.app_id = a.id"+ + " JOIN auth_group ag ON ag.id = ar.group_id"+ + " WHERE ag.role IN ("+Placeholders(len(cleanGroups))+")"+ + ")", + args..., + ) + } + } else { + q = q.Where(schema.NodesID, ">", 0) + } + + query, args, err := q.Build() + if err != nil { + panic(fmt.Sprintf("buildNodesQuery: %v", err)) + } + return query, args +} + +func (oDb *DB) GetNodes(ctx context.Context, p ListParams) ([]map[string]any, error) { + query, args := buildNodesQuery(p.Groups, p.IsManager, p.SelectExprs) + if gb := p.GroupByClause(""); gb != "" { + query += " " + gb + } + query += " " + p.OrderByClause("nodes.nodename") + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("getNodes: %w", err) + } + defer func() { _ = rows.Close() }() + + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} + +// GetNode fetches a single node by node_id or nodename. +func (oDb *DB) GetNode(ctx context.Context, nodeID string, p ListParams) ([]map[string]any, error) { + query, args := buildNodesQuery(p.Groups, p.IsManager, p.SelectExprs) + query += " AND (nodes.node_id = ? OR nodes.nodename = ?)" + args = append(args, nodeID, nodeID) + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("getNode: %w", err) + } + defer func() { _ = rows.Close() }() + + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} + func (oDb *DB) NodeByNodeID(ctx context.Context, nodeID string) (*DBNode, error) { defer logDuration("nodeByNodeID", time.Now()) if nodeID == "" { diff --git a/cdb/db_object.go b/cdb/db_object.go index 519fcca..0e9e177 100644 --- a/cdb/db_object.go +++ b/cdb/db_object.go @@ -142,9 +142,9 @@ func (oDb *DB) ObjectFromID(ctx context.Context, svcID string) (*DBObject, error case err != nil: return nil, err default: - o.Frozen = placement.String + o.Frozen = frozen.String o.Placement = placement.String - o.Provisioned = placement.String + o.Provisioned = provisioned.String return &o, nil } } diff --git a/cdb/db_services.go b/cdb/db_services.go new file mode 100644 index 0000000..5fb9e5c --- /dev/null +++ b/cdb/db_services.go @@ -0,0 +1,75 @@ +package cdb + +import ( + "context" + "fmt" + + "github.com/opensvc/oc3/schema" +) + +func buildServicesQuery(groups []string, isManager bool, selectExprs []string) (string, []any) { + q := From(schema.TServices). + RawSelect(selectExprs...) + + if !isManager { + cleanGroups := cleanGroups(groups) + if len(cleanGroups) == 0 { + q = q.WhereRaw("1=0") + } else { + args := make([]any, len(cleanGroups)) + for i, g := range cleanGroups { + args[i] = g + } + q = q.WhereRaw( + "services.svc_app IN ("+ + "SELECT a.app FROM apps a"+ + " JOIN apps_responsibles ar ON ar.app_id = a.id"+ + " JOIN auth_group ag ON ag.id = ar.group_id"+ + " WHERE ag.role IN ("+Placeholders(len(cleanGroups))+")"+ + ")", + args..., + ) + } + } else { + q = q.Where(schema.ServicesID, ">", 0) + } + + query, args, err := q.Build() + if err != nil { + panic(fmt.Sprintf("buildServicesQuery: %v", err)) + } + return query, args +} + +func (oDb *DB) GetServices(ctx context.Context, p ListParams) ([]map[string]any, error) { + query, args := buildServicesQuery(p.Groups, p.IsManager, p.SelectExprs) + if gb := p.GroupByClause(""); gb != "" { + query += " " + gb + } + query += " " + p.OrderByClause("services.svcname") + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("getServices: %w", err) + } + defer func() { _ = rows.Close() }() + + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} + +// GetService fetches a single service by svc_id (UUID) or svcname. +func (oDb *DB) GetService(ctx context.Context, svcID string, p ListParams) ([]map[string]any, error) { + query, args := buildServicesQuery(p.Groups, p.IsManager, p.SelectExprs) + query += " AND (services.svc_id = ? OR services.svcname = ?)" + args = append(args, svcID, svcID) + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("getService: %w", err) + } + defer func() { _ = rows.Close() }() + + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} diff --git a/cdb/db_services_instances.go b/cdb/db_services_instances.go new file mode 100644 index 0000000..1284567 --- /dev/null +++ b/cdb/db_services_instances.go @@ -0,0 +1,80 @@ +package cdb + +import ( + "context" + "fmt" + + "github.com/opensvc/oc3/schema" +) + +func buildServicesInstancesQuery(groups []string, isManager bool, selectExprs []string) (string, []any) { + q := From(schema.TSvcmon). + Via(schema.TServices). + RawSelect(selectExprs...) + + if !isManager { + cleanGroups := cleanGroups(groups) + if len(cleanGroups) == 0 { + q = q.WhereRaw("1=0") + } else { + args := make([]any, len(cleanGroups)) + for i, g := range cleanGroups { + args[i] = g + } + q = q.WhereRaw( + "services.svc_app IN ("+ + "SELECT a.app FROM apps a"+ + " JOIN apps_responsibles ar ON ar.app_id = a.id"+ + " JOIN auth_group ag ON ag.id = ar.group_id"+ + " WHERE ag.role IN ("+Placeholders(len(cleanGroups))+")"+ + ")", + args..., + ) + } + } else { + q = q.Where(schema.SvcmonID, ">", 0) + } + + query, args, err := q.Build() + if err != nil { + panic(fmt.Sprintf("buildServicesInstancesQuery: %v", err)) + } + return query, args +} + +func (oDb *DB) GetServicesInstances(ctx context.Context, p ListParams) ([]map[string]any, error) { + query, args := buildServicesInstancesQuery(p.Groups, p.IsManager, p.SelectExprs) + if gb := p.GroupByClause(""); gb != "" { + query += " " + gb + } + query += " " + p.OrderByClause("svcmon.svc_id, svcmon.node_id") + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("getServicesInstances: %w", err) + } + defer func() { _ = rows.Close() }() + + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} + +// GetServicesInstance fetches all instances of a single service by svc_id (UUID) or svcname. +func (oDb *DB) GetServicesInstance(ctx context.Context, svcID string, p ListParams) ([]map[string]any, error) { + query, args := buildServicesInstancesQuery(p.Groups, p.IsManager, p.SelectExprs) + query += " AND (svcmon.svc_id = ? OR services.svcname = ?)" + args = append(args, svcID, svcID) + if gb := p.GroupByClause(""); gb != "" { + query += " " + gb + } + query += " " + p.OrderByClause("svcmon.node_id") + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("getServicesInstance: %w", err) + } + defer func() { _ = rows.Close() }() + + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} diff --git a/cdb/db_services_instances_status_log.go b/cdb/db_services_instances_status_log.go new file mode 100644 index 0000000..5e4187d --- /dev/null +++ b/cdb/db_services_instances_status_log.go @@ -0,0 +1,60 @@ +package cdb + +import ( + "context" + "fmt" + + "github.com/opensvc/oc3/schema" +) + +func buildServicesInstancesStatusLogQuery(groups []string, isManager bool, selectExprs []string) (string, []any) { + q := From(schema.TSvcmonLog). + Via(schema.TServices). + RawSelect(selectExprs...) + + if !isManager { + cleanGroups := cleanGroups(groups) + if len(cleanGroups) == 0 { + q = q.WhereRaw("1=0") + } else { + args := make([]any, len(cleanGroups)) + for i, g := range cleanGroups { + args[i] = g + } + q = q.WhereRaw( + "services.svc_app IN ("+ + "SELECT a.app FROM apps a"+ + " JOIN apps_responsibles ar ON ar.app_id = a.id"+ + " JOIN auth_group ag ON ag.id = ar.group_id"+ + " WHERE ag.role IN ("+Placeholders(len(cleanGroups))+")"+ + ")", + args..., + ) + } + } else { + q = q.Where(schema.SvcmonLogID, ">", 0) + } + + query, args, err := q.Build() + if err != nil { + panic(fmt.Sprintf("buildServicesInstancesStatusLogQuery: %v", err)) + } + return query, args +} + +func (oDb *DB) GetServicesInstancesStatusLog(ctx context.Context, p ListParams) ([]map[string]any, error) { + query, args := buildServicesInstancesStatusLogQuery(p.Groups, p.IsManager, p.SelectExprs) + if gb := p.GroupByClause(""); gb != "" { + query += " " + gb + } + query += " " + p.OrderByClause("svcmon_log.svc_id, svcmon_log.node_id, svcmon_log.mon_begin") + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("getServicesInstancesStatusLog: %w", err) + } + defer func() { _ = rows.Close() }() + + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} diff --git a/cdb/db_tags.go b/cdb/db_tags.go index 1818108..0603cd2 100644 --- a/cdb/db_tags.go +++ b/cdb/db_tags.go @@ -5,6 +5,9 @@ import ( "database/sql" "encoding/json" "fmt" + "strings" + + "github.com/opensvc/oc3/schema" ) type Tag struct { @@ -76,3 +79,310 @@ func (oDb *DB) GetTags(ctx context.Context, tagID *int, limit, offset int) ([]Ta return tags, nil } + +// GetTagNodes returns nodes where a tag (by integer id) is attached, with app-based auth. +func (oDb *DB) GetTagNodes(ctx context.Context, tagID int, p ListParams) ([]map[string]any, error) { + query, args := buildNodesQuery(p.Groups, p.IsManager, p.SelectExprs) + query += " AND nodes.node_id IN (SELECT node_id FROM node_tags WHERE node_tags.tag_id = (SELECT tag_id FROM tags WHERE id = ?))" + args = append(args, tagID) + if gb := p.GroupByClause(""); gb != "" { + query += " " + gb + } + query += " " + p.OrderByClause("nodes.nodename") + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("GetTagNodes: %w", err) + } + defer func() { _ = rows.Close() }() + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} + +// GetNodeTags returns tags attached to a node (identified by node_id UUID). +func (oDb *DB) GetNodeTags(ctx context.Context, nodeID string, p ListParams) ([]map[string]any, error) { + q := From(schema.TTags). + RawSelect(p.SelectExprs...). + WhereRaw("tags.tag_id IN (SELECT tag_id FROM node_tags WHERE node_id = ?)", nodeID) + q = applyNodeAppAuth(q, nodeID, p.Groups, p.IsManager) + query, args, err := q.Build() + if err != nil { + return nil, fmt.Errorf("GetNodeTags build: %w", err) + } + query += " " + p.OrderByClause("tags.tag_name") + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("GetNodeTags: %w", err) + } + defer func() { _ = rows.Close() }() + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} + +// GetServiceTags returns tags attached to a service (identified by svc_id UUID or svcname). +func (oDb *DB) GetServiceTags(ctx context.Context, svcID string, p ListParams) ([]map[string]any, error) { + q := From(schema.TTags). + RawSelect(p.SelectExprs...). + WhereRaw("tags.tag_id IN (SELECT tag_id FROM svc_tags WHERE svc_id = (SELECT svc_id FROM services WHERE svc_id = ? OR svcname = ? LIMIT 1))", svcID, svcID) + q = applySvcAppAuth(q, svcID, p.Groups, p.IsManager) + query, args, err := q.Build() + if err != nil { + return nil, fmt.Errorf("GetServiceTags build: %w", err) + } + query += " " + p.OrderByClause("tags.tag_name") + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("GetServiceTags: %w", err) + } + defer func() { _ = rows.Close() }() + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} + +// GetNodeCandidateTags returns tags not yet attached to the node and not excluded by existing tag rules. +func (oDb *DB) GetNodeCandidateTags(ctx context.Context, nodeID string, p ListParams) ([]map[string]any, error) { + type attachedTag struct { + TagID string + TagExclude sql.NullString + } + rowsAttached, err := oDb.DB.QueryContext(ctx, + "SELECT tags.tag_id, tags.tag_exclude FROM tags JOIN node_tags ON node_tags.tag_id = tags.tag_id WHERE node_tags.node_id = ?", + nodeID, + ) + if err != nil { + return nil, fmt.Errorf("GetNodeCandidateTags attached: %w", err) + } + defer func() { _ = rowsAttached.Close() }() + + var tagIDs []string + var excludePatterns []string + for rowsAttached.Next() { + var t attachedTag + if err := rowsAttached.Scan(&t.TagID, &t.TagExclude); err != nil { + return nil, fmt.Errorf("GetNodeCandidateTags scan: %w", err) + } + tagIDs = append(tagIDs, t.TagID) + if t.TagExclude.Valid && t.TagExclude.String != "" { + excludePatterns = append(excludePatterns, t.TagExclude.String) + } + } + if err := rowsAttached.Err(); err != nil { + return nil, fmt.Errorf("GetNodeCandidateTags rows: %w", err) + } + + q := From(schema.TTags).RawSelect(p.SelectExprs...).Where(schema.TagsID, ">", 0) + q = applyNodeAppAuth(q, nodeID, p.Groups, p.IsManager) + if len(tagIDs) > 0 { + q = q.WhereRaw("tags.tag_id NOT IN ("+Placeholders(len(tagIDs))+")", stringsToAny(tagIDs)...) + } + if len(excludePatterns) > 0 { + q = q.WhereRaw("tags.tag_name NOT REGEXP ?", strings.Join(excludePatterns, "|")) + } + query, args, err := q.Build() + if err != nil { + return nil, fmt.Errorf("GetNodeCandidateTags build: %w", err) + } + query += " " + p.OrderByClause("tags.tag_name") + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("GetNodeCandidateTags: %w", err) + } + defer func() { _ = rows.Close() }() + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} + +// GetServiceCandidateTags returns tags not yet attached to the service and not excluded by existing tag rules. +func (oDb *DB) GetServiceCandidateTags(ctx context.Context, svcID string, p ListParams) ([]map[string]any, error) { + type attachedTag struct { + TagID string + TagExclude sql.NullString + } + rowsAttached, err := oDb.DB.QueryContext(ctx, + "SELECT tags.tag_id, tags.tag_exclude FROM tags JOIN svc_tags ON svc_tags.tag_id = tags.tag_id"+ + " JOIN services ON services.svc_id = svc_tags.svc_id WHERE services.svc_id = ? OR services.svcname = ?", + svcID, svcID, + ) + if err != nil { + return nil, fmt.Errorf("GetServiceCandidateTags attached: %w", err) + } + defer func() { _ = rowsAttached.Close() }() + + var tagIDs []string + var excludePatterns []string + for rowsAttached.Next() { + var t attachedTag + if err := rowsAttached.Scan(&t.TagID, &t.TagExclude); err != nil { + return nil, fmt.Errorf("GetServiceCandidateTags scan: %w", err) + } + tagIDs = append(tagIDs, t.TagID) + if t.TagExclude.Valid && t.TagExclude.String != "" { + excludePatterns = append(excludePatterns, t.TagExclude.String) + } + } + if err := rowsAttached.Err(); err != nil { + return nil, fmt.Errorf("GetServiceCandidateTags rows: %w", err) + } + + q := From(schema.TTags).RawSelect(p.SelectExprs...).Where(schema.TagsID, ">", 0) + q = applySvcAppAuth(q, svcID, p.Groups, p.IsManager) + if len(tagIDs) > 0 { + q = q.WhereRaw("tags.tag_id NOT IN ("+Placeholders(len(tagIDs))+")", stringsToAny(tagIDs)...) + } + if len(excludePatterns) > 0 { + q = q.WhereRaw("tags.tag_name NOT REGEXP ?", strings.Join(excludePatterns, "|")) + } + query, args, err := q.Build() + if err != nil { + return nil, fmt.Errorf("GetServiceCandidateTags build: %w", err) + } + query += " " + p.OrderByClause("tags.tag_name") + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("GetServiceCandidateTags: %w", err) + } + defer func() { _ = rows.Close() }() + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} + +// GetTagServices returns services where a tag (by integer id) is attached, with app-based auth. +func (oDb *DB) GetTagServices(ctx context.Context, tagID int, p ListParams) ([]map[string]any, error) { + query, args := buildServicesQuery(p.Groups, p.IsManager, p.SelectExprs) + query += " AND services.svc_id IN (SELECT svc_id FROM svc_tags WHERE svc_tags.tag_id = (SELECT tag_id FROM tags WHERE id = ?))" + args = append(args, tagID) + if gb := p.GroupByClause(""); gb != "" { + query += " " + gb + } + query += " " + p.OrderByClause("services.svcname") + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("GetTagServices: %w", err) + } + defer func() { _ = rows.Close() }() + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} + +// GetTagsNodes returns all node_tag attachment records with node app-based auth. +func (oDb *DB) GetTagsNodes(ctx context.Context, p ListParams) ([]map[string]any, error) { + q := From(schema.TNodeTags).RawSelect(p.SelectExprs...) + if !p.IsManager { + cleanG := cleanGroups(p.Groups) + if len(cleanG) == 0 { + q = q.WhereRaw("1=0") + } else { + gArgs := stringsToAny(cleanG) + q = q.WhereRaw( + "node_tags.node_id IN (SELECT n.node_id FROM nodes n WHERE n.app IN ("+ + "SELECT a.app FROM apps a"+ + " JOIN apps_responsibles ar ON ar.app_id = a.id"+ + " JOIN auth_group ag ON ag.id = ar.group_id"+ + " WHERE ag.role IN ("+Placeholders(len(cleanG))+")))", + gArgs..., + ) + } + } else { + q = q.Where(schema.NodeTagsID, ">", 0) + } + query, args, err := q.Build() + if err != nil { + return nil, fmt.Errorf("GetTagsNodes build: %w", err) + } + if gb := p.GroupByClause(""); gb != "" { + query += " " + gb + } + query += " " + p.OrderByClause("node_tags.id") + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("GetTagsNodes: %w", err) + } + defer func() { _ = rows.Close() }() + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} + +// GetTagsServices returns all svc_tag attachment records with service app-based auth. +func (oDb *DB) GetTagsServices(ctx context.Context, p ListParams) ([]map[string]any, error) { + q := From(schema.TSvcTags).RawSelect(p.SelectExprs...) + if !p.IsManager { + cleanG := cleanGroups(p.Groups) + if len(cleanG) == 0 { + q = q.WhereRaw("1=0") + } else { + gArgs := stringsToAny(cleanG) + q = q.WhereRaw( + "svc_tags.svc_id IN (SELECT s.svc_id FROM services s WHERE s.svc_app IN ("+ + "SELECT a.app FROM apps a"+ + " JOIN apps_responsibles ar ON ar.app_id = a.id"+ + " JOIN auth_group ag ON ag.id = ar.group_id"+ + " WHERE ag.role IN ("+Placeholders(len(cleanG))+")))", + gArgs..., + ) + } + } else { + q = q.Where(schema.SvcTagsID, ">", 0) + } + query, args, err := q.Build() + if err != nil { + return nil, fmt.Errorf("GetTagsServices build: %w", err) + } + if gb := p.GroupByClause(""); gb != "" { + query += " " + gb + } + query += " " + p.OrderByClause("svc_tags.id") + query, args = appendLimitOffset(query, args, p.Limit, p.Offset) + rows, err := oDb.DB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("GetTagsServices: %w", err) + } + defer func() { _ = rows.Close() }() + return scanRowsToMaps(rows, p.Props, p.TypeHints) +} + +// applyNodeAppAuth adds a WHERE condition ensuring the node's app is accessible to the user's groups. +func applyNodeAppAuth(q *Query, nodeID string, groups []string, isManager bool) *Query { + if isManager { + return q + } + cleanG := cleanGroups(groups) + if len(cleanG) == 0 { + return q.WhereRaw("1=0") + } + gArgs := stringsToAny(cleanG) + return q.WhereRaw( + "EXISTS (SELECT 1 FROM nodes n WHERE n.node_id = ? AND n.app IN ("+ + "SELECT a.app FROM apps a"+ + " JOIN apps_responsibles ar ON ar.app_id = a.id"+ + " JOIN auth_group ag ON ag.id = ar.group_id"+ + " WHERE ag.role IN ("+Placeholders(len(cleanG))+")))", + append([]any{nodeID}, gArgs...)..., + ) +} + +// applySvcAppAuth adds a WHERE condition ensuring the service's app is accessible to the user's groups. +func applySvcAppAuth(q *Query, svcID string, groups []string, isManager bool) *Query { + if isManager { + return q + } + cleanG := cleanGroups(groups) + if len(cleanG) == 0 { + return q.WhereRaw("1=0") + } + gArgs := stringsToAny(cleanG) + return q.WhereRaw( + "EXISTS (SELECT 1 FROM services s WHERE (s.svc_id = ? OR s.svcname = ?) AND s.svc_app IN ("+ + "SELECT a.app FROM apps a"+ + " JOIN apps_responsibles ar ON ar.app_id = a.id"+ + " JOIN auth_group ag ON ag.id = ar.group_id"+ + " WHERE ag.role IN ("+Placeholders(len(cleanG))+")))", + append([]any{svcID, svcID}, gArgs...)..., + ) +} + +func stringsToAny(ss []string) []any { + out := make([]any, len(ss)) + for i, s := range ss { + out[i] = s + } + return out +} diff --git a/cdb/list_params.go b/cdb/list_params.go new file mode 100644 index 0000000..2ba6418 --- /dev/null +++ b/cdb/list_params.go @@ -0,0 +1,34 @@ +package cdb + +import "strings" + +// ListParams bundles the standard query parameters shared by all list endpoints. +// Groups and IsManager encode the caller's access control context. +type ListParams struct { + Groups []string + IsManager bool + Limit int + Offset int + Props []string + SelectExprs []string + TypeHints map[string]string // Used by scanRowsToMaps to convert []byte driver values to the correct type + OrderBy []string + GroupBy []string +} + +func (p ListParams) OrderByClause(defaultClause string) string { + if len(p.OrderBy) == 0 { + return "ORDER BY " + defaultClause + } + return "ORDER BY " + strings.Join(p.OrderBy, ", ") +} + +func (p ListParams) GroupByClause(defaultClause string) string { + if len(p.GroupBy) > 0 { + return "GROUP BY " + strings.Join(p.GroupBy, ", ") + } + if defaultClause != "" { + return "GROUP BY " + defaultClause + } + return "" +} diff --git a/cdb/qb.go b/cdb/qb.go new file mode 100644 index 0000000..25ac264 --- /dev/null +++ b/cdb/qb.go @@ -0,0 +1,314 @@ +// Package cdb - query builder +// +// Lightweight SQL query builder with automatic JOIN resolution based on the FK +// relationships declared in schema/relations.go. +// +// # Basic usage +// +// sql, args, err := From(schema.TApps). +// Select(schema.AppsID, schema.AppsApp). +// Where(schema.AppsID, ">", 0). +// Build() +// +// # Automatic JOIN resolution +// +// When a selected column belongs to a table other than the FROM table, the +// builder resolves the required JOINs automatically by walking the Ref chain +// declared in schema/relations.go: +// +// sql, args, err := From(schema.TAuthGroup). +// Select(schema.AuthGroupID, schema.AuthGroupRole). +// Via(schema.TAppsResponsibles). // disambiguates: apps_responsibles vs apps_publications +// Where(schema.AppsResponsiblesAppID, "=", appID). +// Build() +// // → SELECT auth_group.id, auth_group.role +// // FROM auth_group +// // JOIN apps_responsibles ON apps_responsibles.group_id = auth_group.id +// // WHERE apps_responsibles.app_id = ? +// +// # Ambiguity and Via() +// +// When multiple FK paths connect the FROM table to a needed table, Build() +// returns an error. Use Via() to specify the intermediate table(s) that +// disambiguate the path: +// +// // Error: both apps_responsibles and apps_publications connect apps to auth_group +// From(schema.TApps).Select(schema.AuthGroupRole).Build() +// +// // OK: path is explicit +// From(schema.TApps).Select(schema.AuthGroupRole).Via(schema.TAppsResponsibles).Build() +package cdb + +import ( + "fmt" + "strings" + + "github.com/opensvc/oc3/schema" +) + +// joinStep describes one JOIN clause to add to the query. +type joinStep struct { + newTable *schema.Table // table being joined + left *schema.Col // left side of the ON condition + right *schema.Col // right side of the ON condition + leftJoin bool // true → LEFT OUTER JOIN, false → INNER JOIN +} + +func (j joinStep) sql() string { + keyword := "JOIN" + if j.leftJoin { + keyword = "LEFT JOIN" + } + return fmt.Sprintf("%s %s ON %s = %s", keyword, j.newTable.Name, j.left.Qualified(), j.right.Qualified()) +} + +// condition holds a WHERE clause fragment and its bound arguments. +type condition struct { + col *schema.Col // used for JOIN resolution; nil for raw conditions + expr string + args []any +} + +// Query builds a SQL SELECT statement. +type Query struct { + from *schema.Table + selects []*schema.Col + rawSelects []string // raw SQL expressions (e.g. "COALESCE(apps.updated, '')") + via []*schema.Table // explicit intermediate tables for join disambiguation + leftJoins []*schema.Table // tables that must be joined with LEFT JOIN + wheres []condition + distinct bool +} + +// From starts a new query against the given table. +func From(t *schema.Table) *Query { + return &Query{from: t} +} + +// Distinct adds the DISTINCT keyword to the SELECT clause. +func (q *Query) Distinct() *Query { + q.distinct = true + return q +} + +// Select adds columns to the SELECT clause. +// Columns from tables other than the FROM table trigger automatic JOIN resolution. +func (q *Query) Select(cols ...*schema.Col) *Query { + q.selects = append(q.selects, cols...) + return q +} + +// RawSelect adds raw SQL expressions to the SELECT clause (e.g. "COALESCE(apps.updated, ")"). +// These are emitted verbatim and do not participate in JOIN resolution. +// Use Select() for typed column references whenever possible. +func (q *Query) RawSelect(exprs ...string) *Query { + q.rawSelects = append(q.rawSelects, exprs...) + return q +} + +// Via declares intermediate tables required to resolve ambiguous join paths. +// Use it when Build() returns an ambiguity error. +func (q *Query) Via(tables ...*schema.Table) *Query { + q.via = append(q.via, tables...) + return q +} + +// LeftJoin declares tables that must be joined with LEFT JOIN instead of INNER JOIN. +// Use it when rows from the FROM table should be preserved even if the joined +// table has no matching row (optional relationship). +// These tables are also added to the set of needed tables, so Via() is not required +// unless the path is ambiguous. +func (q *Query) LeftJoin(tables ...*schema.Table) *Query { + q.leftJoins = append(q.leftJoins, tables...) + q.via = append(q.via, tables...) + return q +} + +// Where adds a "col op ?" condition to the WHERE clause. +// If the column belongs to a table not yet reachable, add it via Via(). +func (q *Query) Where(col *schema.Col, op string, val any) *Query { + q.wheres = append(q.wheres, condition{ + col: col, + expr: fmt.Sprintf("%s %s ?", col.Qualified(), op), + args: []any{val}, + }) + return q +} + +// WhereRaw adds a raw SQL condition to the WHERE clause. +// The expression is emitted verbatim; args are bound in order. +// Use for subqueries or expressions that cannot be expressed with Where/WhereIn. +func (q *Query) WhereRaw(expr string, args ...any) *Query { + q.wheres = append(q.wheres, condition{expr: expr, args: args}) + return q +} + +// WhereIn adds a "col IN (?,...)" condition. Produces "1=0" for an empty slice. +func (q *Query) WhereIn(col *schema.Col, vals []string) *Query { + if len(vals) == 0 { + q.wheres = append(q.wheres, condition{expr: "1=0"}) + return q + } + ph := strings.Repeat("?,", len(vals)) + args := make([]any, len(vals)) + for i, v := range vals { + args[i] = v + } + q.wheres = append(q.wheres, condition{ + col: col, + expr: fmt.Sprintf("%s IN (%s)", col.Qualified(), ph[:len(ph)-1]), + args: args, + }) + return q +} + +// Build assembles the SQL query and its bound arguments. +// Returns an error if a required JOIN path is ambiguous or unreachable. +func (q *Query) Build() (string, []any, error) { + if len(q.selects) == 0 && len(q.rawSelects) == 0 { + return "", nil, fmt.Errorf("qb: no columns selected") + } + + // Collect tables that need to be joined (SELECT + WHERE columns + Via hints). + needed := map[*schema.Table]bool{} + for _, col := range q.selects { + if col.T != q.from { + needed[col.T] = true + } + } + for _, w := range q.wheres { + if w.col != nil && w.col.T != q.from { + needed[w.col.T] = true + } + } + for _, t := range q.via { + if t != q.from { + needed[t] = true + } + } + + // Build the LEFT JOIN set for resolveJoins. + leftJoinSet := make(map[*schema.Table]bool, len(q.leftJoins)) + for _, t := range q.leftJoins { + leftJoinSet[t] = true + } + + joins, err := resolveJoins(q.from, needed, leftJoinSet) + if err != nil { + return "", nil, err + } + + // SELECT + fields := make([]string, 0, len(q.selects)+len(q.rawSelects)) + for _, c := range q.selects { + fields = append(fields, c.Qualified()) + } + fields = append(fields, q.rawSelects...) + + keyword := "SELECT" + if q.distinct { + keyword = "SELECT DISTINCT" + } + sb := &strings.Builder{} + fmt.Fprintf(sb, "%s %s\nFROM %s", keyword, strings.Join(fields, ", "), q.from.Name) + + for _, j := range joins { + fmt.Fprintf(sb, "\n%s", j.sql()) + } + + var args []any + if len(q.wheres) > 0 { + parts := make([]string, len(q.wheres)) + for i, w := range q.wheres { + parts[i] = w.expr + args = append(args, w.args...) + } + fmt.Fprintf(sb, "\nWHERE %s", strings.Join(parts, "\n AND ")) + } + + return sb.String(), args, nil +} + +// resolveJoins computes the ordered list of JOIN steps needed to reach all +// tables in `needed` starting from `from`. +// +// It supports FK traversal in both directions: +// - parent → child : col.Ref.T is joined, col.T is needed +// → JOIN col.T ON col.Qualified() = col.Ref.Qualified() +// - child → parent : col.T is joined, col.Ref.T is needed +// → JOIN col.Ref.T ON col.Ref.Qualified() = col.Qualified() +// +// If multiple FK paths lead to the same needed table in the same iteration, +// an ambiguity error is returned. Use Via() to add intermediate tables to +// `needed` and force a specific path. +func resolveJoins(from *schema.Table, needed map[*schema.Table]bool, leftJoinSet map[*schema.Table]bool) ([]joinStep, error) { + if len(needed) == 0 { + return nil, nil + } + + joined := map[*schema.Table]bool{from: true} + remaining := make(map[*schema.Table]bool, len(needed)) + for t := range needed { + remaining[t] = true + } + + var steps []joinStep + + for len(remaining) > 0 { + // Collect all candidates found in this pass (detect ambiguity). + type candidate struct { + step joinStep + } + found := map[*schema.Table][]joinStep{} + + for _, col := range schema.AllCols { + if col.Ref == nil { + continue + } + // Direction 1: parent already joined → join child + if joined[col.Ref.T] && !joined[col.T] && remaining[col.T] { + found[col.T] = append(found[col.T], joinStep{ + newTable: col.T, + left: col, + right: col.Ref, + leftJoin: leftJoinSet[col.T], + }) + } + // Direction 2: child already joined → join parent + if joined[col.T] && !joined[col.Ref.T] && remaining[col.Ref.T] { + found[col.Ref.T] = append(found[col.Ref.T], joinStep{ + newTable: col.Ref.T, + left: col.Ref, + right: col, + leftJoin: leftJoinSet[col.Ref.T], + }) + } + } + + if len(found) == 0 { + names := make([]string, 0, len(remaining)) + for t := range remaining { + names = append(names, fmt.Sprintf("%q", t.Name)) + } + return nil, fmt.Errorf("qb: no FK path from %q to [%s]; add the intermediate table(s) with Via()", + from.Name, strings.Join(names, ", ")) + } + + for table, candidates := range found { + if len(candidates) > 1 { + paths := make([]string, len(candidates)) + for i, c := range candidates { + paths[i] = fmt.Sprintf("%s.%s", c.left.T.Name, c.left.Name) + } + return nil, fmt.Errorf("qb: ambiguous join path to %q from %q (candidates: %s); use Via() to pick one", + table.Name, from.Name, strings.Join(paths, ", ")) + } + step := candidates[0] + joined[table] = true + delete(remaining, table) + steps = append(steps, step) + } + } + + return steps, nil +} diff --git a/cdb/util.go b/cdb/util.go index 918b994..29845c7 100644 --- a/cdb/util.go +++ b/cdb/util.go @@ -5,6 +5,8 @@ import ( "errors" "fmt" "log/slog" + "strconv" + "strings" "time" ) @@ -31,6 +33,104 @@ func checkRow[T any](err error, valid bool, value T) (T, bool, error) { } } +// converts a raw value to the Go type indicated by kind. +func convertTyped(v any, kind string) any { + b, ok := v.([]byte) + if !ok { + return v + } + s := string(b) + switch kind { + case "int64": + n, err := strconv.ParseInt(s, 10, 64) + if err != nil { + return s + } + return n + case "float64": + f, err := strconv.ParseFloat(s, 64) + if err != nil { + return s + } + return f + default: + return s + } +} + +// Scans SQL rows into a slice of maps keyed by prop name. +func scanRowsToMaps(rows interface { + Next() bool + Scan(...any) error + Err() error +}, props []string, typeHints ...map[string]string) ([]map[string]any, error) { + var hints map[string]string + if len(typeHints) > 0 { + hints = typeHints[0] + } + results := make([]map[string]any, 0) + for rows.Next() { + ptrs := make([]any, len(props)) + vals := make([]any, len(props)) + for i := range ptrs { + ptrs[i] = &vals[i] + } + if err := rows.Scan(ptrs...); err != nil { + return nil, fmt.Errorf("scanRowsToMaps: %w", err) + } + row := make(map[string]any, len(props)) + for i, prop := range props { + row[prop] = convertTyped(vals[i], hints[prop]) + } + results = append(results, row) + } + if err := rows.Err(); err != nil { + return nil, fmt.Errorf("scanRowsToMaps rows: %w", err) + } + return results, nil +} + +// Scans SQL rows into a slice of nested maps. +func scanRowsToNestedMaps(rows interface { + Next() bool + Scan(...any) error + Err() error +}, props []string, primaryTable string) ([]map[string]any, error) { + results := make([]map[string]any, 0) + for rows.Next() { + ptrs := make([]any, len(props)) + vals := make([]any, len(props)) + for i := range ptrs { + ptrs[i] = &vals[i] + } + if err := rows.Scan(ptrs...); err != nil { + return nil, fmt.Errorf("scanRowsToNestedMaps: %w", err) + } + row := make(map[string]any) + for i, prop := range props { + var val any + if b, ok := vals[i].([]byte); ok { + val = string(b) + } else { + val = vals[i] + } + table, col, found := strings.Cut(prop, ".") + if !found { + table, col = primaryTable, prop + } + if row[table] == nil { + row[table] = make(map[string]any) + } + row[table].(map[string]any)[col] = val + } + results = append(results, row) + } + if err := rows.Err(); err != nil { + return nil, fmt.Errorf("scanRowsToNestedMaps rows: %w", err) + } + return results, nil +} + func appendLimitOffset(query string, args []any, limit, offset int) (string, []any) { if limit > 0 { query += " LIMIT ? OFFSET ?" diff --git a/cmd/server.go b/cmd/server.go index 7371b87..e73f525 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -53,6 +53,7 @@ func (t *server) docMiddleware() echo.MiddlewareFunc { func (t *server) authMiddleware(publicPath, publicPrefix []string) echo.MiddlewareFunc { return handlers.AuthMiddleware(union.New( xauth.NewPublicStrategy(publicPath, publicPrefix), + xauth.NewAnonRegister(), xauth.NewBasicWeb2py(t.db, viper.GetString("w2p_hmac")), xauth.NewBasicNode(t.db), )) diff --git a/schema/gen/main.go b/schema/gen/main.go new file mode 100644 index 0000000..e67540e --- /dev/null +++ b/schema/gen/main.go @@ -0,0 +1,216 @@ +// schema/gen generates the schema package from a columns.txt export. +// +// # Generate columns.txt from MariaDB +// +// mysql -u -p -e " +// SELECT TABLE_NAME, COLUMN_NAME, COLUMN_TYPE, IS_NULLABLE +// FROM information_schema.COLUMNS +// WHERE TABLE_SCHEMA = '' +// ORDER BY TABLE_NAME, ORDINAL_POSITION;" > columns.txt +// +// # Regenerate schema/tables.go +// +// go run ./schema/gen columns.txt schema/tables.go +// +// # Exclude tables +// +// Pass --exclude with a file listing tables to skip (one per line, # for comments): +// +// go run ./schema/gen --exclude exclude.txt columns.txt schema/tables.go +package main + +import ( + "bufio" + "flag" + "fmt" + "os" + "strings" + "unicode" +) + +type column struct { + table string + name string + dbType string + nullable bool +} + +func main() { + excludeFile := flag.String("exclude", "", "file listing tables to exclude (one per line, # for comments)") + flag.Usage = func() { + fmt.Fprintln(os.Stderr, "usage: schema/gen [--exclude exclude.txt] ") + flag.PrintDefaults() + } + flag.Parse() + + if flag.NArg() != 2 { + flag.Usage() + os.Exit(1) + } + + excluded := loadExcludeList(*excludeFile) + cols, tables := parse(flag.Arg(0), excluded) + + f, err := os.Create(flag.Arg(1)) + if err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + } + defer f.Close() + + w := bufio.NewWriter(f) + emit(w, cols, tables) + w.Flush() +} + +// loadExcludeList reads a file of table names to exclude (one per line, # for comments). +// Returns an empty map if path is empty. +func loadExcludeList(path string) map[string]bool { + excluded := map[string]bool{} + if path == "" { + return excluded + } + f, err := os.Open(path) + if err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + } + defer f.Close() + + scanner := bufio.NewScanner(f) + for scanner.Scan() { + line := strings.TrimSpace(scanner.Text()) + if line == "" || strings.HasPrefix(line, "#") { + continue + } + excluded[line] = true + } + return excluded +} + +// parse reads columns.txt and returns columns + ordered table list (no views, no excluded tables). +func parse(path string, excluded map[string]bool) ([]column, []string) { + f, err := os.Open(path) + if err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + } + defer f.Close() + + var cols []column + seen := map[string]bool{} + var tables []string + + scanner := bufio.NewScanner(f) + for scanner.Scan() { + line := scanner.Text() + parts := strings.Split(line, "\t") + if len(parts) < 4 { + continue + } + tbl := parts[0] + col := parts[1] + typ := parts[2] + nullable := parts[3] == "YES" + + // skip header, views, and explicitly excluded tables + if tbl == "TABLE_NAME" || strings.HasPrefix(tbl, "v_") || excluded[tbl] { + continue + } + + if !seen[tbl] { + seen[tbl] = true + tables = append(tables, tbl) + } + cols = append(cols, column{tbl, col, typ, nullable}) + } + return cols, tables +} + +func emit(w *bufio.Writer, cols []column, tables []string) { + fmt.Fprintln(w, "// Code generated by schema/gen. DO NOT EDIT.") + fmt.Fprintln(w, "// Regenerate with: go run ./schema/gen columns.txt schema/tables.go") + fmt.Fprintln(w, "") + fmt.Fprintln(w, "package schema") + fmt.Fprintln(w, "") + + // Table vars + fmt.Fprintln(w, "// Tables") + fmt.Fprintln(w, "var (") + for _, t := range tables { + fmt.Fprintf(w, "\t%s = &Table{Name: %q}\n", tableVar(t), t) + } + fmt.Fprintln(w, ")") + fmt.Fprintln(w, "") + + // Column vars, grouped by table + for _, t := range tables { + fmt.Fprintf(w, "// Columns of %s\n", t) + fmt.Fprintln(w, "var (") + for _, c := range cols { + if c.table != t { + continue + } + fmt.Fprintf(w, "\t%s = &Col{T: %s, Name: %q, Nullable: %v}\n", + colVar(c.table, c.name), tableVar(t), c.name, c.nullable) + } + fmt.Fprintln(w, ")") + fmt.Fprintln(w, "") + } + + // AllCols registry — used by the query builder for join resolution + fmt.Fprintln(w, "// AllCols is the full column registry used for join resolution.") + fmt.Fprintln(w, "var AllCols = []*Col{") + for _, c := range cols { + fmt.Fprintf(w, "\t%s,\n", colVar(c.table, c.name)) + } + fmt.Fprintln(w, "}") +} + +// tableVar returns the Go variable name for a table: "nodes" → "TNodes". +func tableVar(table string) string { + return "T" + pascal(table) +} + +// colVar returns the Go variable name for a column: ("nodes","node_id") → "NodesNodeID". +func colVar(table, col string) string { + return pascal(table) + pascal(col) +} + +// pascal converts snake_case to PascalCase, with common acronym handling. +func pascal(s string) string { + parts := strings.Split(s, "_") + var b strings.Builder + for _, p := range parts { + if len(p) == 0 { + continue + } + up := strings.ToUpper(p) + if acronyms[up] { + b.WriteString(up) + } else { + runes := []rune(p) + runes[0] = unicode.ToUpper(runes[0]) + b.WriteString(string(runes)) + } + } + return b.String() +} + +// acronyms lists abbreviations that should stay fully uppercase. +var acronyms = map[string]bool{ + "ID": true, + "IP": true, + "URL": true, + "CPU": true, + "MEM": true, + "OS": true, + "FK": true, + "MD5": true, + "HBA": true, + "SAN": true, + "DRP": true, + "DG": true, + "PW": true, + "HW": true, +} diff --git a/schema/relations.go b/schema/relations.go new file mode 100644 index 0000000..1d0e0d7 --- /dev/null +++ b/schema/relations.go @@ -0,0 +1,19 @@ +package schema + +func init() { + AppsPublicationsAppID.Ref = AppsID + AppsPublicationsGroupID.Ref = AuthGroupID + AppsResponsiblesAppID.Ref = AppsID + AppsResponsiblesGroupID.Ref = AuthGroupID + + SvcdisksDiskID.Ref = DiskinfoDiskID + SvcdisksNodeID.Ref = NodesNodeID + SvcdisksSvcID.Ref = ServicesSvcID + + ServicesSvcApp.Ref = AppsApp + + NodeIPNodeID.Ref = NodesNodeID + + SvcmonSvcID.Ref = ServicesSvcID + SvcmonLogSvcID.Ref = ServicesSvcID +} diff --git a/schema/schema.go b/schema/schema.go new file mode 100644 index 0000000..893390c --- /dev/null +++ b/schema/schema.go @@ -0,0 +1,21 @@ +package schema + +// Table represents a database table. +type Table struct { + Name string +} + +// Col represents a column in a table. +type Col struct { + T *Table + Name string + Nullable bool + // Ref is set in relations.go for FK relationships. + // It points to the referenced column (e.g. NodesAppID.Ref = AppsID). + Ref *Col +} + +// Qualified returns "table.column" for use in SQL queries. +func (c *Col) Qualified() string { + return c.T.Name + "." + c.Name +} diff --git a/schema/tables.go b/schema/tables.go new file mode 100644 index 0000000..718207c --- /dev/null +++ b/schema/tables.go @@ -0,0 +1,3174 @@ +// Code generated by schema/gen. DO NOT EDIT. +// Regenerate with: go run ./schema/gen columns.txt schema/tables.go + +package schema + +// Tables +var ( + TActionQueue = &Table{Name: "action_queue"} + TAlerts = &Table{Name: "alerts"} + TAlertsSent = &Table{Name: "alerts_sent"} + TApps = &Table{Name: "apps"} + TAppsImport = &Table{Name: "apps_import"} + TAppsPublications = &Table{Name: "apps_publications"} + TAppsResponsibles = &Table{Name: "apps_responsibles"} + TAuthEvent = &Table{Name: "auth_event"} + TAuthFilters = &Table{Name: "auth_filters"} + TAuthGroup = &Table{Name: "auth_group"} + TAuthMembership = &Table{Name: "auth_membership"} + TAuthNode = &Table{Name: "auth_node"} + TAuthPermission = &Table{Name: "auth_permission"} + TAuthUser = &Table{Name: "auth_user"} + TBActionErrors = &Table{Name: "b_action_errors"} + TBAppsOld = &Table{Name: "b_apps_old"} + TCharts = &Table{Name: "charts"} + TChartTeamPublication = &Table{Name: "chart_team_publication"} + TChartTeamResponsible = &Table{Name: "chart_team_responsible"} + TChecksDefaults = &Table{Name: "checks_defaults"} + TChecksLive = &Table{Name: "checks_live"} + TChecksSettings = &Table{Name: "checks_settings"} + TClusters = &Table{Name: "clusters"} + TCompLog = &Table{Name: "comp_log"} + TCompLogDaily = &Table{Name: "comp_log_daily"} + TCompModuleset = &Table{Name: "comp_moduleset"} + TCompModulesetsServices = &Table{Name: "comp_modulesets_services"} + TCompModulesetModules = &Table{Name: "comp_moduleset_modules"} + TCompModulesetModuleset = &Table{Name: "comp_moduleset_moduleset"} + TCompModulesetRuleset = &Table{Name: "comp_moduleset_ruleset"} + TCompModulesetTeamPublication = &Table{Name: "comp_moduleset_team_publication"} + TCompModulesetTeamResponsible = &Table{Name: "comp_moduleset_team_responsible"} + TCompModStatus = &Table{Name: "comp_mod_status"} + TCompNodeModuleset = &Table{Name: "comp_node_moduleset"} + TCompNodeStatus = &Table{Name: "comp_node_status"} + TCompRulesets = &Table{Name: "comp_rulesets"} + TCompRulesetsChains = &Table{Name: "comp_rulesets_chains"} + TCompRulesetsFiltersets = &Table{Name: "comp_rulesets_filtersets"} + TCompRulesetsNodes = &Table{Name: "comp_rulesets_nodes"} + TCompRulesetsRulesets = &Table{Name: "comp_rulesets_rulesets"} + TCompRulesetsServices = &Table{Name: "comp_rulesets_services"} + TCompRulesetsVariables = &Table{Name: "comp_rulesets_variables"} + TCompRulesetTeamPublication = &Table{Name: "comp_ruleset_team_publication"} + TCompRulesetTeamResponsible = &Table{Name: "comp_ruleset_team_responsible"} + TCompRunRuleset = &Table{Name: "comp_run_ruleset"} + TCompStatus = &Table{Name: "comp_status"} + TCompSvcStatus = &Table{Name: "comp_svc_status"} + TDashboard = &Table{Name: "dashboard"} + TDashboardEvents = &Table{Name: "dashboard_events"} + TDashboardRef = &Table{Name: "dashboard_ref"} + TDigit = &Table{Name: "digit"} + TDiskinfo = &Table{Name: "diskinfo"} + TDiskBlacklist = &Table{Name: "disk_blacklist"} + TDockerRegistries = &Table{Name: "docker_registries"} + TDockerRegistriesPublications = &Table{Name: "docker_registries_publications"} + TDockerRegistriesResponsibles = &Table{Name: "docker_registries_responsibles"} + TDockerRepositories = &Table{Name: "docker_repositories"} + TDockerTags = &Table{Name: "docker_tags"} + TDrpprojects = &Table{Name: "drpprojects"} + TDrpservices = &Table{Name: "drpservices"} + TFeedQueue = &Table{Name: "feed_queue"} + TFeedQueueStats = &Table{Name: "feed_queue_stats"} + TFilters = &Table{Name: "filters"} + TForms = &Table{Name: "forms"} + TFormsRevisions = &Table{Name: "forms_revisions"} + TFormsStore = &Table{Name: "forms_store"} + TFormsTeamPublication = &Table{Name: "forms_team_publication"} + TFormsTeamResponsible = &Table{Name: "forms_team_responsible"} + TFormOutputResults = &Table{Name: "form_output_results"} + TFsetCache = &Table{Name: "fset_cache"} + TGenFilters = &Table{Name: "gen_filters"} + TGenFiltersets = &Table{Name: "gen_filtersets"} + TGenFiltersetsFilters = &Table{Name: "gen_filtersets_filters"} + TGenFiltersetCheckThreshold = &Table{Name: "gen_filterset_check_threshold"} + TGenFiltersetTeamResponsible = &Table{Name: "gen_filterset_team_responsible"} + TGenFiltersetUser = &Table{Name: "gen_filterset_user"} + TGroupHiddenMenuEntries = &Table{Name: "group_hidden_menu_entries"} + THbmon = &Table{Name: "hbmon"} + THbmonLog = &Table{Name: "hbmon_log"} + THbmonLogLast = &Table{Name: "hbmon_log_last"} + TImTypes = &Table{Name: "im_types"} + TLifecycleOS = &Table{Name: "lifecycle_os"} + TLinks = &Table{Name: "links"} + TLog = &Table{Name: "log"} + TMetrics = &Table{Name: "metrics"} + TMetricTeamPublication = &Table{Name: "metric_team_publication"} + TNetworks = &Table{Name: "networks"} + TNetworkSegments = &Table{Name: "network_segments"} + TNetworkSegmentResponsibles = &Table{Name: "network_segment_responsibles"} + TNodes = &Table{Name: "nodes"} + TNodeGroups = &Table{Name: "node_groups"} + TNodeHBA = &Table{Name: "node_hba"} + TNodeHW = &Table{Name: "node_hw"} + TNodeIP = &Table{Name: "node_ip"} + TNodePW = &Table{Name: "node_pw"} + TNodeTags = &Table{Name: "node_tags"} + TNodeUsers = &Table{Name: "node_users"} + TObsolescence = &Table{Name: "obsolescence"} + TOc3Scheduler = &Table{Name: "oc3_scheduler"} + TPackages = &Table{Name: "packages"} + TPatches = &Table{Name: "patches"} + TPkgSigProvider = &Table{Name: "pkg_sig_provider"} + TProvTemplates = &Table{Name: "prov_templates"} + TProvTemplateTeamPublication = &Table{Name: "prov_template_team_publication"} + TProvTemplateTeamResponsible = &Table{Name: "prov_template_team_responsible"} + TReplicationStatus = &Table{Name: "replication_status"} + TReports = &Table{Name: "reports"} + TReportsUser = &Table{Name: "reports_user"} + TReportTeamPublication = &Table{Name: "report_team_publication"} + TReportTeamResponsible = &Table{Name: "report_team_responsible"} + TResinfo = &Table{Name: "resinfo"} + TResmon = &Table{Name: "resmon"} + TResmonLog = &Table{Name: "resmon_log"} + TResmonLogLast = &Table{Name: "resmon_log_last"} + TSafe = &Table{Name: "safe"} + TSafeLog = &Table{Name: "safe_log"} + TSafeTeamPublication = &Table{Name: "safe_team_publication"} + TSafeTeamResponsible = &Table{Name: "safe_team_responsible"} + TSANZone = &Table{Name: "san_zone"} + TSANZoneAlias = &Table{Name: "san_zone_alias"} + TSaves = &Table{Name: "saves"} + TSavesLast = &Table{Name: "saves_last"} + TSchedulerRun = &Table{Name: "scheduler_run"} + TSchedulerTask = &Table{Name: "scheduler_task"} + TSchedulerTaskDeps = &Table{Name: "scheduler_task_deps"} + TSchedulerWorker = &Table{Name: "scheduler_worker"} + TServices = &Table{Name: "services"} + TServicesLog = &Table{Name: "services_log"} + TServicesLogLast = &Table{Name: "services_log_last"} + TServicesTest = &Table{Name: "services_test"} + TServiceIds = &Table{Name: "service_ids"} + TStatsCompare = &Table{Name: "stats_compare"} + TStatsCompareFset = &Table{Name: "stats_compare_fset"} + TStatsCompareUser = &Table{Name: "stats_compare_user"} + TStatDay = &Table{Name: "stat_day"} + TStatDayDiskApp = &Table{Name: "stat_day_disk_app"} + TStatDayDiskAppDG = &Table{Name: "stat_day_disk_app_dg"} + TStatDayDiskArray = &Table{Name: "stat_day_disk_array"} + TStatDayDiskArrayDG = &Table{Name: "stat_day_disk_array_dg"} + TStatDaySvc = &Table{Name: "stat_day_svc"} + TStorArray = &Table{Name: "stor_array"} + TStorArrayDG = &Table{Name: "stor_array_dg"} + TStorArrayDGQuota = &Table{Name: "stor_array_dg_quota"} + TStorArrayProxy = &Table{Name: "stor_array_proxy"} + TStorArrayTgtid = &Table{Name: "stor_array_tgtid"} + TStorZone = &Table{Name: "stor_zone"} + TSvcactions = &Table{Name: "svcactions"} + TSvcdisks = &Table{Name: "svcdisks"} + TSvcmon = &Table{Name: "svcmon"} + TSvcmonLog = &Table{Name: "svcmon_log"} + TSvcmonLogAck = &Table{Name: "svcmon_log_ack"} + TSvcmonLogLast = &Table{Name: "svcmon_log_last"} + TSvcTags = &Table{Name: "svc_tags"} + TSwitches = &Table{Name: "switches"} + TSysrepAllow = &Table{Name: "sysrep_allow"} + TSysrepChanging = &Table{Name: "sysrep_changing"} + TSysrepSecure = &Table{Name: "sysrep_secure"} + TTableModified = &Table{Name: "table_modified"} + TTags = &Table{Name: "tags"} + TTmp = &Table{Name: "tmp"} + TTmpmd5 = &Table{Name: "tmpmd5"} + TUserLog = &Table{Name: "user_log"} + TUserPrefs = &Table{Name: "user_prefs"} + TUInc = &Table{Name: "u_inc"} + TWikiPages = &Table{Name: "wiki_pages"} + TWorkflows = &Table{Name: "workflows"} +) + +// Columns of action_queue +var ( + ActionQueueID = &Col{T: TActionQueue, Name: "id", Nullable: false} + ActionQueueStatus = &Col{T: TActionQueue, Name: "status", Nullable: true} + ActionQueueCommand = &Col{T: TActionQueue, Name: "command", Nullable: false} + ActionQueueDateQueued = &Col{T: TActionQueue, Name: "date_queued", Nullable: false} + ActionQueueDateDequeued = &Col{T: TActionQueue, Name: "date_dequeued", Nullable: false} + ActionQueueRet = &Col{T: TActionQueue, Name: "ret", Nullable: true} + ActionQueueStdout = &Col{T: TActionQueue, Name: "stdout", Nullable: true} + ActionQueueStderr = &Col{T: TActionQueue, Name: "stderr", Nullable: true} + ActionQueueActionType = &Col{T: TActionQueue, Name: "action_type", Nullable: true} + ActionQueueUserID = &Col{T: TActionQueue, Name: "user_id", Nullable: true} + ActionQueueFormID = &Col{T: TActionQueue, Name: "form_id", Nullable: true} + ActionQueueConnectTo = &Col{T: TActionQueue, Name: "connect_to", Nullable: true} + ActionQueueNodeID = &Col{T: TActionQueue, Name: "node_id", Nullable: true} + ActionQueueSvcID = &Col{T: TActionQueue, Name: "svc_id", Nullable: true} +) + +// Columns of alerts +var ( + AlertsID = &Col{T: TAlerts, Name: "id", Nullable: false} + AlertsSentAt = &Col{T: TAlerts, Name: "sent_at", Nullable: true} + AlertsSentTo = &Col{T: TAlerts, Name: "sent_to", Nullable: false} + AlertsBody = &Col{T: TAlerts, Name: "body", Nullable: true} + AlertsSubject = &Col{T: TAlerts, Name: "subject", Nullable: false} + AlertsSendAt = &Col{T: TAlerts, Name: "send_at", Nullable: false} + AlertsCreatedAt = &Col{T: TAlerts, Name: "created_at", Nullable: false} + AlertsActionID = &Col{T: TAlerts, Name: "action_id", Nullable: true} + AlertsAppID = &Col{T: TAlerts, Name: "app_id", Nullable: true} + AlertsDomain = &Col{T: TAlerts, Name: "domain", Nullable: true} + AlertsActionIds = &Col{T: TAlerts, Name: "action_ids", Nullable: true} +) + +// Columns of alerts_sent +var ( + AlertsSentID = &Col{T: TAlertsSent, Name: "id", Nullable: false} + AlertsSentAlertID = &Col{T: TAlertsSent, Name: "alert_id", Nullable: false} + AlertsSentMsgType = &Col{T: TAlertsSent, Name: "msg_type", Nullable: false} + AlertsSentUserID = &Col{T: TAlertsSent, Name: "user_id", Nullable: false} + AlertsSentSent = &Col{T: TAlertsSent, Name: "sent", Nullable: false} +) + +// Columns of apps +var ( + AppsID = &Col{T: TApps, Name: "id", Nullable: false} + AppsApp = &Col{T: TApps, Name: "app", Nullable: true} + AppsUpdated = &Col{T: TApps, Name: "updated", Nullable: false} + AppsAppDomain = &Col{T: TApps, Name: "app_domain", Nullable: true} + AppsAppTeamOps = &Col{T: TApps, Name: "app_team_ops", Nullable: true} + AppsDescription = &Col{T: TApps, Name: "description", Nullable: false} +) + +// Columns of apps_import +var ( + AppsImportID = &Col{T: TAppsImport, Name: "id", Nullable: false} + AppsImportApp = &Col{T: TAppsImport, Name: "app", Nullable: true} + AppsImportDesc = &Col{T: TAppsImport, Name: "desc", Nullable: false} + AppsImportUpdated = &Col{T: TAppsImport, Name: "updated", Nullable: false} + AppsImportAppDomain = &Col{T: TAppsImport, Name: "app_domain", Nullable: true} + AppsImportAppTeamOps = &Col{T: TAppsImport, Name: "app_team_ops", Nullable: true} +) + +// Columns of apps_publications +var ( + AppsPublicationsID = &Col{T: TAppsPublications, Name: "id", Nullable: false} + AppsPublicationsGroupID = &Col{T: TAppsPublications, Name: "group_id", Nullable: false} + AppsPublicationsAppID = &Col{T: TAppsPublications, Name: "app_id", Nullable: false} +) + +// Columns of apps_responsibles +var ( + AppsResponsiblesID = &Col{T: TAppsResponsibles, Name: "id", Nullable: false} + AppsResponsiblesGroupID = &Col{T: TAppsResponsibles, Name: "group_id", Nullable: false} + AppsResponsiblesAppID = &Col{T: TAppsResponsibles, Name: "app_id", Nullable: false} +) + +// Columns of auth_event +var ( + AuthEventID = &Col{T: TAuthEvent, Name: "id", Nullable: false} + AuthEventTimeStamp = &Col{T: TAuthEvent, Name: "time_stamp", Nullable: true} + AuthEventClientIP = &Col{T: TAuthEvent, Name: "client_ip", Nullable: true} + AuthEventUserID = &Col{T: TAuthEvent, Name: "user_id", Nullable: true} + AuthEventOrigin = &Col{T: TAuthEvent, Name: "origin", Nullable: true} + AuthEventDescription = &Col{T: TAuthEvent, Name: "description", Nullable: true} +) + +// Columns of auth_filters +var ( + AuthFiltersID = &Col{T: TAuthFilters, Name: "id", Nullable: false} + AuthFiltersFilUid = &Col{T: TAuthFilters, Name: "fil_uid", Nullable: false} + AuthFiltersFilID = &Col{T: TAuthFilters, Name: "fil_id", Nullable: true} + AuthFiltersFilValue = &Col{T: TAuthFilters, Name: "fil_value", Nullable: false} + AuthFiltersFilActive = &Col{T: TAuthFilters, Name: "fil_active", Nullable: true} +) + +// Columns of auth_group +var ( + AuthGroupID = &Col{T: TAuthGroup, Name: "id", Nullable: false} + AuthGroupRole = &Col{T: TAuthGroup, Name: "role", Nullable: true} + AuthGroupDescription = &Col{T: TAuthGroup, Name: "description", Nullable: true} + AuthGroupPrivilege = &Col{T: TAuthGroup, Name: "privilege", Nullable: true} +) + +// Columns of auth_membership +var ( + AuthMembershipID = &Col{T: TAuthMembership, Name: "id", Nullable: false} + AuthMembershipUserID = &Col{T: TAuthMembership, Name: "user_id", Nullable: true} + AuthMembershipGroupID = &Col{T: TAuthMembership, Name: "group_id", Nullable: true} + AuthMembershipPrimaryGroup = &Col{T: TAuthMembership, Name: "primary_group", Nullable: true} +) + +// Columns of auth_node +var ( + AuthNodeID = &Col{T: TAuthNode, Name: "id", Nullable: false} + AuthNodeNodename = &Col{T: TAuthNode, Name: "nodename", Nullable: true} + AuthNodeUuid = &Col{T: TAuthNode, Name: "uuid", Nullable: false} + AuthNodeUpdated = &Col{T: TAuthNode, Name: "updated", Nullable: false} + AuthNodeNodeID = &Col{T: TAuthNode, Name: "node_id", Nullable: true} +) + +// Columns of auth_permission +var ( + AuthPermissionID = &Col{T: TAuthPermission, Name: "id", Nullable: false} + AuthPermissionGroupID = &Col{T: TAuthPermission, Name: "group_id", Nullable: true} + AuthPermissionName = &Col{T: TAuthPermission, Name: "name", Nullable: true} + AuthPermissionTableName = &Col{T: TAuthPermission, Name: "table_name", Nullable: true} + AuthPermissionRecordID = &Col{T: TAuthPermission, Name: "record_id", Nullable: true} +) + +// Columns of auth_user +var ( + AuthUserID = &Col{T: TAuthUser, Name: "id", Nullable: false} + AuthUserFirstName = &Col{T: TAuthUser, Name: "first_name", Nullable: true} + AuthUserLastName = &Col{T: TAuthUser, Name: "last_name", Nullable: true} + AuthUserEmail = &Col{T: TAuthUser, Name: "email", Nullable: true} + AuthUserPassword = &Col{T: TAuthUser, Name: "password", Nullable: true} + AuthUserRegistrationKey = &Col{T: TAuthUser, Name: "registration_key", Nullable: true} + AuthUserResetPasswordKey = &Col{T: TAuthUser, Name: "reset_password_key", Nullable: true} + AuthUserEmailNotifications = &Col{T: TAuthUser, Name: "email_notifications", Nullable: true} + AuthUserImNotifications = &Col{T: TAuthUser, Name: "im_notifications", Nullable: true} + AuthUserImType = &Col{T: TAuthUser, Name: "im_type", Nullable: true} + AuthUserImUsername = &Col{T: TAuthUser, Name: "im_username", Nullable: true} + AuthUserEmailLogLevel = &Col{T: TAuthUser, Name: "email_log_level", Nullable: true} + AuthUserImLogLevel = &Col{T: TAuthUser, Name: "im_log_level", Nullable: true} + AuthUserLockFilter = &Col{T: TAuthUser, Name: "lock_filter", Nullable: true} + AuthUserPhoneWork = &Col{T: TAuthUser, Name: "phone_work", Nullable: true} + AuthUserRegistrationID = &Col{T: TAuthUser, Name: "registration_id", Nullable: true} + AuthUserQuotaApp = &Col{T: TAuthUser, Name: "quota_app", Nullable: true} + AuthUserQuotaOrgGroup = &Col{T: TAuthUser, Name: "quota_org_group", Nullable: true} + AuthUserUsername = &Col{T: TAuthUser, Name: "username", Nullable: true} + AuthUserQuotaDockerRegistries = &Col{T: TAuthUser, Name: "quota_docker_registries", Nullable: true} + AuthUserImNotificationsDelay = &Col{T: TAuthUser, Name: "im_notifications_delay", Nullable: true} + AuthUserEmailNotificationsDelay = &Col{T: TAuthUser, Name: "email_notifications_delay", Nullable: true} +) + +// Columns of b_action_errors +var ( + BActionErrorsID = &Col{T: TBActionErrors, Name: "id", Nullable: false} + BActionErrorsSvcID = &Col{T: TBActionErrors, Name: "svc_id", Nullable: true} + BActionErrorsNodeID = &Col{T: TBActionErrors, Name: "node_id", Nullable: true} + BActionErrorsErr = &Col{T: TBActionErrors, Name: "err", Nullable: false} +) + +// Columns of b_apps_old +var ( + BAppsOldID = &Col{T: TBAppsOld, Name: "id", Nullable: false} + BAppsOldApp = &Col{T: TBAppsOld, Name: "app", Nullable: true} + BAppsOldRoles = &Col{T: TBAppsOld, Name: "roles", Nullable: true} + BAppsOldResponsibles = &Col{T: TBAppsOld, Name: "responsibles", Nullable: true} + BAppsOldMailto = &Col{T: TBAppsOld, Name: "mailto", Nullable: true} + BAppsOldAppDomain = &Col{T: TBAppsOld, Name: "app_domain", Nullable: true} + BAppsOldAppTeamOps = &Col{T: TBAppsOld, Name: "app_team_ops", Nullable: true} +) + +// Columns of charts +var ( + ChartsID = &Col{T: TCharts, Name: "id", Nullable: false} + ChartsChartName = &Col{T: TCharts, Name: "chart_name", Nullable: false} + ChartsChartYaml = &Col{T: TCharts, Name: "chart_yaml", Nullable: true} +) + +// Columns of chart_team_publication +var ( + ChartTeamPublicationID = &Col{T: TChartTeamPublication, Name: "id", Nullable: false} + ChartTeamPublicationChartID = &Col{T: TChartTeamPublication, Name: "chart_id", Nullable: false} + ChartTeamPublicationGroupID = &Col{T: TChartTeamPublication, Name: "group_id", Nullable: false} +) + +// Columns of chart_team_responsible +var ( + ChartTeamResponsibleID = &Col{T: TChartTeamResponsible, Name: "id", Nullable: false} + ChartTeamResponsibleChartID = &Col{T: TChartTeamResponsible, Name: "chart_id", Nullable: false} + ChartTeamResponsibleGroupID = &Col{T: TChartTeamResponsible, Name: "group_id", Nullable: false} +) + +// Columns of checks_defaults +var ( + ChecksDefaultsID = &Col{T: TChecksDefaults, Name: "id", Nullable: false} + ChecksDefaultsChkType = &Col{T: TChecksDefaults, Name: "chk_type", Nullable: false} + ChecksDefaultsChkLow = &Col{T: TChecksDefaults, Name: "chk_low", Nullable: true} + ChecksDefaultsChkHigh = &Col{T: TChecksDefaults, Name: "chk_high", Nullable: true} + ChecksDefaultsChkInst = &Col{T: TChecksDefaults, Name: "chk_inst", Nullable: true} + ChecksDefaultsChkPrio = &Col{T: TChecksDefaults, Name: "chk_prio", Nullable: true} +) + +// Columns of checks_live +var ( + ChecksLiveID = &Col{T: TChecksLive, Name: "id", Nullable: false} + ChecksLiveChkType = &Col{T: TChecksLive, Name: "chk_type", Nullable: false} + ChecksLiveChkUpdated = &Col{T: TChecksLive, Name: "chk_updated", Nullable: false} + ChecksLiveChkValue = &Col{T: TChecksLive, Name: "chk_value", Nullable: true} + ChecksLiveChkCreated = &Col{T: TChecksLive, Name: "chk_created", Nullable: false} + ChecksLiveChkInstance = &Col{T: TChecksLive, Name: "chk_instance", Nullable: true} + ChecksLiveChkLow = &Col{T: TChecksLive, Name: "chk_low", Nullable: true} + ChecksLiveChkHigh = &Col{T: TChecksLive, Name: "chk_high", Nullable: true} + ChecksLiveChkThresholdProvider = &Col{T: TChecksLive, Name: "chk_threshold_provider", Nullable: true} + ChecksLiveChkErr = &Col{T: TChecksLive, Name: "chk_err", Nullable: true} + ChecksLiveNodeID = &Col{T: TChecksLive, Name: "node_id", Nullable: true} + ChecksLiveSvcID = &Col{T: TChecksLive, Name: "svc_id", Nullable: true} +) + +// Columns of checks_settings +var ( + ChecksSettingsID = &Col{T: TChecksSettings, Name: "id", Nullable: false} + ChecksSettingsChkType = &Col{T: TChecksSettings, Name: "chk_type", Nullable: false} + ChecksSettingsChkLow = &Col{T: TChecksSettings, Name: "chk_low", Nullable: true} + ChecksSettingsChkHigh = &Col{T: TChecksSettings, Name: "chk_high", Nullable: true} + ChecksSettingsChkChanged = &Col{T: TChecksSettings, Name: "chk_changed", Nullable: false} + ChecksSettingsChkChangedBy = &Col{T: TChecksSettings, Name: "chk_changed_by", Nullable: false} + ChecksSettingsChkInstance = &Col{T: TChecksSettings, Name: "chk_instance", Nullable: true} + ChecksSettingsNodeID = &Col{T: TChecksSettings, Name: "node_id", Nullable: true} + ChecksSettingsSvcID = &Col{T: TChecksSettings, Name: "svc_id", Nullable: true} +) + +// Columns of clusters +var ( + ClustersID = &Col{T: TClusters, Name: "id", Nullable: false} + ClustersClusterID = &Col{T: TClusters, Name: "cluster_id", Nullable: true} + ClustersClusterName = &Col{T: TClusters, Name: "cluster_name", Nullable: false} + ClustersClusterData = &Col{T: TClusters, Name: "cluster_data", Nullable: true} +) + +// Columns of comp_log +var ( + CompLogID = &Col{T: TCompLog, Name: "id", Nullable: false} + CompLogRunModule = &Col{T: TCompLog, Name: "run_module", Nullable: false} + CompLogRunStatus = &Col{T: TCompLog, Name: "run_status", Nullable: false} + CompLogRunLog = &Col{T: TCompLog, Name: "run_log", Nullable: false} + CompLogRunDate = &Col{T: TCompLog, Name: "run_date", Nullable: false} + CompLogRunAction = &Col{T: TCompLog, Name: "run_action", Nullable: true} + CompLogRsetMD5 = &Col{T: TCompLog, Name: "rset_md5", Nullable: true} + CompLogNodeID = &Col{T: TCompLog, Name: "node_id", Nullable: true} + CompLogSvcID = &Col{T: TCompLog, Name: "svc_id", Nullable: true} +) + +// Columns of comp_log_daily +var ( + CompLogDailyID = &Col{T: TCompLogDaily, Name: "id", Nullable: false} + CompLogDailyRunModule = &Col{T: TCompLogDaily, Name: "run_module", Nullable: false} + CompLogDailyRunStatus = &Col{T: TCompLogDaily, Name: "run_status", Nullable: false} + CompLogDailyRunDate = &Col{T: TCompLogDaily, Name: "run_date", Nullable: false} + CompLogDailyNodeID = &Col{T: TCompLogDaily, Name: "node_id", Nullable: true} + CompLogDailySvcID = &Col{T: TCompLogDaily, Name: "svc_id", Nullable: true} +) + +// Columns of comp_moduleset +var ( + CompModulesetID = &Col{T: TCompModuleset, Name: "id", Nullable: false} + CompModulesetModsetName = &Col{T: TCompModuleset, Name: "modset_name", Nullable: false} + CompModulesetModsetAuthor = &Col{T: TCompModuleset, Name: "modset_author", Nullable: true} + CompModulesetModsetUpdated = &Col{T: TCompModuleset, Name: "modset_updated", Nullable: false} +) + +// Columns of comp_modulesets_services +var ( + CompModulesetsServicesID = &Col{T: TCompModulesetsServices, Name: "id", Nullable: false} + CompModulesetsServicesModsetID = &Col{T: TCompModulesetsServices, Name: "modset_id", Nullable: false} + CompModulesetsServicesModsetModAuthor = &Col{T: TCompModulesetsServices, Name: "modset_mod_author", Nullable: true} + CompModulesetsServicesModsetUpdated = &Col{T: TCompModulesetsServices, Name: "modset_updated", Nullable: false} + CompModulesetsServicesSlave = &Col{T: TCompModulesetsServices, Name: "slave", Nullable: true} + CompModulesetsServicesSvcID = &Col{T: TCompModulesetsServices, Name: "svc_id", Nullable: true} +) + +// Columns of comp_moduleset_modules +var ( + CompModulesetModulesID = &Col{T: TCompModulesetModules, Name: "id", Nullable: false} + CompModulesetModulesModsetID = &Col{T: TCompModulesetModules, Name: "modset_id", Nullable: true} + CompModulesetModulesModsetModName = &Col{T: TCompModulesetModules, Name: "modset_mod_name", Nullable: false} + CompModulesetModulesModsetModAuthor = &Col{T: TCompModulesetModules, Name: "modset_mod_author", Nullable: true} + CompModulesetModulesModsetModUpdated = &Col{T: TCompModulesetModules, Name: "modset_mod_updated", Nullable: false} + CompModulesetModulesAutofix = &Col{T: TCompModulesetModules, Name: "autofix", Nullable: true} +) + +// Columns of comp_moduleset_moduleset +var ( + CompModulesetModulesetID = &Col{T: TCompModulesetModuleset, Name: "id", Nullable: false} + CompModulesetModulesetParentModsetID = &Col{T: TCompModulesetModuleset, Name: "parent_modset_id", Nullable: false} + CompModulesetModulesetChildModsetID = &Col{T: TCompModulesetModuleset, Name: "child_modset_id", Nullable: false} +) + +// Columns of comp_moduleset_ruleset +var ( + CompModulesetRulesetID = &Col{T: TCompModulesetRuleset, Name: "id", Nullable: false} + CompModulesetRulesetModsetID = &Col{T: TCompModulesetRuleset, Name: "modset_id", Nullable: false} + CompModulesetRulesetRulesetID = &Col{T: TCompModulesetRuleset, Name: "ruleset_id", Nullable: false} +) + +// Columns of comp_moduleset_team_publication +var ( + CompModulesetTeamPublicationID = &Col{T: TCompModulesetTeamPublication, Name: "id", Nullable: false} + CompModulesetTeamPublicationModsetID = &Col{T: TCompModulesetTeamPublication, Name: "modset_id", Nullable: false} + CompModulesetTeamPublicationGroupID = &Col{T: TCompModulesetTeamPublication, Name: "group_id", Nullable: false} +) + +// Columns of comp_moduleset_team_responsible +var ( + CompModulesetTeamResponsibleID = &Col{T: TCompModulesetTeamResponsible, Name: "id", Nullable: false} + CompModulesetTeamResponsibleModsetID = &Col{T: TCompModulesetTeamResponsible, Name: "modset_id", Nullable: false} + CompModulesetTeamResponsibleGroupID = &Col{T: TCompModulesetTeamResponsible, Name: "group_id", Nullable: false} +) + +// Columns of comp_mod_status +var ( + CompModStatusID = &Col{T: TCompModStatus, Name: "id", Nullable: false} + CompModStatusTotal = &Col{T: TCompModStatus, Name: "total", Nullable: true} + CompModStatusOk = &Col{T: TCompModStatus, Name: "ok", Nullable: true} + CompModStatusNok = &Col{T: TCompModStatus, Name: "nok", Nullable: true} + CompModStatusNa = &Col{T: TCompModStatus, Name: "na", Nullable: true} + CompModStatusObs = &Col{T: TCompModStatus, Name: "obs", Nullable: true} + CompModStatusPct = &Col{T: TCompModStatus, Name: "pct", Nullable: true} + CompModStatusModName = &Col{T: TCompModStatus, Name: "mod_name", Nullable: true} +) + +// Columns of comp_node_moduleset +var ( + CompNodeModulesetID = &Col{T: TCompNodeModuleset, Name: "id", Nullable: false} + CompNodeModulesetModsetID = &Col{T: TCompNodeModuleset, Name: "modset_id", Nullable: false} + CompNodeModulesetModsetModAuthor = &Col{T: TCompNodeModuleset, Name: "modset_mod_author", Nullable: true} + CompNodeModulesetModsetUpdated = &Col{T: TCompNodeModuleset, Name: "modset_updated", Nullable: false} + CompNodeModulesetNodeID = &Col{T: TCompNodeModuleset, Name: "node_id", Nullable: true} +) + +// Columns of comp_node_status +var ( + CompNodeStatusID = &Col{T: TCompNodeStatus, Name: "id", Nullable: false} + CompNodeStatusTotal = &Col{T: TCompNodeStatus, Name: "total", Nullable: true} + CompNodeStatusOk = &Col{T: TCompNodeStatus, Name: "ok", Nullable: true} + CompNodeStatusNok = &Col{T: TCompNodeStatus, Name: "nok", Nullable: true} + CompNodeStatusNa = &Col{T: TCompNodeStatus, Name: "na", Nullable: true} + CompNodeStatusObs = &Col{T: TCompNodeStatus, Name: "obs", Nullable: true} + CompNodeStatusPct = &Col{T: TCompNodeStatus, Name: "pct", Nullable: true} + CompNodeStatusNodeName = &Col{T: TCompNodeStatus, Name: "node_name", Nullable: true} +) + +// Columns of comp_rulesets +var ( + CompRulesetsID = &Col{T: TCompRulesets, Name: "id", Nullable: false} + CompRulesetsRulesetName = &Col{T: TCompRulesets, Name: "ruleset_name", Nullable: true} + CompRulesetsRulesetType = &Col{T: TCompRulesets, Name: "ruleset_type", Nullable: true} + CompRulesetsRulesetPublic = &Col{T: TCompRulesets, Name: "ruleset_public", Nullable: true} +) + +// Columns of comp_rulesets_chains +var ( + CompRulesetsChainsID = &Col{T: TCompRulesetsChains, Name: "id", Nullable: false} + CompRulesetsChainsHeadRsetID = &Col{T: TCompRulesetsChains, Name: "head_rset_id", Nullable: false} + CompRulesetsChainsTailRsetID = &Col{T: TCompRulesetsChains, Name: "tail_rset_id", Nullable: false} + CompRulesetsChainsChainLen = &Col{T: TCompRulesetsChains, Name: "chain_len", Nullable: false} + CompRulesetsChainsChain = &Col{T: TCompRulesetsChains, Name: "chain", Nullable: false} +) + +// Columns of comp_rulesets_filtersets +var ( + CompRulesetsFiltersetsID = &Col{T: TCompRulesetsFiltersets, Name: "id", Nullable: false} + CompRulesetsFiltersetsRulesetID = &Col{T: TCompRulesetsFiltersets, Name: "ruleset_id", Nullable: false} + CompRulesetsFiltersetsFsetID = &Col{T: TCompRulesetsFiltersets, Name: "fset_id", Nullable: false} +) + +// Columns of comp_rulesets_nodes +var ( + CompRulesetsNodesID = &Col{T: TCompRulesetsNodes, Name: "id", Nullable: false} + CompRulesetsNodesRulesetID = &Col{T: TCompRulesetsNodes, Name: "ruleset_id", Nullable: false} + CompRulesetsNodesNodeID = &Col{T: TCompRulesetsNodes, Name: "node_id", Nullable: true} +) + +// Columns of comp_rulesets_rulesets +var ( + CompRulesetsRulesetsID = &Col{T: TCompRulesetsRulesets, Name: "id", Nullable: false} + CompRulesetsRulesetsParentRsetID = &Col{T: TCompRulesetsRulesets, Name: "parent_rset_id", Nullable: false} + CompRulesetsRulesetsChildRsetID = &Col{T: TCompRulesetsRulesets, Name: "child_rset_id", Nullable: false} +) + +// Columns of comp_rulesets_services +var ( + CompRulesetsServicesID = &Col{T: TCompRulesetsServices, Name: "id", Nullable: false} + CompRulesetsServicesRulesetID = &Col{T: TCompRulesetsServices, Name: "ruleset_id", Nullable: false} + CompRulesetsServicesSlave = &Col{T: TCompRulesetsServices, Name: "slave", Nullable: true} + CompRulesetsServicesSvcID = &Col{T: TCompRulesetsServices, Name: "svc_id", Nullable: true} +) + +// Columns of comp_rulesets_variables +var ( + CompRulesetsVariablesID = &Col{T: TCompRulesetsVariables, Name: "id", Nullable: false} + CompRulesetsVariablesRulesetID = &Col{T: TCompRulesetsVariables, Name: "ruleset_id", Nullable: false} + CompRulesetsVariablesVarName = &Col{T: TCompRulesetsVariables, Name: "var_name", Nullable: false} + CompRulesetsVariablesVarValue = &Col{T: TCompRulesetsVariables, Name: "var_value", Nullable: true} + CompRulesetsVariablesVarAuthor = &Col{T: TCompRulesetsVariables, Name: "var_author", Nullable: false} + CompRulesetsVariablesVarUpdated = &Col{T: TCompRulesetsVariables, Name: "var_updated", Nullable: false} + CompRulesetsVariablesVarClass = &Col{T: TCompRulesetsVariables, Name: "var_class", Nullable: false} +) + +// Columns of comp_ruleset_team_publication +var ( + CompRulesetTeamPublicationID = &Col{T: TCompRulesetTeamPublication, Name: "id", Nullable: false} + CompRulesetTeamPublicationRulesetID = &Col{T: TCompRulesetTeamPublication, Name: "ruleset_id", Nullable: false} + CompRulesetTeamPublicationGroupID = &Col{T: TCompRulesetTeamPublication, Name: "group_id", Nullable: false} +) + +// Columns of comp_ruleset_team_responsible +var ( + CompRulesetTeamResponsibleID = &Col{T: TCompRulesetTeamResponsible, Name: "id", Nullable: false} + CompRulesetTeamResponsibleRulesetID = &Col{T: TCompRulesetTeamResponsible, Name: "ruleset_id", Nullable: false} + CompRulesetTeamResponsibleGroupID = &Col{T: TCompRulesetTeamResponsible, Name: "group_id", Nullable: false} +) + +// Columns of comp_run_ruleset +var ( + CompRunRulesetID = &Col{T: TCompRunRuleset, Name: "id", Nullable: false} + CompRunRulesetRsetMD5 = &Col{T: TCompRunRuleset, Name: "rset_md5", Nullable: false} + CompRunRulesetRset = &Col{T: TCompRunRuleset, Name: "rset", Nullable: false} + CompRunRulesetDate = &Col{T: TCompRunRuleset, Name: "date", Nullable: true} +) + +// Columns of comp_status +var ( + CompStatusID = &Col{T: TCompStatus, Name: "id", Nullable: false} + CompStatusRunModule = &Col{T: TCompStatus, Name: "run_module", Nullable: false} + CompStatusRunStatus = &Col{T: TCompStatus, Name: "run_status", Nullable: false} + CompStatusRunLog = &Col{T: TCompStatus, Name: "run_log", Nullable: false} + CompStatusRunDate = &Col{T: TCompStatus, Name: "run_date", Nullable: false} + CompStatusRunAction = &Col{T: TCompStatus, Name: "run_action", Nullable: true} + CompStatusRsetMD5 = &Col{T: TCompStatus, Name: "rset_md5", Nullable: true} + CompStatusNodeID = &Col{T: TCompStatus, Name: "node_id", Nullable: true} + CompStatusSvcID = &Col{T: TCompStatus, Name: "svc_id", Nullable: true} +) + +// Columns of comp_svc_status +var ( + CompSvcStatusID = &Col{T: TCompSvcStatus, Name: "id", Nullable: false} + CompSvcStatusTotal = &Col{T: TCompSvcStatus, Name: "total", Nullable: true} + CompSvcStatusOk = &Col{T: TCompSvcStatus, Name: "ok", Nullable: true} + CompSvcStatusNok = &Col{T: TCompSvcStatus, Name: "nok", Nullable: true} + CompSvcStatusNa = &Col{T: TCompSvcStatus, Name: "na", Nullable: true} + CompSvcStatusObs = &Col{T: TCompSvcStatus, Name: "obs", Nullable: true} + CompSvcStatusPct = &Col{T: TCompSvcStatus, Name: "pct", Nullable: true} + CompSvcStatusSvcName = &Col{T: TCompSvcStatus, Name: "svc_name", Nullable: true} +) + +// Columns of dashboard +var ( + DashboardID = &Col{T: TDashboard, Name: "id", Nullable: false} + DashboardDashType = &Col{T: TDashboard, Name: "dash_type", Nullable: false} + DashboardSvcID = &Col{T: TDashboard, Name: "svc_id", Nullable: true} + DashboardDashSeverity = &Col{T: TDashboard, Name: "dash_severity", Nullable: false} + DashboardDashFmt = &Col{T: TDashboard, Name: "dash_fmt", Nullable: true} + DashboardDashDict = &Col{T: TDashboard, Name: "dash_dict", Nullable: true} + DashboardDashCreated = &Col{T: TDashboard, Name: "dash_created", Nullable: false} + DashboardDashDictMD5 = &Col{T: TDashboard, Name: "dash_dict_md5", Nullable: true} + DashboardDashEnv = &Col{T: TDashboard, Name: "dash_env", Nullable: true} + DashboardDashUpdated = &Col{T: TDashboard, Name: "dash_updated", Nullable: true} + DashboardNodeID = &Col{T: TDashboard, Name: "node_id", Nullable: true} + DashboardDashMD5 = &Col{T: TDashboard, Name: "dash_md5", Nullable: true} + DashboardDashInstance = &Col{T: TDashboard, Name: "dash_instance", Nullable: true} +) + +// Columns of dashboard_events +var ( + DashboardEventsID = &Col{T: TDashboardEvents, Name: "id", Nullable: false} + DashboardEventsSvcID = &Col{T: TDashboardEvents, Name: "svc_id", Nullable: true} + DashboardEventsDashMD5 = &Col{T: TDashboardEvents, Name: "dash_md5", Nullable: true} + DashboardEventsDashBegin = &Col{T: TDashboardEvents, Name: "dash_begin", Nullable: false} + DashboardEventsDashEnd = &Col{T: TDashboardEvents, Name: "dash_end", Nullable: false} + DashboardEventsNodeID = &Col{T: TDashboardEvents, Name: "node_id", Nullable: true} +) + +// Columns of dashboard_ref +var ( + DashboardRefID = &Col{T: TDashboardRef, Name: "id", Nullable: false} + DashboardRefDashMD5 = &Col{T: TDashboardRef, Name: "dash_md5", Nullable: true} + DashboardRefDashType = &Col{T: TDashboardRef, Name: "dash_type", Nullable: true} + DashboardRefDashFmt = &Col{T: TDashboardRef, Name: "dash_fmt", Nullable: true} + DashboardRefDashDict = &Col{T: TDashboardRef, Name: "dash_dict", Nullable: true} +) + +// Columns of digit +var ( + DigitI = &Col{T: TDigit, Name: "i", Nullable: false} +) + +// Columns of diskinfo +var ( + DiskinfoID = &Col{T: TDiskinfo, Name: "id", Nullable: false} + DiskinfoDiskID = &Col{T: TDiskinfo, Name: "disk_id", Nullable: true} + DiskinfoDiskDevid = &Col{T: TDiskinfo, Name: "disk_devid", Nullable: true} + DiskinfoDiskArrayid = &Col{T: TDiskinfo, Name: "disk_arrayid", Nullable: true} + DiskinfoDiskUpdated = &Col{T: TDiskinfo, Name: "disk_updated", Nullable: true} + DiskinfoDiskRaid = &Col{T: TDiskinfo, Name: "disk_raid", Nullable: true} + DiskinfoDiskSize = &Col{T: TDiskinfo, Name: "disk_size", Nullable: true} + DiskinfoDiskGroup = &Col{T: TDiskinfo, Name: "disk_group", Nullable: true} + DiskinfoDiskLevel = &Col{T: TDiskinfo, Name: "disk_level", Nullable: false} + DiskinfoDiskController = &Col{T: TDiskinfo, Name: "disk_controller", Nullable: true} + DiskinfoDiskName = &Col{T: TDiskinfo, Name: "disk_name", Nullable: true} + DiskinfoDiskAlloc = &Col{T: TDiskinfo, Name: "disk_alloc", Nullable: true} + DiskinfoDiskCreated = &Col{T: TDiskinfo, Name: "disk_created", Nullable: false} +) + +// Columns of disk_blacklist +var ( + DiskBlacklistID = &Col{T: TDiskBlacklist, Name: "id", Nullable: false} + DiskBlacklistDiskID = &Col{T: TDiskBlacklist, Name: "disk_id", Nullable: false} +) + +// Columns of docker_registries +var ( + DockerRegistriesID = &Col{T: TDockerRegistries, Name: "id", Nullable: false} + DockerRegistriesService = &Col{T: TDockerRegistries, Name: "service", Nullable: false} + DockerRegistriesURL = &Col{T: TDockerRegistries, Name: "url", Nullable: false} + DockerRegistriesInsecure = &Col{T: TDockerRegistries, Name: "insecure", Nullable: false} + DockerRegistriesCreated = &Col{T: TDockerRegistries, Name: "created", Nullable: false} + DockerRegistriesUpdated = &Col{T: TDockerRegistries, Name: "updated", Nullable: false} + DockerRegistriesRestricted = &Col{T: TDockerRegistries, Name: "restricted", Nullable: false} +) + +// Columns of docker_registries_publications +var ( + DockerRegistriesPublicationsID = &Col{T: TDockerRegistriesPublications, Name: "id", Nullable: false} + DockerRegistriesPublicationsGroupID = &Col{T: TDockerRegistriesPublications, Name: "group_id", Nullable: false} + DockerRegistriesPublicationsRegistryID = &Col{T: TDockerRegistriesPublications, Name: "registry_id", Nullable: false} +) + +// Columns of docker_registries_responsibles +var ( + DockerRegistriesResponsiblesID = &Col{T: TDockerRegistriesResponsibles, Name: "id", Nullable: false} + DockerRegistriesResponsiblesGroupID = &Col{T: TDockerRegistriesResponsibles, Name: "group_id", Nullable: false} + DockerRegistriesResponsiblesRegistryID = &Col{T: TDockerRegistriesResponsibles, Name: "registry_id", Nullable: false} +) + +// Columns of docker_repositories +var ( + DockerRepositoriesID = &Col{T: TDockerRepositories, Name: "id", Nullable: false} + DockerRepositoriesRegistryID = &Col{T: TDockerRepositories, Name: "registry_id", Nullable: false} + DockerRepositoriesRepository = &Col{T: TDockerRepositories, Name: "repository", Nullable: false} + DockerRepositoriesCreated = &Col{T: TDockerRepositories, Name: "created", Nullable: false} + DockerRepositoriesUpdated = &Col{T: TDockerRepositories, Name: "updated", Nullable: false} + DockerRepositoriesDescription = &Col{T: TDockerRepositories, Name: "description", Nullable: true} + DockerRepositoriesStars = &Col{T: TDockerRepositories, Name: "stars", Nullable: true} + DockerRepositoriesAutomated = &Col{T: TDockerRepositories, Name: "automated", Nullable: true} + DockerRepositoriesOfficial = &Col{T: TDockerRepositories, Name: "official", Nullable: true} +) + +// Columns of docker_tags +var ( + DockerTagsID = &Col{T: TDockerTags, Name: "id", Nullable: false} + DockerTagsRegistryID = &Col{T: TDockerTags, Name: "registry_id", Nullable: false} + DockerTagsRepositoryID = &Col{T: TDockerTags, Name: "repository_id", Nullable: false} + DockerTagsName = &Col{T: TDockerTags, Name: "name", Nullable: false} + DockerTagsCreated = &Col{T: TDockerTags, Name: "created", Nullable: false} + DockerTagsUpdated = &Col{T: TDockerTags, Name: "updated", Nullable: false} + DockerTagsConfigDigest = &Col{T: TDockerTags, Name: "config_digest", Nullable: true} + DockerTagsConfigSize = &Col{T: TDockerTags, Name: "config_size", Nullable: true} +) + +// Columns of drpprojects +var ( + DrpprojectsDRPProject = &Col{T: TDrpprojects, Name: "drp_project", Nullable: false} + DrpprojectsDRPProjectID = &Col{T: TDrpprojects, Name: "drp_project_id", Nullable: false} +) + +// Columns of drpservices +var ( + DrpservicesDRPWave = &Col{T: TDrpservices, Name: "drp_wave", Nullable: true} + DrpservicesDRPProjectID = &Col{T: TDrpservices, Name: "drp_project_id", Nullable: false} + DrpservicesSvcID = &Col{T: TDrpservices, Name: "svc_id", Nullable: true} +) + +// Columns of feed_queue +var ( + FeedQueueID = &Col{T: TFeedQueue, Name: "id", Nullable: false} + FeedQueueQFn = &Col{T: TFeedQueue, Name: "q_fn", Nullable: false} + FeedQueueQArgs = &Col{T: TFeedQueue, Name: "q_args", Nullable: false} + FeedQueueCreated = &Col{T: TFeedQueue, Name: "created", Nullable: false} +) + +// Columns of feed_queue_stats +var ( + FeedQueueStatsID = &Col{T: TFeedQueueStats, Name: "id", Nullable: false} + FeedQueueStatsQStart = &Col{T: TFeedQueueStats, Name: "q_start", Nullable: false} + FeedQueueStatsQEnd = &Col{T: TFeedQueueStats, Name: "q_end", Nullable: false} + FeedQueueStatsQFn = &Col{T: TFeedQueueStats, Name: "q_fn", Nullable: false} + FeedQueueStatsQCount = &Col{T: TFeedQueueStats, Name: "q_count", Nullable: false} + FeedQueueStatsQAvg = &Col{T: TFeedQueueStats, Name: "q_avg", Nullable: false} +) + +// Columns of filters +var ( + FiltersID = &Col{T: TFilters, Name: "id", Nullable: false} + FiltersFilName = &Col{T: TFilters, Name: "fil_name", Nullable: false} + FiltersFilColumn = &Col{T: TFilters, Name: "fil_column", Nullable: false} + FiltersFilNeedValue = &Col{T: TFilters, Name: "fil_need_value", Nullable: false} + FiltersFilPos = &Col{T: TFilters, Name: "fil_pos", Nullable: false} + FiltersFilTable = &Col{T: TFilters, Name: "fil_table", Nullable: false} + FiltersFilImg = &Col{T: TFilters, Name: "fil_img", Nullable: false} + FiltersFilSearchTable = &Col{T: TFilters, Name: "fil_search_table", Nullable: true} +) + +// Columns of forms +var ( + FormsID = &Col{T: TForms, Name: "id", Nullable: false} + FormsFormName = &Col{T: TForms, Name: "form_name", Nullable: true} + FormsFormYaml = &Col{T: TForms, Name: "form_yaml", Nullable: true} + FormsFormAuthor = &Col{T: TForms, Name: "form_author", Nullable: true} + FormsFormCreated = &Col{T: TForms, Name: "form_created", Nullable: false} + FormsFormType = &Col{T: TForms, Name: "form_type", Nullable: true} + FormsFormFolder = &Col{T: TForms, Name: "form_folder", Nullable: true} +) + +// Columns of forms_revisions +var ( + FormsRevisionsID = &Col{T: TFormsRevisions, Name: "id", Nullable: false} + FormsRevisionsFormYaml = &Col{T: TFormsRevisions, Name: "form_yaml", Nullable: false} + FormsRevisionsFormMD5 = &Col{T: TFormsRevisions, Name: "form_md5", Nullable: false} + FormsRevisionsFormDate = &Col{T: TFormsRevisions, Name: "form_date", Nullable: false} + FormsRevisionsFormID = &Col{T: TFormsRevisions, Name: "form_id", Nullable: true} + FormsRevisionsFormFolder = &Col{T: TFormsRevisions, Name: "form_folder", Nullable: true} + FormsRevisionsFormName = &Col{T: TFormsRevisions, Name: "form_name", Nullable: true} +) + +// Columns of forms_store +var ( + FormsStoreID = &Col{T: TFormsStore, Name: "id", Nullable: false} + FormsStoreFormSubmitter = &Col{T: TFormsStore, Name: "form_submitter", Nullable: false} + FormsStoreFormSubmitDate = &Col{T: TFormsStore, Name: "form_submit_date", Nullable: false} + FormsStoreFormData = &Col{T: TFormsStore, Name: "form_data", Nullable: false} + FormsStoreFormNextID = &Col{T: TFormsStore, Name: "form_next_id", Nullable: true} + FormsStoreFormPrevID = &Col{T: TFormsStore, Name: "form_prev_id", Nullable: true} + FormsStoreFormAssignee = &Col{T: TFormsStore, Name: "form_assignee", Nullable: true} + FormsStoreFormHeadID = &Col{T: TFormsStore, Name: "form_head_id", Nullable: true} + FormsStoreFormMD5 = &Col{T: TFormsStore, Name: "form_md5", Nullable: true} + FormsStoreFormVarID = &Col{T: TFormsStore, Name: "form_var_id", Nullable: true} + FormsStoreResultsID = &Col{T: TFormsStore, Name: "results_id", Nullable: true} +) + +// Columns of forms_team_publication +var ( + FormsTeamPublicationID = &Col{T: TFormsTeamPublication, Name: "id", Nullable: false} + FormsTeamPublicationFormID = &Col{T: TFormsTeamPublication, Name: "form_id", Nullable: false} + FormsTeamPublicationGroupID = &Col{T: TFormsTeamPublication, Name: "group_id", Nullable: false} +) + +// Columns of forms_team_responsible +var ( + FormsTeamResponsibleID = &Col{T: TFormsTeamResponsible, Name: "id", Nullable: false} + FormsTeamResponsibleFormID = &Col{T: TFormsTeamResponsible, Name: "form_id", Nullable: false} + FormsTeamResponsibleGroupID = &Col{T: TFormsTeamResponsible, Name: "group_id", Nullable: false} +) + +// Columns of form_output_results +var ( + FormOutputResultsID = &Col{T: TFormOutputResults, Name: "id", Nullable: false} + FormOutputResultsUserID = &Col{T: TFormOutputResults, Name: "user_id", Nullable: true} + FormOutputResultsNodeID = &Col{T: TFormOutputResults, Name: "node_id", Nullable: true} + FormOutputResultsResults = &Col{T: TFormOutputResults, Name: "results", Nullable: true} + FormOutputResultsSvcID = &Col{T: TFormOutputResults, Name: "svc_id", Nullable: true} +) + +// Columns of fset_cache +var ( + FsetCacheFsetID = &Col{T: TFsetCache, Name: "fset_id", Nullable: false} + FsetCacheObjType = &Col{T: TFsetCache, Name: "obj_type", Nullable: false} + FsetCacheObjID = &Col{T: TFsetCache, Name: "obj_id", Nullable: true} +) + +// Columns of gen_filters +var ( + GenFiltersID = &Col{T: TGenFilters, Name: "id", Nullable: false} + GenFiltersFTable = &Col{T: TGenFilters, Name: "f_table", Nullable: false} + GenFiltersFField = &Col{T: TGenFilters, Name: "f_field", Nullable: false} + GenFiltersFValue = &Col{T: TGenFilters, Name: "f_value", Nullable: true} + GenFiltersFUpdated = &Col{T: TGenFilters, Name: "f_updated", Nullable: false} + GenFiltersFAuthor = &Col{T: TGenFilters, Name: "f_author", Nullable: false} + GenFiltersFOp = &Col{T: TGenFilters, Name: "f_op", Nullable: false} + GenFiltersFCksum = &Col{T: TGenFilters, Name: "f_cksum", Nullable: true} + GenFiltersFLabel = &Col{T: TGenFilters, Name: "f_label", Nullable: true} +) + +// Columns of gen_filtersets +var ( + GenFiltersetsID = &Col{T: TGenFiltersets, Name: "id", Nullable: false} + GenFiltersetsFsetName = &Col{T: TGenFiltersets, Name: "fset_name", Nullable: true} + GenFiltersetsFsetUpdated = &Col{T: TGenFiltersets, Name: "fset_updated", Nullable: false} + GenFiltersetsFsetAuthor = &Col{T: TGenFiltersets, Name: "fset_author", Nullable: false} + GenFiltersetsFsetStats = &Col{T: TGenFiltersets, Name: "fset_stats", Nullable: true} +) + +// Columns of gen_filtersets_filters +var ( + GenFiltersetsFiltersID = &Col{T: TGenFiltersetsFilters, Name: "id", Nullable: false} + GenFiltersetsFiltersFsetID = &Col{T: TGenFiltersetsFilters, Name: "fset_id", Nullable: false} + GenFiltersetsFiltersFID = &Col{T: TGenFiltersetsFilters, Name: "f_id", Nullable: false} + GenFiltersetsFiltersFLogOp = &Col{T: TGenFiltersetsFilters, Name: "f_log_op", Nullable: false} + GenFiltersetsFiltersEncapFsetID = &Col{T: TGenFiltersetsFilters, Name: "encap_fset_id", Nullable: true} + GenFiltersetsFiltersFOrder = &Col{T: TGenFiltersetsFilters, Name: "f_order", Nullable: true} +) + +// Columns of gen_filterset_check_threshold +var ( + GenFiltersetCheckThresholdID = &Col{T: TGenFiltersetCheckThreshold, Name: "id", Nullable: false} + GenFiltersetCheckThresholdFsetID = &Col{T: TGenFiltersetCheckThreshold, Name: "fset_id", Nullable: false} + GenFiltersetCheckThresholdChkType = &Col{T: TGenFiltersetCheckThreshold, Name: "chk_type", Nullable: false} + GenFiltersetCheckThresholdChkLow = &Col{T: TGenFiltersetCheckThreshold, Name: "chk_low", Nullable: false} + GenFiltersetCheckThresholdChkHigh = &Col{T: TGenFiltersetCheckThreshold, Name: "chk_high", Nullable: false} + GenFiltersetCheckThresholdChkInstance = &Col{T: TGenFiltersetCheckThreshold, Name: "chk_instance", Nullable: false} +) + +// Columns of gen_filterset_team_responsible +var ( + GenFiltersetTeamResponsibleID = &Col{T: TGenFiltersetTeamResponsible, Name: "id", Nullable: false} + GenFiltersetTeamResponsibleFsetID = &Col{T: TGenFiltersetTeamResponsible, Name: "fset_id", Nullable: false} + GenFiltersetTeamResponsibleGroupID = &Col{T: TGenFiltersetTeamResponsible, Name: "group_id", Nullable: false} +) + +// Columns of gen_filterset_user +var ( + GenFiltersetUserID = &Col{T: TGenFiltersetUser, Name: "id", Nullable: false} + GenFiltersetUserFsetID = &Col{T: TGenFiltersetUser, Name: "fset_id", Nullable: false} + GenFiltersetUserUserID = &Col{T: TGenFiltersetUser, Name: "user_id", Nullable: false} +) + +// Columns of group_hidden_menu_entries +var ( + GroupHiddenMenuEntriesID = &Col{T: TGroupHiddenMenuEntries, Name: "id", Nullable: false} + GroupHiddenMenuEntriesGroupID = &Col{T: TGroupHiddenMenuEntries, Name: "group_id", Nullable: false} + GroupHiddenMenuEntriesMenuEntry = &Col{T: TGroupHiddenMenuEntries, Name: "menu_entry", Nullable: true} +) + +// Columns of hbmon +var ( + HbmonID = &Col{T: THbmon, Name: "id", Nullable: false} + HbmonNodeID = &Col{T: THbmon, Name: "node_id", Nullable: true} + HbmonPeerNodeID = &Col{T: THbmon, Name: "peer_node_id", Nullable: true} + HbmonHbType = &Col{T: THbmon, Name: "hb_type", Nullable: true} + HbmonHbName = &Col{T: THbmon, Name: "hb_name", Nullable: true} + HbmonHbDesc = &Col{T: THbmon, Name: "hb_desc", Nullable: true} + HbmonHbStatus = &Col{T: THbmon, Name: "hb_status", Nullable: true} + HbmonUpdated = &Col{T: THbmon, Name: "updated", Nullable: false} +) + +// Columns of hbmon_log +var ( + HbmonLogID = &Col{T: THbmonLog, Name: "id", Nullable: false} + HbmonLogNodeID = &Col{T: THbmonLog, Name: "node_id", Nullable: true} + HbmonLogPeerNodeID = &Col{T: THbmonLog, Name: "peer_node_id", Nullable: true} + HbmonLogHbName = &Col{T: THbmonLog, Name: "hb_name", Nullable: true} + HbmonLogHbStatus = &Col{T: THbmonLog, Name: "hb_status", Nullable: true} + HbmonLogHbBegin = &Col{T: THbmonLog, Name: "hb_begin", Nullable: false} + HbmonLogHbEnd = &Col{T: THbmonLog, Name: "hb_end", Nullable: false} +) + +// Columns of hbmon_log_last +var ( + HbmonLogLastID = &Col{T: THbmonLogLast, Name: "id", Nullable: false} + HbmonLogLastNodeID = &Col{T: THbmonLogLast, Name: "node_id", Nullable: true} + HbmonLogLastPeerNodeID = &Col{T: THbmonLogLast, Name: "peer_node_id", Nullable: true} + HbmonLogLastHbName = &Col{T: THbmonLogLast, Name: "hb_name", Nullable: true} + HbmonLogLastHbStatus = &Col{T: THbmonLogLast, Name: "hb_status", Nullable: true} + HbmonLogLastHbBegin = &Col{T: THbmonLogLast, Name: "hb_begin", Nullable: false} + HbmonLogLastHbEnd = &Col{T: THbmonLogLast, Name: "hb_end", Nullable: false} +) + +// Columns of im_types +var ( + ImTypesID = &Col{T: TImTypes, Name: "id", Nullable: false} + ImTypesImType = &Col{T: TImTypes, Name: "im_type", Nullable: false} +) + +// Columns of lifecycle_os +var ( + LifecycleOSID = &Col{T: TLifecycleOS, Name: "id", Nullable: false} + LifecycleOSLcOSConcat = &Col{T: TLifecycleOS, Name: "lc_os_concat", Nullable: false} + LifecycleOSLcCount = &Col{T: TLifecycleOS, Name: "lc_count", Nullable: false} + LifecycleOSLcDate = &Col{T: TLifecycleOS, Name: "lc_date", Nullable: false} + LifecycleOSLcOSName = &Col{T: TLifecycleOS, Name: "lc_os_name", Nullable: true} + LifecycleOSLcOSVendor = &Col{T: TLifecycleOS, Name: "lc_os_vendor", Nullable: true} + LifecycleOSFsetID = &Col{T: TLifecycleOS, Name: "fset_id", Nullable: true} +) + +// Columns of links +var ( + LinksID = &Col{T: TLinks, Name: "id", Nullable: false} + LinksLinkFunction = &Col{T: TLinks, Name: "link_function", Nullable: true} + LinksLinkParameters = &Col{T: TLinks, Name: "link_parameters", Nullable: true} + LinksLinkCreationUserID = &Col{T: TLinks, Name: "link_creation_user_id", Nullable: true} + LinksLinkCreationDate = &Col{T: TLinks, Name: "link_creation_date", Nullable: false} + LinksLinkLastConsultationDate = &Col{T: TLinks, Name: "link_last_consultation_date", Nullable: false} + LinksLinkMD5 = &Col{T: TLinks, Name: "link_md5", Nullable: true} + LinksLinkAccessCounter = &Col{T: TLinks, Name: "link_access_counter", Nullable: true} + LinksLinkTitle = &Col{T: TLinks, Name: "link_title", Nullable: true} + LinksLinkTitleArgs = &Col{T: TLinks, Name: "link_title_args", Nullable: true} +) + +// Columns of log +var ( + LogID = &Col{T: TLog, Name: "id", Nullable: false} + LogLogAction = &Col{T: TLog, Name: "log_action", Nullable: false} + LogLogUser = &Col{T: TLog, Name: "log_user", Nullable: false} + LogLogFmt = &Col{T: TLog, Name: "log_fmt", Nullable: true} + LogLogDict = &Col{T: TLog, Name: "log_dict", Nullable: true} + LogLogDate = &Col{T: TLog, Name: "log_date", Nullable: false} + LogSvcID = &Col{T: TLog, Name: "svc_id", Nullable: true} + LogLogGtalkSent = &Col{T: TLog, Name: "log_gtalk_sent", Nullable: true} + LogLogEmailSent = &Col{T: TLog, Name: "log_email_sent", Nullable: true} + LogLogEntryID = &Col{T: TLog, Name: "log_entry_id", Nullable: true} + LogLogLevel = &Col{T: TLog, Name: "log_level", Nullable: true} + LogNodeID = &Col{T: TLog, Name: "node_id", Nullable: true} +) + +// Columns of metrics +var ( + MetricsID = &Col{T: TMetrics, Name: "id", Nullable: false} + MetricsMetricName = &Col{T: TMetrics, Name: "metric_name", Nullable: false} + MetricsMetricSql = &Col{T: TMetrics, Name: "metric_sql", Nullable: true} + MetricsMetricAuthor = &Col{T: TMetrics, Name: "metric_author", Nullable: true} + MetricsMetricCreated = &Col{T: TMetrics, Name: "metric_created", Nullable: false} + MetricsMetricColValueIndex = &Col{T: TMetrics, Name: "metric_col_value_index", Nullable: true} + MetricsMetricColInstanceIndex = &Col{T: TMetrics, Name: "metric_col_instance_index", Nullable: true} + MetricsMetricColInstanceLabel = &Col{T: TMetrics, Name: "metric_col_instance_label", Nullable: true} + MetricsMetricHistorize = &Col{T: TMetrics, Name: "metric_historize", Nullable: true} +) + +// Columns of metric_team_publication +var ( + MetricTeamPublicationID = &Col{T: TMetricTeamPublication, Name: "id", Nullable: false} + MetricTeamPublicationMetricID = &Col{T: TMetricTeamPublication, Name: "metric_id", Nullable: false} + MetricTeamPublicationGroupID = &Col{T: TMetricTeamPublication, Name: "group_id", Nullable: false} +) + +// Columns of networks +var ( + NetworksID = &Col{T: TNetworks, Name: "id", Nullable: false} + NetworksName = &Col{T: TNetworks, Name: "name", Nullable: true} + NetworksNetwork = &Col{T: TNetworks, Name: "network", Nullable: true} + NetworksNetmask = &Col{T: TNetworks, Name: "netmask", Nullable: true} + NetworksTeamResponsible = &Col{T: TNetworks, Name: "team_responsible", Nullable: true} + NetworksComment = &Col{T: TNetworks, Name: "comment", Nullable: true} + NetworksPvid = &Col{T: TNetworks, Name: "pvid", Nullable: true} + NetworksGateway = &Col{T: TNetworks, Name: "gateway", Nullable: true} + NetworksBegin = &Col{T: TNetworks, Name: "begin", Nullable: true} + NetworksUpdated = &Col{T: TNetworks, Name: "updated", Nullable: false} + NetworksPrio = &Col{T: TNetworks, Name: "prio", Nullable: false} + NetworksEnd = &Col{T: TNetworks, Name: "end", Nullable: true} + NetworksBroadcast = &Col{T: TNetworks, Name: "broadcast", Nullable: true} +) + +// Columns of network_segments +var ( + NetworkSegmentsID = &Col{T: TNetworkSegments, Name: "id", Nullable: false} + NetworkSegmentsNetID = &Col{T: TNetworkSegments, Name: "net_id", Nullable: true} + NetworkSegmentsSegType = &Col{T: TNetworkSegments, Name: "seg_type", Nullable: true} + NetworkSegmentsSegBegin = &Col{T: TNetworkSegments, Name: "seg_begin", Nullable: true} + NetworkSegmentsSegEnd = &Col{T: TNetworkSegments, Name: "seg_end", Nullable: true} +) + +// Columns of network_segment_responsibles +var ( + NetworkSegmentResponsiblesID = &Col{T: TNetworkSegmentResponsibles, Name: "id", Nullable: false} + NetworkSegmentResponsiblesSegID = &Col{T: TNetworkSegmentResponsibles, Name: "seg_id", Nullable: true} + NetworkSegmentResponsiblesGroupID = &Col{T: TNetworkSegmentResponsibles, Name: "group_id", Nullable: true} +) + +// Columns of nodes +var ( + NodesNodename = &Col{T: TNodes, Name: "nodename", Nullable: true} + NodesLocCountry = &Col{T: TNodes, Name: "loc_country", Nullable: true} + NodesLocCity = &Col{T: TNodes, Name: "loc_city", Nullable: true} + NodesLocAddr = &Col{T: TNodes, Name: "loc_addr", Nullable: true} + NodesLocBuilding = &Col{T: TNodes, Name: "loc_building", Nullable: true} + NodesLocFloor = &Col{T: TNodes, Name: "loc_floor", Nullable: true} + NodesLocRoom = &Col{T: TNodes, Name: "loc_room", Nullable: true} + NodesLocRack = &Col{T: TNodes, Name: "loc_rack", Nullable: true} + NodesID = &Col{T: TNodes, Name: "id", Nullable: false} + NodesCPUFreq = &Col{T: TNodes, Name: "cpu_freq", Nullable: true} + NodesCPUCores = &Col{T: TNodes, Name: "cpu_cores", Nullable: true} + NodesCPUDies = &Col{T: TNodes, Name: "cpu_dies", Nullable: true} + NodesCPUVendor = &Col{T: TNodes, Name: "cpu_vendor", Nullable: true} + NodesCPUModel = &Col{T: TNodes, Name: "cpu_model", Nullable: true} + NodesMEMBanks = &Col{T: TNodes, Name: "mem_banks", Nullable: true} + NodesMEMSlots = &Col{T: TNodes, Name: "mem_slots", Nullable: true} + NodesMEMBytes = &Col{T: TNodes, Name: "mem_bytes", Nullable: true} + NodesOSName = &Col{T: TNodes, Name: "os_name", Nullable: true} + NodesOSRelease = &Col{T: TNodes, Name: "os_release", Nullable: true} + NodesOSUpdate = &Col{T: TNodes, Name: "os_update", Nullable: true} + NodesOSSegment = &Col{T: TNodes, Name: "os_segment", Nullable: true} + NodesOSArch = &Col{T: TNodes, Name: "os_arch", Nullable: true} + NodesOSVendor = &Col{T: TNodes, Name: "os_vendor", Nullable: true} + NodesOSKernel = &Col{T: TNodes, Name: "os_kernel", Nullable: true} + NodesLocZip = &Col{T: TNodes, Name: "loc_zip", Nullable: true} + NodesTeamResponsible = &Col{T: TNodes, Name: "team_responsible", Nullable: true} + NodesSerial = &Col{T: TNodes, Name: "serial", Nullable: true} + NodesModel = &Col{T: TNodes, Name: "model", Nullable: true} + NodesType = &Col{T: TNodes, Name: "type", Nullable: true} + NodesWarrantyEnd = &Col{T: TNodes, Name: "warranty_end", Nullable: true} + NodesStatus = &Col{T: TNodes, Name: "status", Nullable: true} + NodesRole = &Col{T: TNodes, Name: "role", Nullable: true} + NodesAssetEnv = &Col{T: TNodes, Name: "asset_env", Nullable: true} + NodesPowerCabinet1 = &Col{T: TNodes, Name: "power_cabinet1", Nullable: true} + NodesPowerCabinet2 = &Col{T: TNodes, Name: "power_cabinet2", Nullable: true} + NodesPowerSupplyNb = &Col{T: TNodes, Name: "power_supply_nb", Nullable: true} + NodesPowerProtect = &Col{T: TNodes, Name: "power_protect", Nullable: true} + NodesPowerProtectBreaker = &Col{T: TNodes, Name: "power_protect_breaker", Nullable: true} + NodesPowerBreaker1 = &Col{T: TNodes, Name: "power_breaker1", Nullable: true} + NodesPowerBreaker2 = &Col{T: TNodes, Name: "power_breaker2", Nullable: true} + NodesBladeCabinet = &Col{T: TNodes, Name: "blade_cabinet", Nullable: true} + NodesUpdated = &Col{T: TNodes, Name: "updated", Nullable: true} + NodesTeamInteg = &Col{T: TNodes, Name: "team_integ", Nullable: true} + NodesApp = &Col{T: TNodes, Name: "app", Nullable: true} + NodesTeamSupport = &Col{T: TNodes, Name: "team_support", Nullable: true} + NodesNodeEnv = &Col{T: TNodes, Name: "node_env", Nullable: true} + NodesMaintenanceEnd = &Col{T: TNodes, Name: "maintenance_end", Nullable: true} + NodesEnclosure = &Col{T: TNodes, Name: "enclosure", Nullable: true} + NodesHWObsWarnDate = &Col{T: TNodes, Name: "hw_obs_warn_date", Nullable: true} + NodesHWObsAlertDate = &Col{T: TNodes, Name: "hw_obs_alert_date", Nullable: true} + NodesOSObsWarnDate = &Col{T: TNodes, Name: "os_obs_warn_date", Nullable: true} + NodesOSObsAlertDate = &Col{T: TNodes, Name: "os_obs_alert_date", Nullable: true} + NodesFqdn = &Col{T: TNodes, Name: "fqdn", Nullable: true} + NodesListenerPort = &Col{T: TNodes, Name: "listener_port", Nullable: true} + NodesVersion = &Col{T: TNodes, Name: "version", Nullable: true} + NodesHvpool = &Col{T: TNodes, Name: "hvpool", Nullable: true} + NodesHv = &Col{T: TNodes, Name: "hv", Nullable: true} + NodesHvvdc = &Col{T: TNodes, Name: "hvvdc", Nullable: true} + NodesCPUThreads = &Col{T: TNodes, Name: "cpu_threads", Nullable: true} + NodesAssetname = &Col{T: TNodes, Name: "assetname", Nullable: true} + NodesEnclosureslot = &Col{T: TNodes, Name: "enclosureslot", Nullable: true} + NodesSecZone = &Col{T: TNodes, Name: "sec_zone", Nullable: true} + NodesLastBoot = &Col{T: TNodes, Name: "last_boot", Nullable: true} + NodesActionType = &Col{T: TNodes, Name: "action_type", Nullable: true} + NodesOSConcat = &Col{T: TNodes, Name: "os_concat", Nullable: true} + NodesConnectTo = &Col{T: TNodes, Name: "connect_to", Nullable: true} + NodesTz = &Col{T: TNodes, Name: "tz", Nullable: true} + NodesNodeID = &Col{T: TNodes, Name: "node_id", Nullable: true} + NodesCollector = &Col{T: TNodes, Name: "collector", Nullable: true} + NodesSpVersion = &Col{T: TNodes, Name: "sp_version", Nullable: true} + NodesBiosVersion = &Col{T: TNodes, Name: "bios_version", Nullable: true} + NodesLastComm = &Col{T: TNodes, Name: "last_comm", Nullable: true} + NodesManufacturer = &Col{T: TNodes, Name: "manufacturer", Nullable: true} + NodesNotifications = &Col{T: TNodes, Name: "notifications", Nullable: true} + NodesSnoozeTill = &Col{T: TNodes, Name: "snooze_till", Nullable: true} + NodesClusterID = &Col{T: TNodes, Name: "cluster_id", Nullable: true} + NodesNodeFrozen = &Col{T: TNodes, Name: "node_frozen", Nullable: true} + NodesNodeFrozenAt = &Col{T: TNodes, Name: "node_frozen_at", Nullable: true} +) + +// Columns of node_groups +var ( + NodeGroupsID = &Col{T: TNodeGroups, Name: "id", Nullable: false} + NodeGroupsGroupName = &Col{T: TNodeGroups, Name: "group_name", Nullable: false} + NodeGroupsGroupID = &Col{T: TNodeGroups, Name: "group_id", Nullable: true} + NodeGroupsUpdated = &Col{T: TNodeGroups, Name: "updated", Nullable: false} + NodeGroupsNodeID = &Col{T: TNodeGroups, Name: "node_id", Nullable: true} +) + +// Columns of node_hba +var ( + NodeHBAID = &Col{T: TNodeHBA, Name: "id", Nullable: false} + NodeHBAUpdated = &Col{T: TNodeHBA, Name: "updated", Nullable: false} + NodeHBAHBAID = &Col{T: TNodeHBA, Name: "hba_id", Nullable: false} + NodeHBAHBAType = &Col{T: TNodeHBA, Name: "hba_type", Nullable: true} + NodeHBANodeID = &Col{T: TNodeHBA, Name: "node_id", Nullable: true} +) + +// Columns of node_hw +var ( + NodeHWID = &Col{T: TNodeHW, Name: "id", Nullable: false} + NodeHWNodeID = &Col{T: TNodeHW, Name: "node_id", Nullable: true} + NodeHWHWType = &Col{T: TNodeHW, Name: "hw_type", Nullable: true} + NodeHWHWPath = &Col{T: TNodeHW, Name: "hw_path", Nullable: false} + NodeHWHWClass = &Col{T: TNodeHW, Name: "hw_class", Nullable: false} + NodeHWHWDescription = &Col{T: TNodeHW, Name: "hw_description", Nullable: false} + NodeHWHWDriver = &Col{T: TNodeHW, Name: "hw_driver", Nullable: false} + NodeHWUpdated = &Col{T: TNodeHW, Name: "updated", Nullable: false} +) + +// Columns of node_ip +var ( + NodeIPID = &Col{T: TNodeIP, Name: "id", Nullable: false} + NodeIPMac = &Col{T: TNodeIP, Name: "mac", Nullable: false} + NodeIPIntf = &Col{T: TNodeIP, Name: "intf", Nullable: true} + NodeIPType = &Col{T: TNodeIP, Name: "type", Nullable: true} + NodeIPAddr = &Col{T: TNodeIP, Name: "addr", Nullable: true} + NodeIPMask = &Col{T: TNodeIP, Name: "mask", Nullable: true} + NodeIPUpdated = &Col{T: TNodeIP, Name: "updated", Nullable: false} + NodeIPFlagDeprecated = &Col{T: TNodeIP, Name: "flag_deprecated", Nullable: true} + NodeIPNodeID = &Col{T: TNodeIP, Name: "node_id", Nullable: true} +) + +// Columns of node_pw +var ( + NodePWID = &Col{T: TNodePW, Name: "id", Nullable: false} + NodePWPW = &Col{T: TNodePW, Name: "pw", Nullable: false} + NodePWUpdated = &Col{T: TNodePW, Name: "updated", Nullable: false} + NodePWNodeID = &Col{T: TNodePW, Name: "node_id", Nullable: true} +) + +// Columns of node_tags +var ( + NodeTagsID = &Col{T: TNodeTags, Name: "id", Nullable: false} + NodeTagsCreated = &Col{T: TNodeTags, Name: "created", Nullable: false} + NodeTagsNodeID = &Col{T: TNodeTags, Name: "node_id", Nullable: true} + NodeTagsTagID = &Col{T: TNodeTags, Name: "tag_id", Nullable: true} + NodeTagsTagAttachData = &Col{T: TNodeTags, Name: "tag_attach_data", Nullable: true} +) + +// Columns of node_users +var ( + NodeUsersID = &Col{T: TNodeUsers, Name: "id", Nullable: false} + NodeUsersUserName = &Col{T: TNodeUsers, Name: "user_name", Nullable: false} + NodeUsersUserID = &Col{T: TNodeUsers, Name: "user_id", Nullable: true} + NodeUsersUpdated = &Col{T: TNodeUsers, Name: "updated", Nullable: false} + NodeUsersNodeID = &Col{T: TNodeUsers, Name: "node_id", Nullable: true} +) + +// Columns of obsolescence +var ( + ObsolescenceID = &Col{T: TObsolescence, Name: "id", Nullable: false} + ObsolescenceObsType = &Col{T: TObsolescence, Name: "obs_type", Nullable: false} + ObsolescenceObsName = &Col{T: TObsolescence, Name: "obs_name", Nullable: false} + ObsolescenceObsWarnDate = &Col{T: TObsolescence, Name: "obs_warn_date", Nullable: true} + ObsolescenceObsAlertDate = &Col{T: TObsolescence, Name: "obs_alert_date", Nullable: true} + ObsolescenceObsWarnDateUpdatedBy = &Col{T: TObsolescence, Name: "obs_warn_date_updated_by", Nullable: false} + ObsolescenceObsAlertDateUpdatedBy = &Col{T: TObsolescence, Name: "obs_alert_date_updated_by", Nullable: false} + ObsolescenceObsWarnDateUpdated = &Col{T: TObsolescence, Name: "obs_warn_date_updated", Nullable: false} + ObsolescenceObsAlertDateUpdated = &Col{T: TObsolescence, Name: "obs_alert_date_updated", Nullable: false} +) + +// Columns of oc3_scheduler +var ( + Oc3SchedulerID = &Col{T: TOc3Scheduler, Name: "id", Nullable: false} + Oc3SchedulerTaskName = &Col{T: TOc3Scheduler, Name: "task_name", Nullable: true} + Oc3SchedulerIsDisabled = &Col{T: TOc3Scheduler, Name: "is_disabled", Nullable: true} + Oc3SchedulerLastRunAt = &Col{T: TOc3Scheduler, Name: "last_run_at", Nullable: true} +) + +// Columns of packages +var ( + PackagesID = &Col{T: TPackages, Name: "id", Nullable: false} + PackagesPkgName = &Col{T: TPackages, Name: "pkg_name", Nullable: false} + PackagesPkgVersion = &Col{T: TPackages, Name: "pkg_version", Nullable: false} + PackagesPkgArch = &Col{T: TPackages, Name: "pkg_arch", Nullable: false} + PackagesPkgUpdated = &Col{T: TPackages, Name: "pkg_updated", Nullable: false} + PackagesPkgType = &Col{T: TPackages, Name: "pkg_type", Nullable: true} + PackagesPkgInstallDate = &Col{T: TPackages, Name: "pkg_install_date", Nullable: true} + PackagesPkgSig = &Col{T: TPackages, Name: "pkg_sig", Nullable: true} + PackagesNodeID = &Col{T: TPackages, Name: "node_id", Nullable: true} +) + +// Columns of patches +var ( + PatchesID = &Col{T: TPatches, Name: "id", Nullable: false} + PatchesPatchNum = &Col{T: TPatches, Name: "patch_num", Nullable: false} + PatchesPatchRev = &Col{T: TPatches, Name: "patch_rev", Nullable: false} + PatchesPatchUpdated = &Col{T: TPatches, Name: "patch_updated", Nullable: false} + PatchesPatchInstallDate = &Col{T: TPatches, Name: "patch_install_date", Nullable: true} + PatchesNodeID = &Col{T: TPatches, Name: "node_id", Nullable: true} +) + +// Columns of pkg_sig_provider +var ( + PkgSigProviderID = &Col{T: TPkgSigProvider, Name: "id", Nullable: false} + PkgSigProviderSigID = &Col{T: TPkgSigProvider, Name: "sig_id", Nullable: false} + PkgSigProviderSigProvider = &Col{T: TPkgSigProvider, Name: "sig_provider", Nullable: false} +) + +// Columns of prov_templates +var ( + ProvTemplatesID = &Col{T: TProvTemplates, Name: "id", Nullable: false} + ProvTemplatesTplName = &Col{T: TProvTemplates, Name: "tpl_name", Nullable: false} + ProvTemplatesTplDefinition = &Col{T: TProvTemplates, Name: "tpl_definition", Nullable: true} + ProvTemplatesTplComment = &Col{T: TProvTemplates, Name: "tpl_comment", Nullable: false} + ProvTemplatesTplAuthor = &Col{T: TProvTemplates, Name: "tpl_author", Nullable: false} + ProvTemplatesTplCreated = &Col{T: TProvTemplates, Name: "tpl_created", Nullable: false} +) + +// Columns of prov_template_team_publication +var ( + ProvTemplateTeamPublicationID = &Col{T: TProvTemplateTeamPublication, Name: "id", Nullable: false} + ProvTemplateTeamPublicationTplID = &Col{T: TProvTemplateTeamPublication, Name: "tpl_id", Nullable: false} + ProvTemplateTeamPublicationGroupID = &Col{T: TProvTemplateTeamPublication, Name: "group_id", Nullable: false} +) + +// Columns of prov_template_team_responsible +var ( + ProvTemplateTeamResponsibleID = &Col{T: TProvTemplateTeamResponsible, Name: "id", Nullable: false} + ProvTemplateTeamResponsibleTplID = &Col{T: TProvTemplateTeamResponsible, Name: "tpl_id", Nullable: false} + ProvTemplateTeamResponsibleGroupID = &Col{T: TProvTemplateTeamResponsible, Name: "group_id", Nullable: false} +) + +// Columns of replication_status +var ( + ReplicationStatusID = &Col{T: TReplicationStatus, Name: "id", Nullable: false} + ReplicationStatusRemote = &Col{T: TReplicationStatus, Name: "remote", Nullable: false} + ReplicationStatusMode = &Col{T: TReplicationStatus, Name: "mode", Nullable: true} + ReplicationStatusTableSchema = &Col{T: TReplicationStatus, Name: "table_schema", Nullable: false} + ReplicationStatusTableName = &Col{T: TReplicationStatus, Name: "table_name", Nullable: false} + ReplicationStatusTableCksum = &Col{T: TReplicationStatus, Name: "table_cksum", Nullable: false} + ReplicationStatusTableUpdated = &Col{T: TReplicationStatus, Name: "table_updated", Nullable: true} +) + +// Columns of reports +var ( + ReportsID = &Col{T: TReports, Name: "id", Nullable: false} + ReportsReportName = &Col{T: TReports, Name: "report_name", Nullable: false} + ReportsReportYaml = &Col{T: TReports, Name: "report_yaml", Nullable: true} +) + +// Columns of reports_user +var ( + ReportsUserID = &Col{T: TReportsUser, Name: "id", Nullable: false} + ReportsUserReportID = &Col{T: TReportsUser, Name: "report_id", Nullable: false} + ReportsUserUserID = &Col{T: TReportsUser, Name: "user_id", Nullable: false} +) + +// Columns of report_team_publication +var ( + ReportTeamPublicationID = &Col{T: TReportTeamPublication, Name: "id", Nullable: false} + ReportTeamPublicationReportID = &Col{T: TReportTeamPublication, Name: "report_id", Nullable: false} + ReportTeamPublicationGroupID = &Col{T: TReportTeamPublication, Name: "group_id", Nullable: false} +) + +// Columns of report_team_responsible +var ( + ReportTeamResponsibleID = &Col{T: TReportTeamResponsible, Name: "id", Nullable: false} + ReportTeamResponsibleReportID = &Col{T: TReportTeamResponsible, Name: "report_id", Nullable: false} + ReportTeamResponsibleGroupID = &Col{T: TReportTeamResponsible, Name: "group_id", Nullable: false} +) + +// Columns of resinfo +var ( + ResinfoID = &Col{T: TResinfo, Name: "id", Nullable: false} + ResinfoRid = &Col{T: TResinfo, Name: "rid", Nullable: true} + ResinfoResKey = &Col{T: TResinfo, Name: "res_key", Nullable: true} + ResinfoResValue = &Col{T: TResinfo, Name: "res_value", Nullable: true} + ResinfoUpdated = &Col{T: TResinfo, Name: "updated", Nullable: false} + ResinfoTopology = &Col{T: TResinfo, Name: "topology", Nullable: true} + ResinfoNodeID = &Col{T: TResinfo, Name: "node_id", Nullable: true} + ResinfoSvcID = &Col{T: TResinfo, Name: "svc_id", Nullable: true} +) + +// Columns of resmon +var ( + ResmonID = &Col{T: TResmon, Name: "id", Nullable: false} + ResmonRid = &Col{T: TResmon, Name: "rid", Nullable: true} + ResmonResStatus = &Col{T: TResmon, Name: "res_status", Nullable: true} + ResmonChanged = &Col{T: TResmon, Name: "changed", Nullable: false} + ResmonUpdated = &Col{T: TResmon, Name: "updated", Nullable: false} + ResmonResDesc = &Col{T: TResmon, Name: "res_desc", Nullable: true} + ResmonResLog = &Col{T: TResmon, Name: "res_log", Nullable: true} + ResmonVmname = &Col{T: TResmon, Name: "vmname", Nullable: true} + ResmonResMonitor = &Col{T: TResmon, Name: "res_monitor", Nullable: true} + ResmonResDisable = &Col{T: TResmon, Name: "res_disable", Nullable: true} + ResmonResOptional = &Col{T: TResmon, Name: "res_optional", Nullable: true} + ResmonResType = &Col{T: TResmon, Name: "res_type", Nullable: true} + ResmonNodeID = &Col{T: TResmon, Name: "node_id", Nullable: true} + ResmonSvcID = &Col{T: TResmon, Name: "svc_id", Nullable: true} +) + +// Columns of resmon_log +var ( + ResmonLogID = &Col{T: TResmonLog, Name: "id", Nullable: false} + ResmonLogNodeID = &Col{T: TResmonLog, Name: "node_id", Nullable: true} + ResmonLogSvcID = &Col{T: TResmonLog, Name: "svc_id", Nullable: true} + ResmonLogRid = &Col{T: TResmonLog, Name: "rid", Nullable: true} + ResmonLogResStatus = &Col{T: TResmonLog, Name: "res_status", Nullable: true} + ResmonLogResBegin = &Col{T: TResmonLog, Name: "res_begin", Nullable: false} + ResmonLogResEnd = &Col{T: TResmonLog, Name: "res_end", Nullable: false} + ResmonLogResLog = &Col{T: TResmonLog, Name: "res_log", Nullable: true} +) + +// Columns of resmon_log_last +var ( + ResmonLogLastID = &Col{T: TResmonLogLast, Name: "id", Nullable: false} + ResmonLogLastNodeID = &Col{T: TResmonLogLast, Name: "node_id", Nullable: true} + ResmonLogLastSvcID = &Col{T: TResmonLogLast, Name: "svc_id", Nullable: true} + ResmonLogLastRid = &Col{T: TResmonLogLast, Name: "rid", Nullable: true} + ResmonLogLastResStatus = &Col{T: TResmonLogLast, Name: "res_status", Nullable: true} + ResmonLogLastResBegin = &Col{T: TResmonLogLast, Name: "res_begin", Nullable: false} + ResmonLogLastResEnd = &Col{T: TResmonLogLast, Name: "res_end", Nullable: false} + ResmonLogLastResLog = &Col{T: TResmonLogLast, Name: "res_log", Nullable: true} +) + +// Columns of safe +var ( + SafeID = &Col{T: TSafe, Name: "id", Nullable: false} + SafeUploader = &Col{T: TSafe, Name: "uploader", Nullable: true} + SafeUploadedFrom = &Col{T: TSafe, Name: "uploaded_from", Nullable: true} + SafeUploadedDate = &Col{T: TSafe, Name: "uploaded_date", Nullable: false} + SafeName = &Col{T: TSafe, Name: "name", Nullable: true} + SafeSize = &Col{T: TSafe, Name: "size", Nullable: true} + SafeUuid = &Col{T: TSafe, Name: "uuid", Nullable: true} + SafeMD5 = &Col{T: TSafe, Name: "md5", Nullable: true} +) + +// Columns of safe_log +var ( + SafeLogID = &Col{T: TSafeLog, Name: "id", Nullable: false} + SafeLogSafeID = &Col{T: TSafeLog, Name: "safe_id", Nullable: false} + SafeLogUuid = &Col{T: TSafeLog, Name: "uuid", Nullable: false} + SafeLogArchived = &Col{T: TSafeLog, Name: "archived", Nullable: false} +) + +// Columns of safe_team_publication +var ( + SafeTeamPublicationID = &Col{T: TSafeTeamPublication, Name: "id", Nullable: false} + SafeTeamPublicationFileID = &Col{T: TSafeTeamPublication, Name: "file_id", Nullable: false} + SafeTeamPublicationGroupID = &Col{T: TSafeTeamPublication, Name: "group_id", Nullable: false} +) + +// Columns of safe_team_responsible +var ( + SafeTeamResponsibleID = &Col{T: TSafeTeamResponsible, Name: "id", Nullable: false} + SafeTeamResponsibleFileID = &Col{T: TSafeTeamResponsible, Name: "file_id", Nullable: false} + SafeTeamResponsibleGroupID = &Col{T: TSafeTeamResponsible, Name: "group_id", Nullable: false} +) + +// Columns of san_zone +var ( + SANZoneID = &Col{T: TSANZone, Name: "id", Nullable: false} + SANZoneCfg = &Col{T: TSANZone, Name: "cfg", Nullable: true} + SANZoneZone = &Col{T: TSANZone, Name: "zone", Nullable: true} + SANZonePort = &Col{T: TSANZone, Name: "port", Nullable: true} + SANZoneUpdated = &Col{T: TSANZone, Name: "updated", Nullable: false} +) + +// Columns of san_zone_alias +var ( + SANZoneAliasID = &Col{T: TSANZoneAlias, Name: "id", Nullable: false} + SANZoneAliasCfg = &Col{T: TSANZoneAlias, Name: "cfg", Nullable: true} + SANZoneAliasAlias = &Col{T: TSANZoneAlias, Name: "alias", Nullable: true} + SANZoneAliasPort = &Col{T: TSANZoneAlias, Name: "port", Nullable: true} + SANZoneAliasUpdated = &Col{T: TSANZoneAlias, Name: "updated", Nullable: false} +) + +// Columns of saves +var ( + SavesID = &Col{T: TSaves, Name: "id", Nullable: false} + SavesSaveName = &Col{T: TSaves, Name: "save_name", Nullable: false} + SavesSaveGroup = &Col{T: TSaves, Name: "save_group", Nullable: false} + SavesSaveSize = &Col{T: TSaves, Name: "save_size", Nullable: true} + SavesSaveDate = &Col{T: TSaves, Name: "save_date", Nullable: false} + SavesSaveRetention = &Col{T: TSaves, Name: "save_retention", Nullable: false} + SavesSaveVolume = &Col{T: TSaves, Name: "save_volume", Nullable: false} + SavesSaveLevel = &Col{T: TSaves, Name: "save_level", Nullable: false} + SavesSaveServer = &Col{T: TSaves, Name: "save_server", Nullable: false} + SavesSaveApp = &Col{T: TSaves, Name: "save_app", Nullable: true} + SavesSaveID = &Col{T: TSaves, Name: "save_id", Nullable: true} + SavesNodeID = &Col{T: TSaves, Name: "node_id", Nullable: true} + SavesSvcID = &Col{T: TSaves, Name: "svc_id", Nullable: true} + SavesChkInstance = &Col{T: TSaves, Name: "chk_instance", Nullable: true} + SavesSaveResolved = &Col{T: TSaves, Name: "save_resolved", Nullable: true} +) + +// Columns of saves_last +var ( + SavesLastID = &Col{T: TSavesLast, Name: "id", Nullable: false} + SavesLastSaveName = &Col{T: TSavesLast, Name: "save_name", Nullable: false} + SavesLastSaveGroup = &Col{T: TSavesLast, Name: "save_group", Nullable: false} + SavesLastSaveSize = &Col{T: TSavesLast, Name: "save_size", Nullable: true} + SavesLastSaveDate = &Col{T: TSavesLast, Name: "save_date", Nullable: false} + SavesLastSaveRetention = &Col{T: TSavesLast, Name: "save_retention", Nullable: false} + SavesLastSaveVolume = &Col{T: TSavesLast, Name: "save_volume", Nullable: false} + SavesLastSaveLevel = &Col{T: TSavesLast, Name: "save_level", Nullable: false} + SavesLastSaveServer = &Col{T: TSavesLast, Name: "save_server", Nullable: false} + SavesLastSaveApp = &Col{T: TSavesLast, Name: "save_app", Nullable: true} + SavesLastSaveID = &Col{T: TSavesLast, Name: "save_id", Nullable: true} + SavesLastChkInstance = &Col{T: TSavesLast, Name: "chk_instance", Nullable: true} + SavesLastSaveResolved = &Col{T: TSavesLast, Name: "save_resolved", Nullable: true} + SavesLastNodeID = &Col{T: TSavesLast, Name: "node_id", Nullable: true} + SavesLastSvcID = &Col{T: TSavesLast, Name: "svc_id", Nullable: true} +) + +// Columns of scheduler_run +var ( + SchedulerRunID = &Col{T: TSchedulerRun, Name: "id", Nullable: false} + SchedulerRunTaskID = &Col{T: TSchedulerRun, Name: "task_id", Nullable: true} + SchedulerRunStartTime = &Col{T: TSchedulerRun, Name: "start_time", Nullable: true} + SchedulerRunStopTime = &Col{T: TSchedulerRun, Name: "stop_time", Nullable: true} + SchedulerRunRunOutput = &Col{T: TSchedulerRun, Name: "run_output", Nullable: true} + SchedulerRunRunResult = &Col{T: TSchedulerRun, Name: "run_result", Nullable: true} + SchedulerRunTraceback = &Col{T: TSchedulerRun, Name: "traceback", Nullable: true} + SchedulerRunStatus = &Col{T: TSchedulerRun, Name: "status", Nullable: true} + SchedulerRunWorkerName = &Col{T: TSchedulerRun, Name: "worker_name", Nullable: true} + SchedulerRunDuration = &Col{T: TSchedulerRun, Name: "duration", Nullable: true} +) + +// Columns of scheduler_task +var ( + SchedulerTaskID = &Col{T: TSchedulerTask, Name: "id", Nullable: false} + SchedulerTaskUuid = &Col{T: TSchedulerTask, Name: "uuid", Nullable: true} + SchedulerTaskArgs = &Col{T: TSchedulerTask, Name: "args", Nullable: true} + SchedulerTaskVars = &Col{T: TSchedulerTask, Name: "vars", Nullable: true} + SchedulerTaskEnabled = &Col{T: TSchedulerTask, Name: "enabled", Nullable: true} + SchedulerTaskStartTime = &Col{T: TSchedulerTask, Name: "start_time", Nullable: true} + SchedulerTaskNextRunTime = &Col{T: TSchedulerTask, Name: "next_run_time", Nullable: true} + SchedulerTaskStopTime = &Col{T: TSchedulerTask, Name: "stop_time", Nullable: true} + SchedulerTaskRepeats = &Col{T: TSchedulerTask, Name: "repeats", Nullable: true} + SchedulerTaskRetryFailed = &Col{T: TSchedulerTask, Name: "retry_failed", Nullable: true} + SchedulerTaskPeriod = &Col{T: TSchedulerTask, Name: "period", Nullable: true} + SchedulerTaskTimeout = &Col{T: TSchedulerTask, Name: "timeout", Nullable: true} + SchedulerTaskSyncOutput = &Col{T: TSchedulerTask, Name: "sync_output", Nullable: true} + SchedulerTaskTimesRun = &Col{T: TSchedulerTask, Name: "times_run", Nullable: true} + SchedulerTaskTimesFailed = &Col{T: TSchedulerTask, Name: "times_failed", Nullable: true} + SchedulerTaskLastRunTime = &Col{T: TSchedulerTask, Name: "last_run_time", Nullable: true} + SchedulerTaskPreventDrift = &Col{T: TSchedulerTask, Name: "prevent_drift", Nullable: true} + SchedulerTaskGroupName = &Col{T: TSchedulerTask, Name: "group_name", Nullable: true} + SchedulerTaskFunctionName = &Col{T: TSchedulerTask, Name: "function_name", Nullable: true} + SchedulerTaskStatus = &Col{T: TSchedulerTask, Name: "status", Nullable: true} + SchedulerTaskTaskName = &Col{T: TSchedulerTask, Name: "task_name", Nullable: true} + SchedulerTaskApplicationName = &Col{T: TSchedulerTask, Name: "application_name", Nullable: true} + SchedulerTaskAssignedWorkerName = &Col{T: TSchedulerTask, Name: "assigned_worker_name", Nullable: true} +) + +// Columns of scheduler_task_deps +var ( + SchedulerTaskDepsID = &Col{T: TSchedulerTaskDeps, Name: "id", Nullable: false} + SchedulerTaskDepsJobName = &Col{T: TSchedulerTaskDeps, Name: "job_name", Nullable: true} + SchedulerTaskDepsTaskParent = &Col{T: TSchedulerTaskDeps, Name: "task_parent", Nullable: true} + SchedulerTaskDepsTaskChild = &Col{T: TSchedulerTaskDeps, Name: "task_child", Nullable: true} + SchedulerTaskDepsCanVisit = &Col{T: TSchedulerTaskDeps, Name: "can_visit", Nullable: true} +) + +// Columns of scheduler_worker +var ( + SchedulerWorkerID = &Col{T: TSchedulerWorker, Name: "id", Nullable: false} + SchedulerWorkerWorkerName = &Col{T: TSchedulerWorker, Name: "worker_name", Nullable: true} + SchedulerWorkerFirstHeartbeat = &Col{T: TSchedulerWorker, Name: "first_heartbeat", Nullable: true} + SchedulerWorkerLastHeartbeat = &Col{T: TSchedulerWorker, Name: "last_heartbeat", Nullable: true} + SchedulerWorkerIsTicker = &Col{T: TSchedulerWorker, Name: "is_ticker", Nullable: true} + SchedulerWorkerGroupNames = &Col{T: TSchedulerWorker, Name: "group_names", Nullable: true} + SchedulerWorkerStatus = &Col{T: TSchedulerWorker, Name: "status", Nullable: true} + SchedulerWorkerWorkerStats = &Col{T: TSchedulerWorker, Name: "worker_stats", Nullable: true} +) + +// Columns of services +var ( + ServicesSvcHostid = &Col{T: TServices, Name: "svc_hostid", Nullable: true} + ServicesSvcname = &Col{T: TServices, Name: "svcname", Nullable: true} + ServicesSvcNodes = &Col{T: TServices, Name: "svc_nodes", Nullable: true} + ServicesSvcDrpnode = &Col{T: TServices, Name: "svc_drpnode", Nullable: true} + ServicesSvcDrptype = &Col{T: TServices, Name: "svc_drptype", Nullable: true} + ServicesSvcAutostart = &Col{T: TServices, Name: "svc_autostart", Nullable: false} + ServicesSvcEnv = &Col{T: TServices, Name: "svc_env", Nullable: true} + ServicesSvcDrpnodes = &Col{T: TServices, Name: "svc_drpnodes", Nullable: true} + ServicesSvcComment = &Col{T: TServices, Name: "svc_comment", Nullable: true} + ServicesSvcApp = &Col{T: TServices, Name: "svc_app", Nullable: true} + ServicesSvcDrnoaction = &Col{T: TServices, Name: "svc_drnoaction", Nullable: true} + ServicesSvcCreated = &Col{T: TServices, Name: "svc_created", Nullable: false} + ServicesSvcConfigUpdated = &Col{T: TServices, Name: "svc_config_updated", Nullable: true} + ServicesSvcMetrocluster = &Col{T: TServices, Name: "svc_metrocluster", Nullable: true} + ServicesID = &Col{T: TServices, Name: "id", Nullable: false} + ServicesSvcWave = &Col{T: TServices, Name: "svc_wave", Nullable: false} + ServicesSvcConfig = &Col{T: TServices, Name: "svc_config", Nullable: true} + ServicesUpdated = &Col{T: TServices, Name: "updated", Nullable: true} + ServicesSvcTopology = &Col{T: TServices, Name: "svc_topology", Nullable: true} + ServicesSvcFlexMinNodes = &Col{T: TServices, Name: "svc_flex_min_nodes", Nullable: true} + ServicesSvcFlexMaxNodes = &Col{T: TServices, Name: "svc_flex_max_nodes", Nullable: true} + ServicesSvcFlexCPULowThreshold = &Col{T: TServices, Name: "svc_flex_cpu_low_threshold", Nullable: true} + ServicesSvcFlexCPUHighThreshold = &Col{T: TServices, Name: "svc_flex_cpu_high_threshold", Nullable: true} + ServicesSvcStatus = &Col{T: TServices, Name: "svc_status", Nullable: true} + ServicesSvcAvailstatus = &Col{T: TServices, Name: "svc_availstatus", Nullable: true} + ServicesSvcHa = &Col{T: TServices, Name: "svc_ha", Nullable: true} + ServicesSvcStatusUpdated = &Col{T: TServices, Name: "svc_status_updated", Nullable: true} + ServicesSvcID = &Col{T: TServices, Name: "svc_id", Nullable: true} + ServicesSvcFrozen = &Col{T: TServices, Name: "svc_frozen", Nullable: true} + ServicesSvcProvisioned = &Col{T: TServices, Name: "svc_provisioned", Nullable: true} + ServicesSvcPlacement = &Col{T: TServices, Name: "svc_placement", Nullable: true} + ServicesSvcNotifications = &Col{T: TServices, Name: "svc_notifications", Nullable: true} + ServicesSvcSnoozeTill = &Col{T: TServices, Name: "svc_snooze_till", Nullable: true} + ServicesClusterID = &Col{T: TServices, Name: "cluster_id", Nullable: true} + ServicesSvcFlexTarget = &Col{T: TServices, Name: "svc_flex_target", Nullable: true} +) + +// Columns of services_log +var ( + ServicesLogID = &Col{T: TServicesLog, Name: "id", Nullable: false} + ServicesLogSvcAvailstatus = &Col{T: TServicesLog, Name: "svc_availstatus", Nullable: false} + ServicesLogSvcBegin = &Col{T: TServicesLog, Name: "svc_begin", Nullable: false} + ServicesLogSvcEnd = &Col{T: TServicesLog, Name: "svc_end", Nullable: false} + ServicesLogSvcID = &Col{T: TServicesLog, Name: "svc_id", Nullable: true} +) + +// Columns of services_log_last +var ( + ServicesLogLastID = &Col{T: TServicesLogLast, Name: "id", Nullable: false} + ServicesLogLastSvcAvailstatus = &Col{T: TServicesLogLast, Name: "svc_availstatus", Nullable: false} + ServicesLogLastSvcBegin = &Col{T: TServicesLogLast, Name: "svc_begin", Nullable: false} + ServicesLogLastSvcEnd = &Col{T: TServicesLogLast, Name: "svc_end", Nullable: false} + ServicesLogLastSvcID = &Col{T: TServicesLogLast, Name: "svc_id", Nullable: true} +) + +// Columns of services_test +var ( + ServicesTestName = &Col{T: TServicesTest, Name: "name", Nullable: true} + ServicesTestApp = &Col{T: TServicesTest, Name: "app", Nullable: true} + ServicesTestID = &Col{T: TServicesTest, Name: "id", Nullable: false} + ServicesTestSvcID = &Col{T: TServicesTest, Name: "svc_id", Nullable: true} +) + +// Columns of service_ids +var ( + ServiceIdsSvcname = &Col{T: TServiceIds, Name: "svcname", Nullable: true} + ServiceIdsClusterID = &Col{T: TServiceIds, Name: "cluster_id", Nullable: true} + ServiceIdsID = &Col{T: TServiceIds, Name: "id", Nullable: false} + ServiceIdsSvcID = &Col{T: TServiceIds, Name: "svc_id", Nullable: true} +) + +// Columns of stats_compare +var ( + StatsCompareID = &Col{T: TStatsCompare, Name: "id", Nullable: false} + StatsCompareName = &Col{T: TStatsCompare, Name: "name", Nullable: false} +) + +// Columns of stats_compare_fset +var ( + StatsCompareFsetID = &Col{T: TStatsCompareFset, Name: "id", Nullable: false} + StatsCompareFsetCompareID = &Col{T: TStatsCompareFset, Name: "compare_id", Nullable: false} + StatsCompareFsetFsetID = &Col{T: TStatsCompareFset, Name: "fset_id", Nullable: false} +) + +// Columns of stats_compare_user +var ( + StatsCompareUserID = &Col{T: TStatsCompareUser, Name: "id", Nullable: false} + StatsCompareUserCompareID = &Col{T: TStatsCompareUser, Name: "compare_id", Nullable: false} + StatsCompareUserUserID = &Col{T: TStatsCompareUser, Name: "user_id", Nullable: false} +) + +// Columns of stat_day +var ( + StatDayID = &Col{T: TStatDay, Name: "id", Nullable: false} + StatDayDay = &Col{T: TStatDay, Name: "day", Nullable: false} + StatDayNbSvc = &Col{T: TStatDay, Name: "nb_svc", Nullable: false} + StatDayNbAction = &Col{T: TStatDay, Name: "nb_action", Nullable: false} + StatDayNbActionErr = &Col{T: TStatDay, Name: "nb_action_err", Nullable: false} + StatDayNbActionWarn = &Col{T: TStatDay, Name: "nb_action_warn", Nullable: false} + StatDayNbActionOk = &Col{T: TStatDay, Name: "nb_action_ok", Nullable: false} + StatDayDiskSize = &Col{T: TStatDay, Name: "disk_size", Nullable: false} + StatDayRamSize = &Col{T: TStatDay, Name: "ram_size", Nullable: true} + StatDayNbCPUCore = &Col{T: TStatDay, Name: "nb_cpu_core", Nullable: true} + StatDayNbCPUDie = &Col{T: TStatDay, Name: "nb_cpu_die", Nullable: true} + StatDayWatt = &Col{T: TStatDay, Name: "watt", Nullable: true} + StatDayRackunit = &Col{T: TStatDay, Name: "rackunit", Nullable: true} + StatDayNbApps = &Col{T: TStatDay, Name: "nb_apps", Nullable: false} + StatDayNbAccounts = &Col{T: TStatDay, Name: "nb_accounts", Nullable: false} + StatDayNbSvcWithDRP = &Col{T: TStatDay, Name: "nb_svc_with_drp", Nullable: false} + StatDayNbNodes = &Col{T: TStatDay, Name: "nb_nodes", Nullable: false} + StatDayNbSvcPrd = &Col{T: TStatDay, Name: "nb_svc_prd", Nullable: true} + StatDayNbSvcCluster = &Col{T: TStatDay, Name: "nb_svc_cluster", Nullable: true} + StatDayNbNodesPrd = &Col{T: TStatDay, Name: "nb_nodes_prd", Nullable: true} + StatDayFsetID = &Col{T: TStatDay, Name: "fset_id", Nullable: true} + StatDayNbVcpu = &Col{T: TStatDay, Name: "nb_vcpu", Nullable: true} + StatDayNbVmem = &Col{T: TStatDay, Name: "nb_vmem", Nullable: true} + StatDayNbRespAccounts = &Col{T: TStatDay, Name: "nb_resp_accounts", Nullable: true} + StatDayNbVirtNodes = &Col{T: TStatDay, Name: "nb_virt_nodes", Nullable: true} + StatDayLocalDiskSize = &Col{T: TStatDay, Name: "local_disk_size", Nullable: false} +) + +// Columns of stat_day_disk_app +var ( + StatDayDiskAppID = &Col{T: TStatDayDiskApp, Name: "id", Nullable: false} + StatDayDiskAppDay = &Col{T: TStatDayDiskApp, Name: "day", Nullable: false} + StatDayDiskAppApp = &Col{T: TStatDayDiskApp, Name: "app", Nullable: false} + StatDayDiskAppDiskUsed = &Col{T: TStatDayDiskApp, Name: "disk_used", Nullable: true} + StatDayDiskAppQuota = &Col{T: TStatDayDiskApp, Name: "quota", Nullable: true} +) + +// Columns of stat_day_disk_app_dg +var ( + StatDayDiskAppDGID = &Col{T: TStatDayDiskAppDG, Name: "id", Nullable: false} + StatDayDiskAppDGDay = &Col{T: TStatDayDiskAppDG, Name: "day", Nullable: false} + StatDayDiskAppDGDGID = &Col{T: TStatDayDiskAppDG, Name: "dg_id", Nullable: false} + StatDayDiskAppDGApp = &Col{T: TStatDayDiskAppDG, Name: "app", Nullable: false} + StatDayDiskAppDGDiskUsed = &Col{T: TStatDayDiskAppDG, Name: "disk_used", Nullable: true} + StatDayDiskAppDGQuota = &Col{T: TStatDayDiskAppDG, Name: "quota", Nullable: true} +) + +// Columns of stat_day_disk_array +var ( + StatDayDiskArrayID = &Col{T: TStatDayDiskArray, Name: "id", Nullable: false} + StatDayDiskArrayDay = &Col{T: TStatDayDiskArray, Name: "day", Nullable: false} + StatDayDiskArrayArrayName = &Col{T: TStatDayDiskArray, Name: "array_name", Nullable: false} + StatDayDiskArrayDiskUsed = &Col{T: TStatDayDiskArray, Name: "disk_used", Nullable: true} + StatDayDiskArrayDiskSize = &Col{T: TStatDayDiskArray, Name: "disk_size", Nullable: true} + StatDayDiskArrayReservable = &Col{T: TStatDayDiskArray, Name: "reservable", Nullable: true} + StatDayDiskArrayReserved = &Col{T: TStatDayDiskArray, Name: "reserved", Nullable: true} +) + +// Columns of stat_day_disk_array_dg +var ( + StatDayDiskArrayDGID = &Col{T: TStatDayDiskArrayDG, Name: "id", Nullable: false} + StatDayDiskArrayDGDay = &Col{T: TStatDayDiskArrayDG, Name: "day", Nullable: false} + StatDayDiskArrayDGArrayName = &Col{T: TStatDayDiskArrayDG, Name: "array_name", Nullable: false} + StatDayDiskArrayDGArrayDG = &Col{T: TStatDayDiskArrayDG, Name: "array_dg", Nullable: false} + StatDayDiskArrayDGDiskUsed = &Col{T: TStatDayDiskArrayDG, Name: "disk_used", Nullable: true} + StatDayDiskArrayDGDiskSize = &Col{T: TStatDayDiskArrayDG, Name: "disk_size", Nullable: true} + StatDayDiskArrayDGReserved = &Col{T: TStatDayDiskArrayDG, Name: "reserved", Nullable: true} + StatDayDiskArrayDGReservable = &Col{T: TStatDayDiskArrayDG, Name: "reservable", Nullable: true} +) + +// Columns of stat_day_svc +var ( + StatDaySvcID = &Col{T: TStatDaySvc, Name: "id", Nullable: false} + StatDaySvcDay = &Col{T: TStatDaySvc, Name: "day", Nullable: false} + StatDaySvcNbAction = &Col{T: TStatDaySvc, Name: "nb_action", Nullable: true} + StatDaySvcNbActionErr = &Col{T: TStatDaySvc, Name: "nb_action_err", Nullable: true} + StatDaySvcNbActionWarn = &Col{T: TStatDaySvc, Name: "nb_action_warn", Nullable: true} + StatDaySvcNbActionOk = &Col{T: TStatDaySvc, Name: "nb_action_ok", Nullable: true} + StatDaySvcDiskSize = &Col{T: TStatDaySvc, Name: "disk_size", Nullable: true} + StatDaySvcRamSize = &Col{T: TStatDaySvc, Name: "ram_size", Nullable: true} + StatDaySvcNbCPUCore = &Col{T: TStatDaySvc, Name: "nb_cpu_core", Nullable: true} + StatDaySvcNbCPUDie = &Col{T: TStatDaySvc, Name: "nb_cpu_die", Nullable: true} + StatDaySvcWatt = &Col{T: TStatDaySvc, Name: "watt", Nullable: true} + StatDaySvcRackunit = &Col{T: TStatDaySvc, Name: "rackunit", Nullable: true} + StatDaySvcNbNodes = &Col{T: TStatDaySvc, Name: "nb_nodes", Nullable: true} + StatDaySvcLocalDiskSize = &Col{T: TStatDaySvc, Name: "local_disk_size", Nullable: true} + StatDaySvcSvcID = &Col{T: TStatDaySvc, Name: "svc_id", Nullable: true} +) + +// Columns of stor_array +var ( + StorArrayID = &Col{T: TStorArray, Name: "id", Nullable: false} + StorArrayArrayName = &Col{T: TStorArray, Name: "array_name", Nullable: true} + StorArrayArrayModel = &Col{T: TStorArray, Name: "array_model", Nullable: false} + StorArrayArrayCache = &Col{T: TStorArray, Name: "array_cache", Nullable: true} + StorArrayArrayFirmware = &Col{T: TStorArray, Name: "array_firmware", Nullable: true} + StorArrayArrayUpdated = &Col{T: TStorArray, Name: "array_updated", Nullable: false} + StorArrayArrayLevel = &Col{T: TStorArray, Name: "array_level", Nullable: false} + StorArrayArrayComment = &Col{T: TStorArray, Name: "array_comment", Nullable: true} +) + +// Columns of stor_array_dg +var ( + StorArrayDGID = &Col{T: TStorArrayDG, Name: "id", Nullable: false} + StorArrayDGArrayID = &Col{T: TStorArrayDG, Name: "array_id", Nullable: false} + StorArrayDGDGName = &Col{T: TStorArrayDG, Name: "dg_name", Nullable: false} + StorArrayDGDGFree = &Col{T: TStorArrayDG, Name: "dg_free", Nullable: false} + StorArrayDGDGUpdated = &Col{T: TStorArrayDG, Name: "dg_updated", Nullable: false} + StorArrayDGDGSize = &Col{T: TStorArrayDG, Name: "dg_size", Nullable: true} + StorArrayDGDGUsed = &Col{T: TStorArrayDG, Name: "dg_used", Nullable: true} + StorArrayDGDGReserved = &Col{T: TStorArrayDG, Name: "dg_reserved", Nullable: true} +) + +// Columns of stor_array_dg_quota +var ( + StorArrayDGQuotaID = &Col{T: TStorArrayDGQuota, Name: "id", Nullable: false} + StorArrayDGQuotaDGID = &Col{T: TStorArrayDGQuota, Name: "dg_id", Nullable: false} + StorArrayDGQuotaAppID = &Col{T: TStorArrayDGQuota, Name: "app_id", Nullable: false} + StorArrayDGQuotaQuota = &Col{T: TStorArrayDGQuota, Name: "quota", Nullable: true} +) + +// Columns of stor_array_proxy +var ( + StorArrayProxyID = &Col{T: TStorArrayProxy, Name: "id", Nullable: false} + StorArrayProxyArrayID = &Col{T: TStorArrayProxy, Name: "array_id", Nullable: false} + StorArrayProxyNodeID = &Col{T: TStorArrayProxy, Name: "node_id", Nullable: true} +) + +// Columns of stor_array_tgtid +var ( + StorArrayTgtidID = &Col{T: TStorArrayTgtid, Name: "id", Nullable: false} + StorArrayTgtidArrayID = &Col{T: TStorArrayTgtid, Name: "array_id", Nullable: false} + StorArrayTgtidArrayTgtid = &Col{T: TStorArrayTgtid, Name: "array_tgtid", Nullable: false} + StorArrayTgtidUpdated = &Col{T: TStorArrayTgtid, Name: "updated", Nullable: false} +) + +// Columns of stor_zone +var ( + StorZoneID = &Col{T: TStorZone, Name: "id", Nullable: false} + StorZoneTgtID = &Col{T: TStorZone, Name: "tgt_id", Nullable: false} + StorZoneHBAID = &Col{T: TStorZone, Name: "hba_id", Nullable: false} + StorZoneUpdated = &Col{T: TStorZone, Name: "updated", Nullable: false} + StorZoneNodeID = &Col{T: TStorZone, Name: "node_id", Nullable: true} +) + +// Columns of svcactions +var ( + SvcactionsAction = &Col{T: TSvcactions, Name: "action", Nullable: true} + SvcactionsStatus = &Col{T: TSvcactions, Name: "status", Nullable: true} + SvcactionsBegin = &Col{T: TSvcactions, Name: "begin", Nullable: false} + SvcactionsEnd = &Col{T: TSvcactions, Name: "end", Nullable: true} + SvcactionsHostid = &Col{T: TSvcactions, Name: "hostid", Nullable: true} + SvcactionsStatusLog = &Col{T: TSvcactions, Name: "status_log", Nullable: true} + SvcactionsPid = &Col{T: TSvcactions, Name: "pid", Nullable: true} + SvcactionsID = &Col{T: TSvcactions, Name: "id", Nullable: false} + SvcactionsAck = &Col{T: TSvcactions, Name: "ack", Nullable: true} + SvcactionsAlert = &Col{T: TSvcactions, Name: "alert", Nullable: true} + SvcactionsAckedBy = &Col{T: TSvcactions, Name: "acked_by", Nullable: true} + SvcactionsAckedComment = &Col{T: TSvcactions, Name: "acked_comment", Nullable: true} + SvcactionsAckedDate = &Col{T: TSvcactions, Name: "acked_date", Nullable: true} + SvcactionsVersion = &Col{T: TSvcactions, Name: "version", Nullable: true} + SvcactionsCron = &Col{T: TSvcactions, Name: "cron", Nullable: true} + SvcactionsTime = &Col{T: TSvcactions, Name: "time", Nullable: true} + SvcactionsNodeID = &Col{T: TSvcactions, Name: "node_id", Nullable: true} + SvcactionsSvcID = &Col{T: TSvcactions, Name: "svc_id", Nullable: true} + SvcactionsSid = &Col{T: TSvcactions, Name: "sid", Nullable: true} + SvcactionsRid = &Col{T: TSvcactions, Name: "rid", Nullable: true} + SvcactionsSubset = &Col{T: TSvcactions, Name: "subset", Nullable: true} +) + +// Columns of svcdisks +var ( + SvcdisksID = &Col{T: TSvcdisks, Name: "id", Nullable: false} + SvcdisksDiskID = &Col{T: TSvcdisks, Name: "disk_id", Nullable: true} + SvcdisksDiskSize = &Col{T: TSvcdisks, Name: "disk_size", Nullable: false} + SvcdisksDiskVendor = &Col{T: TSvcdisks, Name: "disk_vendor", Nullable: true} + SvcdisksDiskModel = &Col{T: TSvcdisks, Name: "disk_model", Nullable: true} + SvcdisksDiskDG = &Col{T: TSvcdisks, Name: "disk_dg", Nullable: true} + SvcdisksDiskUpdated = &Col{T: TSvcdisks, Name: "disk_updated", Nullable: false} + SvcdisksDiskLocal = &Col{T: TSvcdisks, Name: "disk_local", Nullable: true} + SvcdisksDiskUsed = &Col{T: TSvcdisks, Name: "disk_used", Nullable: false} + SvcdisksDiskRegion = &Col{T: TSvcdisks, Name: "disk_region", Nullable: true} + SvcdisksAppID = &Col{T: TSvcdisks, Name: "app_id", Nullable: true} + SvcdisksNodeID = &Col{T: TSvcdisks, Name: "node_id", Nullable: true} + SvcdisksSvcID = &Col{T: TSvcdisks, Name: "svc_id", Nullable: true} +) + +// Columns of svcmon +var ( + SvcmonMonSvctype = &Col{T: TSvcmon, Name: "mon_svctype", Nullable: true} + SvcmonMonIpstatus = &Col{T: TSvcmon, Name: "mon_ipstatus", Nullable: true} + SvcmonMonFsstatus = &Col{T: TSvcmon, Name: "mon_fsstatus", Nullable: true} + SvcmonMonUpdated = &Col{T: TSvcmon, Name: "mon_updated", Nullable: true} + SvcmonID = &Col{T: TSvcmon, Name: "ID", Nullable: false} + SvcmonMonFrozen = &Col{T: TSvcmon, Name: "mon_frozen", Nullable: true} + SvcmonMonChanged = &Col{T: TSvcmon, Name: "mon_changed", Nullable: false} + SvcmonMonDiskstatus = &Col{T: TSvcmon, Name: "mon_diskstatus", Nullable: true} + SvcmonMonContainerstatus = &Col{T: TSvcmon, Name: "mon_containerstatus", Nullable: true} + SvcmonMonOverallstatus = &Col{T: TSvcmon, Name: "mon_overallstatus", Nullable: true} + SvcmonMonSyncstatus = &Col{T: TSvcmon, Name: "mon_syncstatus", Nullable: true} + SvcmonMonAppstatus = &Col{T: TSvcmon, Name: "mon_appstatus", Nullable: true} + SvcmonMonHbstatus = &Col{T: TSvcmon, Name: "mon_hbstatus", Nullable: true} + SvcmonMonAvailstatus = &Col{T: TSvcmon, Name: "mon_availstatus", Nullable: true} + SvcmonMonVmname = &Col{T: TSvcmon, Name: "mon_vmname", Nullable: true} + SvcmonMonGuestos = &Col{T: TSvcmon, Name: "mon_guestos", Nullable: true} + SvcmonMonVmem = &Col{T: TSvcmon, Name: "mon_vmem", Nullable: true} + SvcmonMonVcpus = &Col{T: TSvcmon, Name: "mon_vcpus", Nullable: true} + SvcmonMonContainerpath = &Col{T: TSvcmon, Name: "mon_containerpath", Nullable: true} + SvcmonMonVmtype = &Col{T: TSvcmon, Name: "mon_vmtype", Nullable: true} + SvcmonMonSharestatus = &Col{T: TSvcmon, Name: "mon_sharestatus", Nullable: true} + SvcmonNodeID = &Col{T: TSvcmon, Name: "node_id", Nullable: true} + SvcmonSvcID = &Col{T: TSvcmon, Name: "svc_id", Nullable: true} + SvcmonMonSmonStatus = &Col{T: TSvcmon, Name: "mon_smon_status", Nullable: true} + SvcmonMonSmonGlobalExpect = &Col{T: TSvcmon, Name: "mon_smon_global_expect", Nullable: true} + SvcmonMonFrozenAt = &Col{T: TSvcmon, Name: "mon_frozen_at", Nullable: true} + SvcmonMonEncapFrozenAt = &Col{T: TSvcmon, Name: "mon_encap_frozen_at", Nullable: true} +) + +// Columns of svcmon_log +var ( + SvcmonLogID = &Col{T: TSvcmonLog, Name: "id", Nullable: false} + SvcmonLogMonOverallstatus = &Col{T: TSvcmonLog, Name: "mon_overallstatus", Nullable: true} + SvcmonLogMonIpstatus = &Col{T: TSvcmonLog, Name: "mon_ipstatus", Nullable: true} + SvcmonLogMonFsstatus = &Col{T: TSvcmonLog, Name: "mon_fsstatus", Nullable: true} + SvcmonLogMonDiskstatus = &Col{T: TSvcmonLog, Name: "mon_diskstatus", Nullable: true} + SvcmonLogMonContainerstatus = &Col{T: TSvcmonLog, Name: "mon_containerstatus", Nullable: true} + SvcmonLogMonSyncstatus = &Col{T: TSvcmonLog, Name: "mon_syncstatus", Nullable: true} + SvcmonLogMonAppstatus = &Col{T: TSvcmonLog, Name: "mon_appstatus", Nullable: true} + SvcmonLogMonBegin = &Col{T: TSvcmonLog, Name: "mon_begin", Nullable: false} + SvcmonLogMonEnd = &Col{T: TSvcmonLog, Name: "mon_end", Nullable: false} + SvcmonLogMonHbstatus = &Col{T: TSvcmonLog, Name: "mon_hbstatus", Nullable: true} + SvcmonLogMonAvailstatus = &Col{T: TSvcmonLog, Name: "mon_availstatus", Nullable: true} + SvcmonLogMonSharestatus = &Col{T: TSvcmonLog, Name: "mon_sharestatus", Nullable: true} + SvcmonLogNodeID = &Col{T: TSvcmonLog, Name: "node_id", Nullable: true} + SvcmonLogSvcID = &Col{T: TSvcmonLog, Name: "svc_id", Nullable: true} +) + +// Columns of svcmon_log_ack +var ( + SvcmonLogAckID = &Col{T: TSvcmonLogAck, Name: "id", Nullable: false} + SvcmonLogAckMonBegin = &Col{T: TSvcmonLogAck, Name: "mon_begin", Nullable: false} + SvcmonLogAckMonEnd = &Col{T: TSvcmonLogAck, Name: "mon_end", Nullable: false} + SvcmonLogAckMonComment = &Col{T: TSvcmonLogAck, Name: "mon_comment", Nullable: false} + SvcmonLogAckMonAckedBy = &Col{T: TSvcmonLogAck, Name: "mon_acked_by", Nullable: false} + SvcmonLogAckMonAckedOn = &Col{T: TSvcmonLogAck, Name: "mon_acked_on", Nullable: false} + SvcmonLogAckMonAccount = &Col{T: TSvcmonLogAck, Name: "mon_account", Nullable: false} + SvcmonLogAckSvcID = &Col{T: TSvcmonLogAck, Name: "svc_id", Nullable: true} +) + +// Columns of svcmon_log_last +var ( + SvcmonLogLastID = &Col{T: TSvcmonLogLast, Name: "id", Nullable: false} + SvcmonLogLastMonOverallstatus = &Col{T: TSvcmonLogLast, Name: "mon_overallstatus", Nullable: true} + SvcmonLogLastMonIpstatus = &Col{T: TSvcmonLogLast, Name: "mon_ipstatus", Nullable: true} + SvcmonLogLastMonFsstatus = &Col{T: TSvcmonLogLast, Name: "mon_fsstatus", Nullable: true} + SvcmonLogLastMonDiskstatus = &Col{T: TSvcmonLogLast, Name: "mon_diskstatus", Nullable: true} + SvcmonLogLastMonContainerstatus = &Col{T: TSvcmonLogLast, Name: "mon_containerstatus", Nullable: true} + SvcmonLogLastMonSyncstatus = &Col{T: TSvcmonLogLast, Name: "mon_syncstatus", Nullable: true} + SvcmonLogLastMonAppstatus = &Col{T: TSvcmonLogLast, Name: "mon_appstatus", Nullable: true} + SvcmonLogLastMonBegin = &Col{T: TSvcmonLogLast, Name: "mon_begin", Nullable: false} + SvcmonLogLastMonEnd = &Col{T: TSvcmonLogLast, Name: "mon_end", Nullable: false} + SvcmonLogLastMonHbstatus = &Col{T: TSvcmonLogLast, Name: "mon_hbstatus", Nullable: true} + SvcmonLogLastMonAvailstatus = &Col{T: TSvcmonLogLast, Name: "mon_availstatus", Nullable: true} + SvcmonLogLastMonSharestatus = &Col{T: TSvcmonLogLast, Name: "mon_sharestatus", Nullable: true} + SvcmonLogLastNodeID = &Col{T: TSvcmonLogLast, Name: "node_id", Nullable: true} + SvcmonLogLastSvcID = &Col{T: TSvcmonLogLast, Name: "svc_id", Nullable: true} +) + +// Columns of svc_tags +var ( + SvcTagsID = &Col{T: TSvcTags, Name: "id", Nullable: false} + SvcTagsCreated = &Col{T: TSvcTags, Name: "created", Nullable: true} + SvcTagsSvcID = &Col{T: TSvcTags, Name: "svc_id", Nullable: true} + SvcTagsTagID = &Col{T: TSvcTags, Name: "tag_id", Nullable: true} + SvcTagsTagAttachData = &Col{T: TSvcTags, Name: "tag_attach_data", Nullable: true} +) + +// Columns of switches +var ( + SwitchesID = &Col{T: TSwitches, Name: "id", Nullable: false} + SwitchesSwName = &Col{T: TSwitches, Name: "sw_name", Nullable: false} + SwitchesSwSlot = &Col{T: TSwitches, Name: "sw_slot", Nullable: true} + SwitchesSwPort = &Col{T: TSwitches, Name: "sw_port", Nullable: true} + SwitchesSwPortspeed = &Col{T: TSwitches, Name: "sw_portspeed", Nullable: true} + SwitchesSwPortnego = &Col{T: TSwitches, Name: "sw_portnego", Nullable: true} + SwitchesSwPorttype = &Col{T: TSwitches, Name: "sw_porttype", Nullable: true} + SwitchesSwPortstate = &Col{T: TSwitches, Name: "sw_portstate", Nullable: true} + SwitchesSwPortname = &Col{T: TSwitches, Name: "sw_portname", Nullable: true} + SwitchesSwRportname = &Col{T: TSwitches, Name: "sw_rportname", Nullable: true} + SwitchesSwUpdated = &Col{T: TSwitches, Name: "sw_updated", Nullable: false} + SwitchesSwFabric = &Col{T: TSwitches, Name: "sw_fabric", Nullable: true} + SwitchesSwIndex = &Col{T: TSwitches, Name: "sw_index", Nullable: true} +) + +// Columns of sysrep_allow +var ( + SysrepAllowID = &Col{T: TSysrepAllow, Name: "id", Nullable: false} + SysrepAllowPattern = &Col{T: TSysrepAllow, Name: "pattern", Nullable: false} + SysrepAllowFsetID = &Col{T: TSysrepAllow, Name: "fset_id", Nullable: false} + SysrepAllowGroupID = &Col{T: TSysrepAllow, Name: "group_id", Nullable: false} +) + +// Columns of sysrep_changing +var ( + SysrepChangingID = &Col{T: TSysrepChanging, Name: "id", Nullable: false} + SysrepChangingPattern = &Col{T: TSysrepChanging, Name: "pattern", Nullable: false} +) + +// Columns of sysrep_secure +var ( + SysrepSecureID = &Col{T: TSysrepSecure, Name: "id", Nullable: false} + SysrepSecurePattern = &Col{T: TSysrepSecure, Name: "pattern", Nullable: false} +) + +// Columns of table_modified +var ( + TableModifiedID = &Col{T: TTableModified, Name: "id", Nullable: false} + TableModifiedTableName = &Col{T: TTableModified, Name: "table_name", Nullable: false} + TableModifiedTableModified = &Col{T: TTableModified, Name: "table_modified", Nullable: true} +) + +// Columns of tags +var ( + TagsID = &Col{T: TTags, Name: "id", Nullable: false} + TagsTagName = &Col{T: TTags, Name: "tag_name", Nullable: true} + TagsTagCreated = &Col{T: TTags, Name: "tag_created", Nullable: false} + TagsTagExclude = &Col{T: TTags, Name: "tag_exclude", Nullable: true} + TagsTagData = &Col{T: TTags, Name: "tag_data", Nullable: true} + TagsTagID = &Col{T: TTags, Name: "tag_id", Nullable: true} +) + +// Columns of tmp +var ( + TmpID = &Col{T: TTmp, Name: "id", Nullable: false} +) + +// Columns of tmpmd5 +var ( + Tmpmd5RsetMD5 = &Col{T: TTmpmd5, Name: "rset_md5", Nullable: true} +) + +// Columns of user_log +var ( + UserLogUserID = &Col{T: TUserLog, Name: "user_id", Nullable: false} + UserLogLogID = &Col{T: TUserLog, Name: "log_id", Nullable: true} +) + +// Columns of user_prefs +var ( + UserPrefsID = &Col{T: TUserPrefs, Name: "id", Nullable: false} + UserPrefsUserID = &Col{T: TUserPrefs, Name: "user_id", Nullable: false} + UserPrefsPrefs = &Col{T: TUserPrefs, Name: "prefs", Nullable: false} +) + +// Columns of u_inc +var ( + UIncInc = &Col{T: TUInc, Name: "inc", Nullable: true} +) + +// Columns of wiki_pages +var ( + WikiPagesID = &Col{T: TWikiPages, Name: "id", Nullable: false} + WikiPagesName = &Col{T: TWikiPages, Name: "name", Nullable: true} + WikiPagesAuthor = &Col{T: TWikiPages, Name: "author", Nullable: true} + WikiPagesSavedOn = &Col{T: TWikiPages, Name: "saved_on", Nullable: true} + WikiPagesTitle = &Col{T: TWikiPages, Name: "title", Nullable: true} + WikiPagesBody = &Col{T: TWikiPages, Name: "body", Nullable: true} + WikiPagesChangeNote = &Col{T: TWikiPages, Name: "change_note", Nullable: true} +) + +// Columns of workflows +var ( + WorkflowsID = &Col{T: TWorkflows, Name: "id", Nullable: false} + WorkflowsFormHeadID = &Col{T: TWorkflows, Name: "form_head_id", Nullable: false} + WorkflowsStatus = &Col{T: TWorkflows, Name: "status", Nullable: false} + WorkflowsSteps = &Col{T: TWorkflows, Name: "steps", Nullable: false} + WorkflowsCreator = &Col{T: TWorkflows, Name: "creator", Nullable: false} + WorkflowsCreateDate = &Col{T: TWorkflows, Name: "create_date", Nullable: false} + WorkflowsLastAssignee = &Col{T: TWorkflows, Name: "last_assignee", Nullable: false} + WorkflowsLastUpdate = &Col{T: TWorkflows, Name: "last_update", Nullable: false} + WorkflowsFormMD5 = &Col{T: TWorkflows, Name: "form_md5", Nullable: true} + WorkflowsLastFormID = &Col{T: TWorkflows, Name: "last_form_id", Nullable: true} + WorkflowsLastFormName = &Col{T: TWorkflows, Name: "last_form_name", Nullable: true} +) + +// AllCols is the full column registry used for join resolution. +var AllCols = []*Col{ + ActionQueueID, + ActionQueueStatus, + ActionQueueCommand, + ActionQueueDateQueued, + ActionQueueDateDequeued, + ActionQueueRet, + ActionQueueStdout, + ActionQueueStderr, + ActionQueueActionType, + ActionQueueUserID, + ActionQueueFormID, + ActionQueueConnectTo, + ActionQueueNodeID, + ActionQueueSvcID, + AlertsID, + AlertsSentAt, + AlertsSentTo, + AlertsBody, + AlertsSubject, + AlertsSendAt, + AlertsCreatedAt, + AlertsActionID, + AlertsAppID, + AlertsDomain, + AlertsActionIds, + AlertsSentID, + AlertsSentAlertID, + AlertsSentMsgType, + AlertsSentUserID, + AlertsSentSent, + AppsID, + AppsApp, + AppsUpdated, + AppsAppDomain, + AppsAppTeamOps, + AppsDescription, + AppsImportID, + AppsImportApp, + AppsImportDesc, + AppsImportUpdated, + AppsImportAppDomain, + AppsImportAppTeamOps, + AppsPublicationsID, + AppsPublicationsGroupID, + AppsPublicationsAppID, + AppsResponsiblesID, + AppsResponsiblesGroupID, + AppsResponsiblesAppID, + AuthEventID, + AuthEventTimeStamp, + AuthEventClientIP, + AuthEventUserID, + AuthEventOrigin, + AuthEventDescription, + AuthFiltersID, + AuthFiltersFilUid, + AuthFiltersFilID, + AuthFiltersFilValue, + AuthFiltersFilActive, + AuthGroupID, + AuthGroupRole, + AuthGroupDescription, + AuthGroupPrivilege, + AuthMembershipID, + AuthMembershipUserID, + AuthMembershipGroupID, + AuthMembershipPrimaryGroup, + AuthNodeID, + AuthNodeNodename, + AuthNodeUuid, + AuthNodeUpdated, + AuthNodeNodeID, + AuthPermissionID, + AuthPermissionGroupID, + AuthPermissionName, + AuthPermissionTableName, + AuthPermissionRecordID, + AuthUserID, + AuthUserFirstName, + AuthUserLastName, + AuthUserEmail, + AuthUserPassword, + AuthUserRegistrationKey, + AuthUserResetPasswordKey, + AuthUserEmailNotifications, + AuthUserImNotifications, + AuthUserImType, + AuthUserImUsername, + AuthUserEmailLogLevel, + AuthUserImLogLevel, + AuthUserLockFilter, + AuthUserPhoneWork, + AuthUserRegistrationID, + AuthUserQuotaApp, + AuthUserQuotaOrgGroup, + AuthUserUsername, + AuthUserQuotaDockerRegistries, + AuthUserImNotificationsDelay, + AuthUserEmailNotificationsDelay, + BActionErrorsID, + BActionErrorsSvcID, + BActionErrorsNodeID, + BActionErrorsErr, + BAppsOldID, + BAppsOldApp, + BAppsOldRoles, + BAppsOldResponsibles, + BAppsOldMailto, + BAppsOldAppDomain, + BAppsOldAppTeamOps, + ChartsID, + ChartsChartName, + ChartsChartYaml, + ChartTeamPublicationID, + ChartTeamPublicationChartID, + ChartTeamPublicationGroupID, + ChartTeamResponsibleID, + ChartTeamResponsibleChartID, + ChartTeamResponsibleGroupID, + ChecksDefaultsID, + ChecksDefaultsChkType, + ChecksDefaultsChkLow, + ChecksDefaultsChkHigh, + ChecksDefaultsChkInst, + ChecksDefaultsChkPrio, + ChecksLiveID, + ChecksLiveChkType, + ChecksLiveChkUpdated, + ChecksLiveChkValue, + ChecksLiveChkCreated, + ChecksLiveChkInstance, + ChecksLiveChkLow, + ChecksLiveChkHigh, + ChecksLiveChkThresholdProvider, + ChecksLiveChkErr, + ChecksLiveNodeID, + ChecksLiveSvcID, + ChecksSettingsID, + ChecksSettingsChkType, + ChecksSettingsChkLow, + ChecksSettingsChkHigh, + ChecksSettingsChkChanged, + ChecksSettingsChkChangedBy, + ChecksSettingsChkInstance, + ChecksSettingsNodeID, + ChecksSettingsSvcID, + ClustersID, + ClustersClusterID, + ClustersClusterName, + ClustersClusterData, + CompLogID, + CompLogRunModule, + CompLogRunStatus, + CompLogRunLog, + CompLogRunDate, + CompLogRunAction, + CompLogRsetMD5, + CompLogNodeID, + CompLogSvcID, + CompLogDailyID, + CompLogDailyRunModule, + CompLogDailyRunStatus, + CompLogDailyRunDate, + CompLogDailyNodeID, + CompLogDailySvcID, + CompModulesetID, + CompModulesetModsetName, + CompModulesetModsetAuthor, + CompModulesetModsetUpdated, + CompModulesetsServicesID, + CompModulesetsServicesModsetID, + CompModulesetsServicesModsetModAuthor, + CompModulesetsServicesModsetUpdated, + CompModulesetsServicesSlave, + CompModulesetsServicesSvcID, + CompModulesetModulesID, + CompModulesetModulesModsetID, + CompModulesetModulesModsetModName, + CompModulesetModulesModsetModAuthor, + CompModulesetModulesModsetModUpdated, + CompModulesetModulesAutofix, + CompModulesetModulesetID, + CompModulesetModulesetParentModsetID, + CompModulesetModulesetChildModsetID, + CompModulesetRulesetID, + CompModulesetRulesetModsetID, + CompModulesetRulesetRulesetID, + CompModulesetTeamPublicationID, + CompModulesetTeamPublicationModsetID, + CompModulesetTeamPublicationGroupID, + CompModulesetTeamResponsibleID, + CompModulesetTeamResponsibleModsetID, + CompModulesetTeamResponsibleGroupID, + CompModStatusID, + CompModStatusTotal, + CompModStatusOk, + CompModStatusNok, + CompModStatusNa, + CompModStatusObs, + CompModStatusPct, + CompModStatusModName, + CompNodeModulesetID, + CompNodeModulesetModsetID, + CompNodeModulesetModsetModAuthor, + CompNodeModulesetModsetUpdated, + CompNodeModulesetNodeID, + CompNodeStatusID, + CompNodeStatusTotal, + CompNodeStatusOk, + CompNodeStatusNok, + CompNodeStatusNa, + CompNodeStatusObs, + CompNodeStatusPct, + CompNodeStatusNodeName, + CompRulesetsID, + CompRulesetsRulesetName, + CompRulesetsRulesetType, + CompRulesetsRulesetPublic, + CompRulesetsChainsID, + CompRulesetsChainsHeadRsetID, + CompRulesetsChainsTailRsetID, + CompRulesetsChainsChainLen, + CompRulesetsChainsChain, + CompRulesetsFiltersetsID, + CompRulesetsFiltersetsRulesetID, + CompRulesetsFiltersetsFsetID, + CompRulesetsNodesID, + CompRulesetsNodesRulesetID, + CompRulesetsNodesNodeID, + CompRulesetsRulesetsID, + CompRulesetsRulesetsParentRsetID, + CompRulesetsRulesetsChildRsetID, + CompRulesetsServicesID, + CompRulesetsServicesRulesetID, + CompRulesetsServicesSlave, + CompRulesetsServicesSvcID, + CompRulesetsVariablesID, + CompRulesetsVariablesRulesetID, + CompRulesetsVariablesVarName, + CompRulesetsVariablesVarValue, + CompRulesetsVariablesVarAuthor, + CompRulesetsVariablesVarUpdated, + CompRulesetsVariablesVarClass, + CompRulesetTeamPublicationID, + CompRulesetTeamPublicationRulesetID, + CompRulesetTeamPublicationGroupID, + CompRulesetTeamResponsibleID, + CompRulesetTeamResponsibleRulesetID, + CompRulesetTeamResponsibleGroupID, + CompRunRulesetID, + CompRunRulesetRsetMD5, + CompRunRulesetRset, + CompRunRulesetDate, + CompStatusID, + CompStatusRunModule, + CompStatusRunStatus, + CompStatusRunLog, + CompStatusRunDate, + CompStatusRunAction, + CompStatusRsetMD5, + CompStatusNodeID, + CompStatusSvcID, + CompSvcStatusID, + CompSvcStatusTotal, + CompSvcStatusOk, + CompSvcStatusNok, + CompSvcStatusNa, + CompSvcStatusObs, + CompSvcStatusPct, + CompSvcStatusSvcName, + DashboardID, + DashboardDashType, + DashboardSvcID, + DashboardDashSeverity, + DashboardDashFmt, + DashboardDashDict, + DashboardDashCreated, + DashboardDashDictMD5, + DashboardDashEnv, + DashboardDashUpdated, + DashboardNodeID, + DashboardDashMD5, + DashboardDashInstance, + DashboardEventsID, + DashboardEventsSvcID, + DashboardEventsDashMD5, + DashboardEventsDashBegin, + DashboardEventsDashEnd, + DashboardEventsNodeID, + DashboardRefID, + DashboardRefDashMD5, + DashboardRefDashType, + DashboardRefDashFmt, + DashboardRefDashDict, + DigitI, + DiskinfoID, + DiskinfoDiskID, + DiskinfoDiskDevid, + DiskinfoDiskArrayid, + DiskinfoDiskUpdated, + DiskinfoDiskRaid, + DiskinfoDiskSize, + DiskinfoDiskGroup, + DiskinfoDiskLevel, + DiskinfoDiskController, + DiskinfoDiskName, + DiskinfoDiskAlloc, + DiskinfoDiskCreated, + DiskBlacklistID, + DiskBlacklistDiskID, + DockerRegistriesID, + DockerRegistriesService, + DockerRegistriesURL, + DockerRegistriesInsecure, + DockerRegistriesCreated, + DockerRegistriesUpdated, + DockerRegistriesRestricted, + DockerRegistriesPublicationsID, + DockerRegistriesPublicationsGroupID, + DockerRegistriesPublicationsRegistryID, + DockerRegistriesResponsiblesID, + DockerRegistriesResponsiblesGroupID, + DockerRegistriesResponsiblesRegistryID, + DockerRepositoriesID, + DockerRepositoriesRegistryID, + DockerRepositoriesRepository, + DockerRepositoriesCreated, + DockerRepositoriesUpdated, + DockerRepositoriesDescription, + DockerRepositoriesStars, + DockerRepositoriesAutomated, + DockerRepositoriesOfficial, + DockerTagsID, + DockerTagsRegistryID, + DockerTagsRepositoryID, + DockerTagsName, + DockerTagsCreated, + DockerTagsUpdated, + DockerTagsConfigDigest, + DockerTagsConfigSize, + DrpprojectsDRPProject, + DrpprojectsDRPProjectID, + DrpservicesDRPWave, + DrpservicesDRPProjectID, + DrpservicesSvcID, + FeedQueueID, + FeedQueueQFn, + FeedQueueQArgs, + FeedQueueCreated, + FeedQueueStatsID, + FeedQueueStatsQStart, + FeedQueueStatsQEnd, + FeedQueueStatsQFn, + FeedQueueStatsQCount, + FeedQueueStatsQAvg, + FiltersID, + FiltersFilName, + FiltersFilColumn, + FiltersFilNeedValue, + FiltersFilPos, + FiltersFilTable, + FiltersFilImg, + FiltersFilSearchTable, + FormsID, + FormsFormName, + FormsFormYaml, + FormsFormAuthor, + FormsFormCreated, + FormsFormType, + FormsFormFolder, + FormsRevisionsID, + FormsRevisionsFormYaml, + FormsRevisionsFormMD5, + FormsRevisionsFormDate, + FormsRevisionsFormID, + FormsRevisionsFormFolder, + FormsRevisionsFormName, + FormsStoreID, + FormsStoreFormSubmitter, + FormsStoreFormSubmitDate, + FormsStoreFormData, + FormsStoreFormNextID, + FormsStoreFormPrevID, + FormsStoreFormAssignee, + FormsStoreFormHeadID, + FormsStoreFormMD5, + FormsStoreFormVarID, + FormsStoreResultsID, + FormsTeamPublicationID, + FormsTeamPublicationFormID, + FormsTeamPublicationGroupID, + FormsTeamResponsibleID, + FormsTeamResponsibleFormID, + FormsTeamResponsibleGroupID, + FormOutputResultsID, + FormOutputResultsUserID, + FormOutputResultsNodeID, + FormOutputResultsResults, + FormOutputResultsSvcID, + FsetCacheFsetID, + FsetCacheObjType, + FsetCacheObjID, + GenFiltersID, + GenFiltersFTable, + GenFiltersFField, + GenFiltersFValue, + GenFiltersFUpdated, + GenFiltersFAuthor, + GenFiltersFOp, + GenFiltersFCksum, + GenFiltersFLabel, + GenFiltersetsID, + GenFiltersetsFsetName, + GenFiltersetsFsetUpdated, + GenFiltersetsFsetAuthor, + GenFiltersetsFsetStats, + GenFiltersetsFiltersID, + GenFiltersetsFiltersFsetID, + GenFiltersetsFiltersFID, + GenFiltersetsFiltersFLogOp, + GenFiltersetsFiltersEncapFsetID, + GenFiltersetsFiltersFOrder, + GenFiltersetCheckThresholdID, + GenFiltersetCheckThresholdFsetID, + GenFiltersetCheckThresholdChkType, + GenFiltersetCheckThresholdChkLow, + GenFiltersetCheckThresholdChkHigh, + GenFiltersetCheckThresholdChkInstance, + GenFiltersetTeamResponsibleID, + GenFiltersetTeamResponsibleFsetID, + GenFiltersetTeamResponsibleGroupID, + GenFiltersetUserID, + GenFiltersetUserFsetID, + GenFiltersetUserUserID, + GroupHiddenMenuEntriesID, + GroupHiddenMenuEntriesGroupID, + GroupHiddenMenuEntriesMenuEntry, + HbmonID, + HbmonNodeID, + HbmonPeerNodeID, + HbmonHbType, + HbmonHbName, + HbmonHbDesc, + HbmonHbStatus, + HbmonUpdated, + HbmonLogID, + HbmonLogNodeID, + HbmonLogPeerNodeID, + HbmonLogHbName, + HbmonLogHbStatus, + HbmonLogHbBegin, + HbmonLogHbEnd, + HbmonLogLastID, + HbmonLogLastNodeID, + HbmonLogLastPeerNodeID, + HbmonLogLastHbName, + HbmonLogLastHbStatus, + HbmonLogLastHbBegin, + HbmonLogLastHbEnd, + ImTypesID, + ImTypesImType, + LifecycleOSID, + LifecycleOSLcOSConcat, + LifecycleOSLcCount, + LifecycleOSLcDate, + LifecycleOSLcOSName, + LifecycleOSLcOSVendor, + LifecycleOSFsetID, + LinksID, + LinksLinkFunction, + LinksLinkParameters, + LinksLinkCreationUserID, + LinksLinkCreationDate, + LinksLinkLastConsultationDate, + LinksLinkMD5, + LinksLinkAccessCounter, + LinksLinkTitle, + LinksLinkTitleArgs, + LogID, + LogLogAction, + LogLogUser, + LogLogFmt, + LogLogDict, + LogLogDate, + LogSvcID, + LogLogGtalkSent, + LogLogEmailSent, + LogLogEntryID, + LogLogLevel, + LogNodeID, + MetricsID, + MetricsMetricName, + MetricsMetricSql, + MetricsMetricAuthor, + MetricsMetricCreated, + MetricsMetricColValueIndex, + MetricsMetricColInstanceIndex, + MetricsMetricColInstanceLabel, + MetricsMetricHistorize, + MetricTeamPublicationID, + MetricTeamPublicationMetricID, + MetricTeamPublicationGroupID, + NetworksID, + NetworksName, + NetworksNetwork, + NetworksNetmask, + NetworksTeamResponsible, + NetworksComment, + NetworksPvid, + NetworksGateway, + NetworksBegin, + NetworksUpdated, + NetworksPrio, + NetworksEnd, + NetworksBroadcast, + NetworkSegmentsID, + NetworkSegmentsNetID, + NetworkSegmentsSegType, + NetworkSegmentsSegBegin, + NetworkSegmentsSegEnd, + NetworkSegmentResponsiblesID, + NetworkSegmentResponsiblesSegID, + NetworkSegmentResponsiblesGroupID, + NodesNodename, + NodesLocCountry, + NodesLocCity, + NodesLocAddr, + NodesLocBuilding, + NodesLocFloor, + NodesLocRoom, + NodesLocRack, + NodesID, + NodesCPUFreq, + NodesCPUCores, + NodesCPUDies, + NodesCPUVendor, + NodesCPUModel, + NodesMEMBanks, + NodesMEMSlots, + NodesMEMBytes, + NodesOSName, + NodesOSRelease, + NodesOSUpdate, + NodesOSSegment, + NodesOSArch, + NodesOSVendor, + NodesOSKernel, + NodesLocZip, + NodesTeamResponsible, + NodesSerial, + NodesModel, + NodesType, + NodesWarrantyEnd, + NodesStatus, + NodesRole, + NodesAssetEnv, + NodesPowerCabinet1, + NodesPowerCabinet2, + NodesPowerSupplyNb, + NodesPowerProtect, + NodesPowerProtectBreaker, + NodesPowerBreaker1, + NodesPowerBreaker2, + NodesBladeCabinet, + NodesUpdated, + NodesTeamInteg, + NodesApp, + NodesTeamSupport, + NodesNodeEnv, + NodesMaintenanceEnd, + NodesEnclosure, + NodesHWObsWarnDate, + NodesHWObsAlertDate, + NodesOSObsWarnDate, + NodesOSObsAlertDate, + NodesFqdn, + NodesListenerPort, + NodesVersion, + NodesHvpool, + NodesHv, + NodesHvvdc, + NodesCPUThreads, + NodesAssetname, + NodesEnclosureslot, + NodesSecZone, + NodesLastBoot, + NodesActionType, + NodesOSConcat, + NodesConnectTo, + NodesTz, + NodesNodeID, + NodesCollector, + NodesSpVersion, + NodesBiosVersion, + NodesLastComm, + NodesManufacturer, + NodesNotifications, + NodesSnoozeTill, + NodesClusterID, + NodesNodeFrozen, + NodesNodeFrozenAt, + NodeGroupsID, + NodeGroupsGroupName, + NodeGroupsGroupID, + NodeGroupsUpdated, + NodeGroupsNodeID, + NodeHBAID, + NodeHBAUpdated, + NodeHBAHBAID, + NodeHBAHBAType, + NodeHBANodeID, + NodeHWID, + NodeHWNodeID, + NodeHWHWType, + NodeHWHWPath, + NodeHWHWClass, + NodeHWHWDescription, + NodeHWHWDriver, + NodeHWUpdated, + NodeIPID, + NodeIPMac, + NodeIPIntf, + NodeIPType, + NodeIPAddr, + NodeIPMask, + NodeIPUpdated, + NodeIPFlagDeprecated, + NodeIPNodeID, + NodePWID, + NodePWPW, + NodePWUpdated, + NodePWNodeID, + NodeTagsID, + NodeTagsCreated, + NodeTagsNodeID, + NodeTagsTagID, + NodeTagsTagAttachData, + NodeUsersID, + NodeUsersUserName, + NodeUsersUserID, + NodeUsersUpdated, + NodeUsersNodeID, + ObsolescenceID, + ObsolescenceObsType, + ObsolescenceObsName, + ObsolescenceObsWarnDate, + ObsolescenceObsAlertDate, + ObsolescenceObsWarnDateUpdatedBy, + ObsolescenceObsAlertDateUpdatedBy, + ObsolescenceObsWarnDateUpdated, + ObsolescenceObsAlertDateUpdated, + Oc3SchedulerID, + Oc3SchedulerTaskName, + Oc3SchedulerIsDisabled, + Oc3SchedulerLastRunAt, + PackagesID, + PackagesPkgName, + PackagesPkgVersion, + PackagesPkgArch, + PackagesPkgUpdated, + PackagesPkgType, + PackagesPkgInstallDate, + PackagesPkgSig, + PackagesNodeID, + PatchesID, + PatchesPatchNum, + PatchesPatchRev, + PatchesPatchUpdated, + PatchesPatchInstallDate, + PatchesNodeID, + PkgSigProviderID, + PkgSigProviderSigID, + PkgSigProviderSigProvider, + ProvTemplatesID, + ProvTemplatesTplName, + ProvTemplatesTplDefinition, + ProvTemplatesTplComment, + ProvTemplatesTplAuthor, + ProvTemplatesTplCreated, + ProvTemplateTeamPublicationID, + ProvTemplateTeamPublicationTplID, + ProvTemplateTeamPublicationGroupID, + ProvTemplateTeamResponsibleID, + ProvTemplateTeamResponsibleTplID, + ProvTemplateTeamResponsibleGroupID, + ReplicationStatusID, + ReplicationStatusRemote, + ReplicationStatusMode, + ReplicationStatusTableSchema, + ReplicationStatusTableName, + ReplicationStatusTableCksum, + ReplicationStatusTableUpdated, + ReportsID, + ReportsReportName, + ReportsReportYaml, + ReportsUserID, + ReportsUserReportID, + ReportsUserUserID, + ReportTeamPublicationID, + ReportTeamPublicationReportID, + ReportTeamPublicationGroupID, + ReportTeamResponsibleID, + ReportTeamResponsibleReportID, + ReportTeamResponsibleGroupID, + ResinfoID, + ResinfoRid, + ResinfoResKey, + ResinfoResValue, + ResinfoUpdated, + ResinfoTopology, + ResinfoNodeID, + ResinfoSvcID, + ResmonID, + ResmonRid, + ResmonResStatus, + ResmonChanged, + ResmonUpdated, + ResmonResDesc, + ResmonResLog, + ResmonVmname, + ResmonResMonitor, + ResmonResDisable, + ResmonResOptional, + ResmonResType, + ResmonNodeID, + ResmonSvcID, + ResmonLogID, + ResmonLogNodeID, + ResmonLogSvcID, + ResmonLogRid, + ResmonLogResStatus, + ResmonLogResBegin, + ResmonLogResEnd, + ResmonLogResLog, + ResmonLogLastID, + ResmonLogLastNodeID, + ResmonLogLastSvcID, + ResmonLogLastRid, + ResmonLogLastResStatus, + ResmonLogLastResBegin, + ResmonLogLastResEnd, + ResmonLogLastResLog, + SafeID, + SafeUploader, + SafeUploadedFrom, + SafeUploadedDate, + SafeName, + SafeSize, + SafeUuid, + SafeMD5, + SafeLogID, + SafeLogSafeID, + SafeLogUuid, + SafeLogArchived, + SafeTeamPublicationID, + SafeTeamPublicationFileID, + SafeTeamPublicationGroupID, + SafeTeamResponsibleID, + SafeTeamResponsibleFileID, + SafeTeamResponsibleGroupID, + SANZoneID, + SANZoneCfg, + SANZoneZone, + SANZonePort, + SANZoneUpdated, + SANZoneAliasID, + SANZoneAliasCfg, + SANZoneAliasAlias, + SANZoneAliasPort, + SANZoneAliasUpdated, + SavesID, + SavesSaveName, + SavesSaveGroup, + SavesSaveSize, + SavesSaveDate, + SavesSaveRetention, + SavesSaveVolume, + SavesSaveLevel, + SavesSaveServer, + SavesSaveApp, + SavesSaveID, + SavesNodeID, + SavesSvcID, + SavesChkInstance, + SavesSaveResolved, + SavesLastID, + SavesLastSaveName, + SavesLastSaveGroup, + SavesLastSaveSize, + SavesLastSaveDate, + SavesLastSaveRetention, + SavesLastSaveVolume, + SavesLastSaveLevel, + SavesLastSaveServer, + SavesLastSaveApp, + SavesLastSaveID, + SavesLastChkInstance, + SavesLastSaveResolved, + SavesLastNodeID, + SavesLastSvcID, + SchedulerRunID, + SchedulerRunTaskID, + SchedulerRunStartTime, + SchedulerRunStopTime, + SchedulerRunRunOutput, + SchedulerRunRunResult, + SchedulerRunTraceback, + SchedulerRunStatus, + SchedulerRunWorkerName, + SchedulerRunDuration, + SchedulerTaskID, + SchedulerTaskUuid, + SchedulerTaskArgs, + SchedulerTaskVars, + SchedulerTaskEnabled, + SchedulerTaskStartTime, + SchedulerTaskNextRunTime, + SchedulerTaskStopTime, + SchedulerTaskRepeats, + SchedulerTaskRetryFailed, + SchedulerTaskPeriod, + SchedulerTaskTimeout, + SchedulerTaskSyncOutput, + SchedulerTaskTimesRun, + SchedulerTaskTimesFailed, + SchedulerTaskLastRunTime, + SchedulerTaskPreventDrift, + SchedulerTaskGroupName, + SchedulerTaskFunctionName, + SchedulerTaskStatus, + SchedulerTaskTaskName, + SchedulerTaskApplicationName, + SchedulerTaskAssignedWorkerName, + SchedulerTaskDepsID, + SchedulerTaskDepsJobName, + SchedulerTaskDepsTaskParent, + SchedulerTaskDepsTaskChild, + SchedulerTaskDepsCanVisit, + SchedulerWorkerID, + SchedulerWorkerWorkerName, + SchedulerWorkerFirstHeartbeat, + SchedulerWorkerLastHeartbeat, + SchedulerWorkerIsTicker, + SchedulerWorkerGroupNames, + SchedulerWorkerStatus, + SchedulerWorkerWorkerStats, + ServicesSvcHostid, + ServicesSvcname, + ServicesSvcNodes, + ServicesSvcDrpnode, + ServicesSvcDrptype, + ServicesSvcAutostart, + ServicesSvcEnv, + ServicesSvcDrpnodes, + ServicesSvcComment, + ServicesSvcApp, + ServicesSvcDrnoaction, + ServicesSvcCreated, + ServicesSvcConfigUpdated, + ServicesSvcMetrocluster, + ServicesID, + ServicesSvcWave, + ServicesSvcConfig, + ServicesUpdated, + ServicesSvcTopology, + ServicesSvcFlexMinNodes, + ServicesSvcFlexMaxNodes, + ServicesSvcFlexCPULowThreshold, + ServicesSvcFlexCPUHighThreshold, + ServicesSvcStatus, + ServicesSvcAvailstatus, + ServicesSvcHa, + ServicesSvcStatusUpdated, + ServicesSvcID, + ServicesSvcFrozen, + ServicesSvcProvisioned, + ServicesSvcPlacement, + ServicesSvcNotifications, + ServicesSvcSnoozeTill, + ServicesClusterID, + ServicesSvcFlexTarget, + ServicesLogID, + ServicesLogSvcAvailstatus, + ServicesLogSvcBegin, + ServicesLogSvcEnd, + ServicesLogSvcID, + ServicesLogLastID, + ServicesLogLastSvcAvailstatus, + ServicesLogLastSvcBegin, + ServicesLogLastSvcEnd, + ServicesLogLastSvcID, + ServicesTestName, + ServicesTestApp, + ServicesTestID, + ServicesTestSvcID, + ServiceIdsSvcname, + ServiceIdsClusterID, + ServiceIdsID, + ServiceIdsSvcID, + StatsCompareID, + StatsCompareName, + StatsCompareFsetID, + StatsCompareFsetCompareID, + StatsCompareFsetFsetID, + StatsCompareUserID, + StatsCompareUserCompareID, + StatsCompareUserUserID, + StatDayID, + StatDayDay, + StatDayNbSvc, + StatDayNbAction, + StatDayNbActionErr, + StatDayNbActionWarn, + StatDayNbActionOk, + StatDayDiskSize, + StatDayRamSize, + StatDayNbCPUCore, + StatDayNbCPUDie, + StatDayWatt, + StatDayRackunit, + StatDayNbApps, + StatDayNbAccounts, + StatDayNbSvcWithDRP, + StatDayNbNodes, + StatDayNbSvcPrd, + StatDayNbSvcCluster, + StatDayNbNodesPrd, + StatDayFsetID, + StatDayNbVcpu, + StatDayNbVmem, + StatDayNbRespAccounts, + StatDayNbVirtNodes, + StatDayLocalDiskSize, + StatDayDiskAppID, + StatDayDiskAppDay, + StatDayDiskAppApp, + StatDayDiskAppDiskUsed, + StatDayDiskAppQuota, + StatDayDiskAppDGID, + StatDayDiskAppDGDay, + StatDayDiskAppDGDGID, + StatDayDiskAppDGApp, + StatDayDiskAppDGDiskUsed, + StatDayDiskAppDGQuota, + StatDayDiskArrayID, + StatDayDiskArrayDay, + StatDayDiskArrayArrayName, + StatDayDiskArrayDiskUsed, + StatDayDiskArrayDiskSize, + StatDayDiskArrayReservable, + StatDayDiskArrayReserved, + StatDayDiskArrayDGID, + StatDayDiskArrayDGDay, + StatDayDiskArrayDGArrayName, + StatDayDiskArrayDGArrayDG, + StatDayDiskArrayDGDiskUsed, + StatDayDiskArrayDGDiskSize, + StatDayDiskArrayDGReserved, + StatDayDiskArrayDGReservable, + StatDaySvcID, + StatDaySvcDay, + StatDaySvcNbAction, + StatDaySvcNbActionErr, + StatDaySvcNbActionWarn, + StatDaySvcNbActionOk, + StatDaySvcDiskSize, + StatDaySvcRamSize, + StatDaySvcNbCPUCore, + StatDaySvcNbCPUDie, + StatDaySvcWatt, + StatDaySvcRackunit, + StatDaySvcNbNodes, + StatDaySvcLocalDiskSize, + StatDaySvcSvcID, + StorArrayID, + StorArrayArrayName, + StorArrayArrayModel, + StorArrayArrayCache, + StorArrayArrayFirmware, + StorArrayArrayUpdated, + StorArrayArrayLevel, + StorArrayArrayComment, + StorArrayDGID, + StorArrayDGArrayID, + StorArrayDGDGName, + StorArrayDGDGFree, + StorArrayDGDGUpdated, + StorArrayDGDGSize, + StorArrayDGDGUsed, + StorArrayDGDGReserved, + StorArrayDGQuotaID, + StorArrayDGQuotaDGID, + StorArrayDGQuotaAppID, + StorArrayDGQuotaQuota, + StorArrayProxyID, + StorArrayProxyArrayID, + StorArrayProxyNodeID, + StorArrayTgtidID, + StorArrayTgtidArrayID, + StorArrayTgtidArrayTgtid, + StorArrayTgtidUpdated, + StorZoneID, + StorZoneTgtID, + StorZoneHBAID, + StorZoneUpdated, + StorZoneNodeID, + SvcactionsAction, + SvcactionsStatus, + SvcactionsBegin, + SvcactionsEnd, + SvcactionsHostid, + SvcactionsStatusLog, + SvcactionsPid, + SvcactionsID, + SvcactionsAck, + SvcactionsAlert, + SvcactionsAckedBy, + SvcactionsAckedComment, + SvcactionsAckedDate, + SvcactionsVersion, + SvcactionsCron, + SvcactionsTime, + SvcactionsNodeID, + SvcactionsSvcID, + SvcactionsSid, + SvcactionsRid, + SvcactionsSubset, + SvcdisksID, + SvcdisksDiskID, + SvcdisksDiskSize, + SvcdisksDiskVendor, + SvcdisksDiskModel, + SvcdisksDiskDG, + SvcdisksDiskUpdated, + SvcdisksDiskLocal, + SvcdisksDiskUsed, + SvcdisksDiskRegion, + SvcdisksAppID, + SvcdisksNodeID, + SvcdisksSvcID, + SvcmonMonSvctype, + SvcmonMonIpstatus, + SvcmonMonFsstatus, + SvcmonMonUpdated, + SvcmonID, + SvcmonMonFrozen, + SvcmonMonChanged, + SvcmonMonDiskstatus, + SvcmonMonContainerstatus, + SvcmonMonOverallstatus, + SvcmonMonSyncstatus, + SvcmonMonAppstatus, + SvcmonMonHbstatus, + SvcmonMonAvailstatus, + SvcmonMonVmname, + SvcmonMonGuestos, + SvcmonMonVmem, + SvcmonMonVcpus, + SvcmonMonContainerpath, + SvcmonMonVmtype, + SvcmonMonSharestatus, + SvcmonNodeID, + SvcmonSvcID, + SvcmonMonSmonStatus, + SvcmonMonSmonGlobalExpect, + SvcmonMonFrozenAt, + SvcmonMonEncapFrozenAt, + SvcmonLogID, + SvcmonLogMonOverallstatus, + SvcmonLogMonIpstatus, + SvcmonLogMonFsstatus, + SvcmonLogMonDiskstatus, + SvcmonLogMonContainerstatus, + SvcmonLogMonSyncstatus, + SvcmonLogMonAppstatus, + SvcmonLogMonBegin, + SvcmonLogMonEnd, + SvcmonLogMonHbstatus, + SvcmonLogMonAvailstatus, + SvcmonLogMonSharestatus, + SvcmonLogNodeID, + SvcmonLogSvcID, + SvcmonLogAckID, + SvcmonLogAckMonBegin, + SvcmonLogAckMonEnd, + SvcmonLogAckMonComment, + SvcmonLogAckMonAckedBy, + SvcmonLogAckMonAckedOn, + SvcmonLogAckMonAccount, + SvcmonLogAckSvcID, + SvcmonLogLastID, + SvcmonLogLastMonOverallstatus, + SvcmonLogLastMonIpstatus, + SvcmonLogLastMonFsstatus, + SvcmonLogLastMonDiskstatus, + SvcmonLogLastMonContainerstatus, + SvcmonLogLastMonSyncstatus, + SvcmonLogLastMonAppstatus, + SvcmonLogLastMonBegin, + SvcmonLogLastMonEnd, + SvcmonLogLastMonHbstatus, + SvcmonLogLastMonAvailstatus, + SvcmonLogLastMonSharestatus, + SvcmonLogLastNodeID, + SvcmonLogLastSvcID, + SvcTagsID, + SvcTagsCreated, + SvcTagsSvcID, + SvcTagsTagID, + SvcTagsTagAttachData, + SwitchesID, + SwitchesSwName, + SwitchesSwSlot, + SwitchesSwPort, + SwitchesSwPortspeed, + SwitchesSwPortnego, + SwitchesSwPorttype, + SwitchesSwPortstate, + SwitchesSwPortname, + SwitchesSwRportname, + SwitchesSwUpdated, + SwitchesSwFabric, + SwitchesSwIndex, + SysrepAllowID, + SysrepAllowPattern, + SysrepAllowFsetID, + SysrepAllowGroupID, + SysrepChangingID, + SysrepChangingPattern, + SysrepSecureID, + SysrepSecurePattern, + TableModifiedID, + TableModifiedTableName, + TableModifiedTableModified, + TagsID, + TagsTagName, + TagsTagCreated, + TagsTagExclude, + TagsTagData, + TagsTagID, + TmpID, + Tmpmd5RsetMD5, + UserLogUserID, + UserLogLogID, + UserPrefsID, + UserPrefsUserID, + UserPrefsPrefs, + UIncInc, + WikiPagesID, + WikiPagesName, + WikiPagesAuthor, + WikiPagesSavedOn, + WikiPagesTitle, + WikiPagesBody, + WikiPagesChangeNote, + WorkflowsID, + WorkflowsFormHeadID, + WorkflowsStatus, + WorkflowsSteps, + WorkflowsCreator, + WorkflowsCreateDate, + WorkflowsLastAssignee, + WorkflowsLastUpdate, + WorkflowsFormMD5, + WorkflowsLastFormID, + WorkflowsLastFormName, +} diff --git a/server/api.yaml b/server/api.yaml index 0bd8cd1..fe915bc 100644 --- a/server/api.yaml +++ b/server/api.yaml @@ -8,6 +8,752 @@ info: version: 1.0.3 paths: + /apps: + get: + operationId: GetApps + description: List available apps + parameters: + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + post: + operationId: PostApps + description: Create an application code + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - app + properties: + app: + type: string + description: + type: string + app_domain: + type: string + app_team_ops: + type: string + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + type: object + 400: + $ref: '#/components/responses/400' + 401: + $ref: '#/components/responses/401' + 403: + $ref: '#/components/responses/403' + 409: + $ref: '#/components/responses/409' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /apps/{app_id}: + post: + operationId: PostApp + description: Change an application code properties + parameters: + - in: path + name: app_id + required: true + description: App record id or app code + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + app: + type: string + description: + type: string + app_domain: + type: string + app_team_ops: + type: string + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + type: object + 400: + $ref: '#/components/responses/400' + 401: + $ref: '#/components/responses/401' + 403: + $ref: '#/components/responses/403' + 404: + $ref: '#/components/responses/404' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + get: + operationId: GetApp + description: Display app properties + parameters: + - in: path + name: app_id + required: true + description: App record id or app code + schema: + type: string + - $ref: '#/components/parameters/inQueryProps' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + type: object + 404: + $ref: '#/components/responses/404' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + delete: + operationId: DeleteApps + description: Delete an application code + parameters: + - in: path + name: app_id + required: true + description: App record id or app code + schema: + type: string + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + type: object + 401: + $ref: '#/components/responses/401' + 403: + $ref: '#/components/responses/403' + 404: + $ref: '#/components/responses/404' + 409: + $ref: '#/components/responses/409' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /apps/{app_id}/am_i_responsible: + get: + operationId: GetAppAmIResponsible + description: Return true if the requester is responsible for this application code + parameters: + - in: path + name: app_id + required: true + description: App record id or app code + schema: + type: string + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + type: boolean + 401: + $ref: '#/components/responses/401' + 403: + $ref: '#/components/responses/403' + 404: + $ref: '#/components/responses/404' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /apps/{app_id}/responsibles: + get: + operationId: GetAppResponsibles + description: List an application code responsible groups + parameters: + - in: path + name: app_id + required: true + description: App record id or app code + schema: + type: string + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 404: + $ref: '#/components/responses/404' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /apps/{app_id}/publications: + get: + operationId: GetAppPublications + description: List an application code publication groups + parameters: + - in: path + name: app_id + required: true + description: App record id or app code + schema: + type: string + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 404: + $ref: '#/components/responses/404' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /nodes: + get: + operationId: GetNodes + description: List nodes + parameters: + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /nodes/{node_id}: + get: + operationId: GetNode + description: List entries for a specific node + parameters: + - in: path + name: node_id + required: true + description: Node identifier (node_id UUID or nodename) + schema: + type: string + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 404: + $ref: '#/components/responses/404' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /nodes/{node_id}/interfaces: + get: + operationId: GetNodeInterfaces + description: List a node network interfaces + parameters: + - in: path + name: node_id + required: true + description: Node identifier (node_id UUID or nodename) + schema: + type: string + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 404: + $ref: '#/components/responses/404' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /nodes/{node_id}/hbas: + get: + operationId: GetNodeHbas + description: List a node storage host bus adapters + parameters: + - in: path + name: node_id + required: true + description: Node identifier (node_id UUID or nodename) + schema: + type: string + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 404: + $ref: '#/components/responses/404' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /nodes/{node_id}/disks: + get: + operationId: GetNodeDisks + description: List disks of a specific node + parameters: + - in: path + name: node_id + required: true + description: Node identifier (node_id UUID or nodename) + schema: + type: string + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 404: + $ref: '#/components/responses/404' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /nodes/{node_id}/uuid: + get: + operationId: GetNodeUUID + description: Display node uuid. Only node responsibles and managers are allowed. + parameters: + - in: path + name: node_id + required: true + description: Node identifier (node_id UUID or nodename) + schema: + type: string + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + type: object + 401: + $ref: '#/components/responses/401' + 403: + $ref: '#/components/responses/403' + 404: + $ref: '#/components/responses/404' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /services: + get: + operationId: GetServices + description: List services + parameters: + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /services/{svc_id}: + get: + operationId: GetService + description: List entries for a specific service + parameters: + - in: path + name: svc_id + required: true + description: Service identifier (svc_id UUID or svcname) + schema: + type: string + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 404: + $ref: '#/components/responses/404' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /services_instances: + get: + operationId: GetServicesInstances + description: List services instances + parameters: + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /services_instances/{svc_id}: + get: + operationId: GetServicesInstance + description: List instances for a specific service (all nodes) + parameters: + - in: path + name: svc_id + required: true + description: Service identifier (svc_id UUID or svcname) + schema: + type: string + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 404: + $ref: '#/components/responses/404' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /services_instances_status_log: + get: + operationId: GetServicesInstancesStatusLog + description: List services instances status log. Each entry is a time range where a service instance status was stable. + parameters: + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /nodes/hbas: + get: + operationId: GetNodesHbas + description: List all nodes FC and iSCSI host bus adapters + parameters: + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /arrays: + get: + operationId: GetArrays + description: List storage arrays + parameters: + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /disks: + get: + operationId: GetDisks + description: List disks + parameters: + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /disks/{disk_id}: + get: + operationId: GetDisk + description: List entries for a specific disk + parameters: + - in: path + name: disk_id + required: true + description: Disk identifier + schema: + type: string + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 404: + $ref: '#/components/responses/404' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + /auth/node: post: description: | @@ -48,6 +794,7 @@ paths: 500: $ref: '#/components/responses/500' security: + - { } - basicAuth: [ ] - bearerAuth: [ ] tags: @@ -84,6 +831,8 @@ paths: - $ref: '#/components/parameters/inQueryOffset' - $ref: '#/components/parameters/inQueryMeta' - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' responses: 200: description: List of candidate modulesets @@ -113,6 +862,8 @@ paths: - $ref: '#/components/parameters/inQueryOffset' - $ref: '#/components/parameters/inQueryMeta' - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' responses: 200: description: List of candidate rulesets @@ -169,6 +920,8 @@ paths: - $ref: '#/components/parameters/inQueryOffset' - $ref: '#/components/parameters/inQueryMeta' - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' responses: 200: description: List of attached modulesets @@ -248,6 +1001,8 @@ paths: - $ref: '#/components/parameters/inQueryOffset' - $ref: '#/components/parameters/inQueryMeta' - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' responses: 200: description: List of attached rulesets @@ -325,6 +1080,8 @@ paths: - $ref: '#/components/parameters/inQueryOffset' - $ref: '#/components/parameters/inQueryMeta' - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' tags: - collector responses: @@ -402,6 +1159,235 @@ paths: - basicAuth: [ ] - bearerAuth: [ ] + /nodes/{node_id}/tags: + get: + operationId: GetNodeTags + description: List tags attached to a node + parameters: + - in: path + name: node_id + required: true + description: Node identifier (node_id UUID or nodename) + schema: + type: string + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 404: + $ref: '#/components/responses/404' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /nodes/{node_id}/candidate_tags: + get: + operationId: GetNodeCandidateTags + description: List tags attachable to a node (not yet attached and not excluded) + parameters: + - in: path + name: node_id + required: true + description: Node identifier (node_id UUID or nodename) + schema: + type: string + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 404: + $ref: '#/components/responses/404' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /services/{svc_id}/tags: + get: + operationId: GetServiceTags + description: List tags attached to a service + parameters: + - in: path + name: svc_id + required: true + description: Service identifier (svc_id UUID or svcname) + schema: + type: string + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 404: + $ref: '#/components/responses/404' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /services/{svc_id}/candidate_tags: + get: + operationId: GetServiceCandidateTags + description: List tags attachable to a service (not yet attached and not excluded) + parameters: + - in: path + name: svc_id + required: true + description: Service identifier (svc_id UUID or svcname) + schema: + type: string + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 404: + $ref: '#/components/responses/404' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /tags/nodes: + get: + operationId: GetTagsNodes + description: List all tag-node attachments + parameters: + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /tags/services: + get: + operationId: GetTagsServices + description: List all tag-service attachments + parameters: + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + + /tags/{tag_id}/services: + get: + operationId: GetTagServices + description: List services where the tag is attached + parameters: + - in: path + name: tag_id + required: true + description: ID of the tag + schema: + type: integer + - $ref: '#/components/parameters/inQueryProps' + - $ref: '#/components/parameters/inQueryLimit' + - $ref: '#/components/parameters/inQueryOffset' + - $ref: '#/components/parameters/inQueryMeta' + - $ref: '#/components/parameters/inQueryStats' + - $ref: '#/components/parameters/inQueryOrderby' + - $ref: '#/components/parameters/inQueryGroupby' + tags: + - collector + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse' + 404: + $ref: '#/components/responses/404' + 500: + $ref: '#/components/responses/500' + security: + - basicAuth: [ ] + - bearerAuth: [ ] + /version: get: operationId: GetVersion @@ -611,6 +1597,22 @@ components: schema: type: string + inQueryOrderby: + in: query + name: orderby + required: false + description: Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + schema: + type: string + + inQueryGroupby: + in: query + name: groupby + required: false + description: Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + schema: + type: string + inQuerySync: in: query name: sync diff --git a/server/codegen_server_gen.go b/server/codegen_server_gen.go index 30e21ec..f3dc9ef 100644 --- a/server/codegen_server_gen.go +++ b/server/codegen_server_gen.go @@ -21,9 +21,54 @@ import ( // ServerInterface represents all server handlers. type ServerInterface interface { + // (GET /apps) + GetApps(ctx echo.Context, params GetAppsParams) error + + // (POST /apps) + PostApps(ctx echo.Context) error + + // (DELETE /apps/{app_id}) + DeleteApps(ctx echo.Context, appId string) error + + // (GET /apps/{app_id}) + GetApp(ctx echo.Context, appId string, params GetAppParams) error + + // (POST /apps/{app_id}) + PostApp(ctx echo.Context, appId string) error + + // (GET /apps/{app_id}/am_i_responsible) + GetAppAmIResponsible(ctx echo.Context, appId string) error + + // (GET /apps/{app_id}/publications) + GetAppPublications(ctx echo.Context, appId string, params GetAppPublicationsParams) error + + // (GET /apps/{app_id}/responsibles) + GetAppResponsibles(ctx echo.Context, appId string, params GetAppResponsiblesParams) error + + // (GET /arrays) + GetArrays(ctx echo.Context, params GetArraysParams) error + // (POST /auth/node) PostAuthNode(ctx echo.Context) error + // (GET /disks) + GetDisks(ctx echo.Context, params GetDisksParams) error + + // (GET /disks/{disk_id}) + GetDisk(ctx echo.Context, diskId string, params GetDiskParams) error + + // (GET /nodes) + GetNodes(ctx echo.Context, params GetNodesParams) error + + // (GET /nodes/hbas) + GetNodesHbas(ctx echo.Context, params GetNodesHbasParams) error + + // (GET /nodes/{node_id}) + GetNode(ctx echo.Context, nodeId string, params GetNodeParams) error + + // (GET /nodes/{node_id}/candidate_tags) + GetNodeCandidateTags(ctx echo.Context, nodeId string, params GetNodeCandidateTagsParams) error + // (GET /nodes/{node_id}/compliance/candidate_modulesets) GetNodeComplianceCandidateModulesets(ctx echo.Context, nodeId InPathNodeId, params GetNodeComplianceCandidateModulesetsParams) error @@ -51,18 +96,63 @@ type ServerInterface interface { // (POST /nodes/{node_id}/compliance/rulesets/{rset_id}) PostNodeComplianceRuleset(ctx echo.Context, nodeId InPathNodeId, rsetId InPathRsetId) error + // (GET /nodes/{node_id}/disks) + GetNodeDisks(ctx echo.Context, nodeId string, params GetNodeDisksParams) error + + // (GET /nodes/{node_id}/hbas) + GetNodeHbas(ctx echo.Context, nodeId string, params GetNodeHbasParams) error + + // (GET /nodes/{node_id}/interfaces) + GetNodeInterfaces(ctx echo.Context, nodeId string, params GetNodeInterfacesParams) error + + // (GET /nodes/{node_id}/tags) + GetNodeTags(ctx echo.Context, nodeId string, params GetNodeTagsParams) error + + // (GET /nodes/{node_id}/uuid) + GetNodeUUID(ctx echo.Context, nodeId string) error + // (GET /openapi.json) GetSwagger(ctx echo.Context) error + // (GET /services) + GetServices(ctx echo.Context, params GetServicesParams) error + + // (GET /services/{svc_id}) + GetService(ctx echo.Context, svcId string, params GetServiceParams) error + + // (GET /services/{svc_id}/candidate_tags) + GetServiceCandidateTags(ctx echo.Context, svcId string, params GetServiceCandidateTagsParams) error + + // (GET /services/{svc_id}/tags) + GetServiceTags(ctx echo.Context, svcId string, params GetServiceTagsParams) error + + // (GET /services_instances) + GetServicesInstances(ctx echo.Context, params GetServicesInstancesParams) error + + // (GET /services_instances/{svc_id}) + GetServicesInstance(ctx echo.Context, svcId string, params GetServicesInstanceParams) error + + // (GET /services_instances_status_log) + GetServicesInstancesStatusLog(ctx echo.Context, params GetServicesInstancesStatusLogParams) error + // (GET /tags) GetTags(ctx echo.Context, params GetTagsParams) error + // (GET /tags/nodes) + GetTagsNodes(ctx echo.Context, params GetTagsNodesParams) error + + // (GET /tags/services) + GetTagsServices(ctx echo.Context, params GetTagsServicesParams) error + // (GET /tags/{tag_id}) GetTag(ctx echo.Context, tagId int, params GetTagParams) error // (GET /tags/{tag_id}/nodes) GetTagNodes(ctx echo.Context, tagId int, params GetTagNodesParams) error + // (GET /tags/{tag_id}/services) + GetTagServices(ctx echo.Context, tagId int, params GetTagServicesParams) error + // (GET /version) GetVersion(ctx echo.Context) error } @@ -72,28 +162,1884 @@ type ServerInterfaceWrapper struct { Handler ServerInterface } -// PostAuthNode converts echo context to params. -func (w *ServerInterfaceWrapper) PostAuthNode(ctx echo.Context) error { +// GetApps converts echo context to params. +func (w *ServerInterfaceWrapper) GetApps(ctx echo.Context) error { + var err error + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetAppsParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetApps(ctx, params) + return err +} + +// PostApps converts echo context to params. +func (w *ServerInterfaceWrapper) PostApps(ctx echo.Context) error { + var err error + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.PostApps(ctx) + return err +} + +// DeleteApps converts echo context to params. +func (w *ServerInterfaceWrapper) DeleteApps(ctx echo.Context) error { + var err error + // ------------- Path parameter "app_id" ------------- + var appId string + + err = runtime.BindStyledParameterWithOptions("simple", "app_id", ctx.Param("app_id"), &appId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter app_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.DeleteApps(ctx, appId) + return err +} + +// GetApp converts echo context to params. +func (w *ServerInterfaceWrapper) GetApp(ctx echo.Context) error { + var err error + // ------------- Path parameter "app_id" ------------- + var appId string + + err = runtime.BindStyledParameterWithOptions("simple", "app_id", ctx.Param("app_id"), &appId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter app_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetAppParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetApp(ctx, appId, params) + return err +} + +// PostApp converts echo context to params. +func (w *ServerInterfaceWrapper) PostApp(ctx echo.Context) error { + var err error + // ------------- Path parameter "app_id" ------------- + var appId string + + err = runtime.BindStyledParameterWithOptions("simple", "app_id", ctx.Param("app_id"), &appId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter app_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.PostApp(ctx, appId) + return err +} + +// GetAppAmIResponsible converts echo context to params. +func (w *ServerInterfaceWrapper) GetAppAmIResponsible(ctx echo.Context) error { + var err error + // ------------- Path parameter "app_id" ------------- + var appId string + + err = runtime.BindStyledParameterWithOptions("simple", "app_id", ctx.Param("app_id"), &appId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter app_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetAppAmIResponsible(ctx, appId) + return err +} + +// GetAppPublications converts echo context to params. +func (w *ServerInterfaceWrapper) GetAppPublications(ctx echo.Context) error { + var err error + // ------------- Path parameter "app_id" ------------- + var appId string + + err = runtime.BindStyledParameterWithOptions("simple", "app_id", ctx.Param("app_id"), &appId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter app_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetAppPublicationsParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetAppPublications(ctx, appId, params) + return err +} + +// GetAppResponsibles converts echo context to params. +func (w *ServerInterfaceWrapper) GetAppResponsibles(ctx echo.Context) error { var err error + // ------------- Path parameter "app_id" ------------- + var appId string + + err = runtime.BindStyledParameterWithOptions("simple", "app_id", ctx.Param("app_id"), &appId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter app_id: %s", err)) + } ctx.Set(BasicAuthScopes, []string{}) - ctx.Set(BearerAuthScopes, []string{}) + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetAppResponsiblesParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetAppResponsibles(ctx, appId, params) + return err +} + +// GetArrays converts echo context to params. +func (w *ServerInterfaceWrapper) GetArrays(ctx echo.Context) error { + var err error + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetArraysParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetArrays(ctx, params) + return err +} + +// PostAuthNode converts echo context to params. +func (w *ServerInterfaceWrapper) PostAuthNode(ctx echo.Context) error { + var err error + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.PostAuthNode(ctx) + return err +} + +// GetDisks converts echo context to params. +func (w *ServerInterfaceWrapper) GetDisks(ctx echo.Context) error { + var err error + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetDisksParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetDisks(ctx, params) + return err +} + +// GetDisk converts echo context to params. +func (w *ServerInterfaceWrapper) GetDisk(ctx echo.Context) error { + var err error + // ------------- Path parameter "disk_id" ------------- + var diskId string + + err = runtime.BindStyledParameterWithOptions("simple", "disk_id", ctx.Param("disk_id"), &diskId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter disk_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetDiskParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetDisk(ctx, diskId, params) + return err +} + +// GetNodes converts echo context to params. +func (w *ServerInterfaceWrapper) GetNodes(ctx echo.Context) error { + var err error + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetNodesParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetNodes(ctx, params) + return err +} + +// GetNodesHbas converts echo context to params. +func (w *ServerInterfaceWrapper) GetNodesHbas(ctx echo.Context) error { + var err error + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetNodesHbasParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetNodesHbas(ctx, params) + return err +} + +// GetNode converts echo context to params. +func (w *ServerInterfaceWrapper) GetNode(ctx echo.Context) error { + var err error + // ------------- Path parameter "node_id" ------------- + var nodeId string + + err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetNodeParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetNode(ctx, nodeId, params) + return err +} + +// GetNodeCandidateTags converts echo context to params. +func (w *ServerInterfaceWrapper) GetNodeCandidateTags(ctx echo.Context) error { + var err error + // ------------- Path parameter "node_id" ------------- + var nodeId string + + err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetNodeCandidateTagsParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetNodeCandidateTags(ctx, nodeId, params) + return err +} + +// GetNodeComplianceCandidateModulesets converts echo context to params. +func (w *ServerInterfaceWrapper) GetNodeComplianceCandidateModulesets(ctx echo.Context) error { + var err error + // ------------- Path parameter "node_id" ------------- + var nodeId InPathNodeId + + err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetNodeComplianceCandidateModulesetsParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetNodeComplianceCandidateModulesets(ctx, nodeId, params) + return err +} + +// GetNodeComplianceCandidateRulesets converts echo context to params. +func (w *ServerInterfaceWrapper) GetNodeComplianceCandidateRulesets(ctx echo.Context) error { + var err error + // ------------- Path parameter "node_id" ------------- + var nodeId InPathNodeId + + err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetNodeComplianceCandidateRulesetsParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetNodeComplianceCandidateRulesets(ctx, nodeId, params) + return err +} + +// GetNodeComplianceLogs converts echo context to params. +func (w *ServerInterfaceWrapper) GetNodeComplianceLogs(ctx echo.Context) error { + var err error + // ------------- Path parameter "node_id" ------------- + var nodeId InPathNodeId + + err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetNodeComplianceLogsParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetNodeComplianceLogs(ctx, nodeId, params) + return err +} + +// GetNodeComplianceModulesets converts echo context to params. +func (w *ServerInterfaceWrapper) GetNodeComplianceModulesets(ctx echo.Context) error { + var err error + // ------------- Path parameter "node_id" ------------- + var nodeId InPathNodeId + + err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetNodeComplianceModulesetsParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetNodeComplianceModulesets(ctx, nodeId, params) + return err +} + +// DeleteNodeComplianceModuleset converts echo context to params. +func (w *ServerInterfaceWrapper) DeleteNodeComplianceModuleset(ctx echo.Context) error { + var err error + // ------------- Path parameter "node_id" ------------- + var nodeId InPathNodeId + + err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) + } + + // ------------- Path parameter "mset_id" ------------- + var msetId InPathMsetId + + err = runtime.BindStyledParameterWithOptions("simple", "mset_id", ctx.Param("mset_id"), &msetId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter mset_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.DeleteNodeComplianceModuleset(ctx, nodeId, msetId) + return err +} + +// PostNodeComplianceModuleset converts echo context to params. +func (w *ServerInterfaceWrapper) PostNodeComplianceModuleset(ctx echo.Context) error { + var err error + // ------------- Path parameter "node_id" ------------- + var nodeId InPathNodeId + + err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) + } + + // ------------- Path parameter "mset_id" ------------- + var msetId InPathMsetId + + err = runtime.BindStyledParameterWithOptions("simple", "mset_id", ctx.Param("mset_id"), &msetId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter mset_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.PostNodeComplianceModuleset(ctx, nodeId, msetId) + return err +} + +// GetNodeComplianceRulesets converts echo context to params. +func (w *ServerInterfaceWrapper) GetNodeComplianceRulesets(ctx echo.Context) error { + var err error + // ------------- Path parameter "node_id" ------------- + var nodeId InPathNodeId + + err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetNodeComplianceRulesetsParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetNodeComplianceRulesets(ctx, nodeId, params) + return err +} + +// DeleteNodeComplianceRuleset converts echo context to params. +func (w *ServerInterfaceWrapper) DeleteNodeComplianceRuleset(ctx echo.Context) error { + var err error + // ------------- Path parameter "node_id" ------------- + var nodeId InPathNodeId + + err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) + } + + // ------------- Path parameter "rset_id" ------------- + var rsetId InPathRsetId + + err = runtime.BindStyledParameterWithOptions("simple", "rset_id", ctx.Param("rset_id"), &rsetId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter rset_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.DeleteNodeComplianceRuleset(ctx, nodeId, rsetId) + return err +} + +// PostNodeComplianceRuleset converts echo context to params. +func (w *ServerInterfaceWrapper) PostNodeComplianceRuleset(ctx echo.Context) error { + var err error + // ------------- Path parameter "node_id" ------------- + var nodeId InPathNodeId + + err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) + } + + // ------------- Path parameter "rset_id" ------------- + var rsetId InPathRsetId + + err = runtime.BindStyledParameterWithOptions("simple", "rset_id", ctx.Param("rset_id"), &rsetId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter rset_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.PostNodeComplianceRuleset(ctx, nodeId, rsetId) + return err +} + +// GetNodeDisks converts echo context to params. +func (w *ServerInterfaceWrapper) GetNodeDisks(ctx echo.Context) error { + var err error + // ------------- Path parameter "node_id" ------------- + var nodeId string + + err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetNodeDisksParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetNodeDisks(ctx, nodeId, params) + return err +} + +// GetNodeHbas converts echo context to params. +func (w *ServerInterfaceWrapper) GetNodeHbas(ctx echo.Context) error { + var err error + // ------------- Path parameter "node_id" ------------- + var nodeId string + + err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetNodeHbasParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetNodeHbas(ctx, nodeId, params) + return err +} + +// GetNodeInterfaces converts echo context to params. +func (w *ServerInterfaceWrapper) GetNodeInterfaces(ctx echo.Context) error { + var err error + // ------------- Path parameter "node_id" ------------- + var nodeId string + + err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetNodeInterfacesParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetNodeInterfaces(ctx, nodeId, params) + return err +} + +// GetNodeTags converts echo context to params. +func (w *ServerInterfaceWrapper) GetNodeTags(ctx echo.Context) error { + var err error + // ------------- Path parameter "node_id" ------------- + var nodeId string + + err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetNodeTagsParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetNodeTags(ctx, nodeId, params) + return err +} + +// GetNodeUUID converts echo context to params. +func (w *ServerInterfaceWrapper) GetNodeUUID(ctx echo.Context) error { + var err error + // ------------- Path parameter "node_id" ------------- + var nodeId string + + err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetNodeUUID(ctx, nodeId) + return err +} + +// GetSwagger converts echo context to params. +func (w *ServerInterfaceWrapper) GetSwagger(ctx echo.Context) error { + var err error + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetSwagger(ctx) + return err +} + +// GetServices converts echo context to params. +func (w *ServerInterfaceWrapper) GetServices(ctx echo.Context) error { + var err error + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetServicesParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetServices(ctx, params) + return err +} + +// GetService converts echo context to params. +func (w *ServerInterfaceWrapper) GetService(ctx echo.Context) error { + var err error + // ------------- Path parameter "svc_id" ------------- + var svcId string + + err = runtime.BindStyledParameterWithOptions("simple", "svc_id", ctx.Param("svc_id"), &svcId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter svc_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetServiceParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetService(ctx, svcId, params) + return err +} + +// GetServiceCandidateTags converts echo context to params. +func (w *ServerInterfaceWrapper) GetServiceCandidateTags(ctx echo.Context) error { + var err error + // ------------- Path parameter "svc_id" ------------- + var svcId string + + err = runtime.BindStyledParameterWithOptions("simple", "svc_id", ctx.Param("svc_id"), &svcId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter svc_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetServiceCandidateTagsParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetServiceCandidateTags(ctx, svcId, params) + return err +} + +// GetServiceTags converts echo context to params. +func (w *ServerInterfaceWrapper) GetServiceTags(ctx echo.Context) error { + var err error + // ------------- Path parameter "svc_id" ------------- + var svcId string + + err = runtime.BindStyledParameterWithOptions("simple", "svc_id", ctx.Param("svc_id"), &svcId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter svc_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetServiceTagsParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetServiceTags(ctx, svcId, params) + return err +} + +// GetServicesInstances converts echo context to params. +func (w *ServerInterfaceWrapper) GetServicesInstances(ctx echo.Context) error { + var err error + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetServicesInstancesParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } // Invoke the callback with all the unmarshaled arguments - err = w.Handler.PostAuthNode(ctx) + err = w.Handler.GetServicesInstances(ctx, params) return err } -// GetNodeComplianceCandidateModulesets converts echo context to params. -func (w *ServerInterfaceWrapper) GetNodeComplianceCandidateModulesets(ctx echo.Context) error { +// GetServicesInstance converts echo context to params. +func (w *ServerInterfaceWrapper) GetServicesInstance(ctx echo.Context) error { var err error - // ------------- Path parameter "node_id" ------------- - var nodeId InPathNodeId + // ------------- Path parameter "svc_id" ------------- + var svcId string - err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + err = runtime.BindStyledParameterWithOptions("simple", "svc_id", ctx.Param("svc_id"), &svcId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter svc_id: %s", err)) } ctx.Set(BasicAuthScopes, []string{}) @@ -101,7 +2047,7 @@ func (w *ServerInterfaceWrapper) GetNodeComplianceCandidateModulesets(ctx echo.C ctx.Set(BearerAuthScopes, []string{}) // Parameter object where we will unmarshal all parameters from the context - var params GetNodeComplianceCandidateModulesetsParams + var params GetServicesInstanceParams // ------------- Optional query parameter "props" ------------- err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) @@ -137,28 +2083,35 @@ func (w *ServerInterfaceWrapper) GetNodeComplianceCandidateModulesets(ctx echo.C return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) } + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + // Invoke the callback with all the unmarshaled arguments - err = w.Handler.GetNodeComplianceCandidateModulesets(ctx, nodeId, params) + err = w.Handler.GetServicesInstance(ctx, svcId, params) return err } -// GetNodeComplianceCandidateRulesets converts echo context to params. -func (w *ServerInterfaceWrapper) GetNodeComplianceCandidateRulesets(ctx echo.Context) error { +// GetServicesInstancesStatusLog converts echo context to params. +func (w *ServerInterfaceWrapper) GetServicesInstancesStatusLog(ctx echo.Context) error { var err error - // ------------- Path parameter "node_id" ------------- - var nodeId InPathNodeId - - err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) - if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) - } ctx.Set(BasicAuthScopes, []string{}) ctx.Set(BearerAuthScopes, []string{}) // Parameter object where we will unmarshal all parameters from the context - var params GetNodeComplianceCandidateRulesetsParams + var params GetServicesInstancesStatusLogParams // ------------- Optional query parameter "props" ------------- err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) @@ -194,57 +2147,35 @@ func (w *ServerInterfaceWrapper) GetNodeComplianceCandidateRulesets(ctx echo.Con return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) } - // Invoke the callback with all the unmarshaled arguments - err = w.Handler.GetNodeComplianceCandidateRulesets(ctx, nodeId, params) - return err -} - -// GetNodeComplianceLogs converts echo context to params. -func (w *ServerInterfaceWrapper) GetNodeComplianceLogs(ctx echo.Context) error { - var err error - // ------------- Path parameter "node_id" ------------- - var nodeId InPathNodeId + // ------------- Optional query parameter "orderby" ------------- - err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) } - ctx.Set(BasicAuthScopes, []string{}) - - ctx.Set(BearerAuthScopes, []string{}) - - // Parameter object where we will unmarshal all parameters from the context - var params GetNodeComplianceLogsParams - // ------------- Optional query parameter "props" ------------- + // ------------- Optional query parameter "groupby" ------------- - err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) } // Invoke the callback with all the unmarshaled arguments - err = w.Handler.GetNodeComplianceLogs(ctx, nodeId, params) + err = w.Handler.GetServicesInstancesStatusLog(ctx, params) return err } -// GetNodeComplianceModulesets converts echo context to params. -func (w *ServerInterfaceWrapper) GetNodeComplianceModulesets(ctx echo.Context) error { +// GetTags converts echo context to params. +func (w *ServerInterfaceWrapper) GetTags(ctx echo.Context) error { var err error - // ------------- Path parameter "node_id" ------------- - var nodeId InPathNodeId - - err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) - if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) - } ctx.Set(BasicAuthScopes, []string{}) ctx.Set(BearerAuthScopes, []string{}) // Parameter object where we will unmarshal all parameters from the context - var params GetNodeComplianceModulesetsParams + var params GetTagsParams // ------------- Optional query parameter "props" ------------- err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) @@ -280,84 +2211,35 @@ func (w *ServerInterfaceWrapper) GetNodeComplianceModulesets(ctx echo.Context) e return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) } - // Invoke the callback with all the unmarshaled arguments - err = w.Handler.GetNodeComplianceModulesets(ctx, nodeId, params) - return err -} - -// DeleteNodeComplianceModuleset converts echo context to params. -func (w *ServerInterfaceWrapper) DeleteNodeComplianceModuleset(ctx echo.Context) error { - var err error - // ------------- Path parameter "node_id" ------------- - var nodeId InPathNodeId - - err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) - if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) - } - - // ------------- Path parameter "mset_id" ------------- - var msetId InPathMsetId - - err = runtime.BindStyledParameterWithOptions("simple", "mset_id", ctx.Param("mset_id"), &msetId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) - if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter mset_id: %s", err)) - } - - ctx.Set(BasicAuthScopes, []string{}) - - ctx.Set(BearerAuthScopes, []string{}) - - // Invoke the callback with all the unmarshaled arguments - err = w.Handler.DeleteNodeComplianceModuleset(ctx, nodeId, msetId) - return err -} - -// PostNodeComplianceModuleset converts echo context to params. -func (w *ServerInterfaceWrapper) PostNodeComplianceModuleset(ctx echo.Context) error { - var err error - // ------------- Path parameter "node_id" ------------- - var nodeId InPathNodeId + // ------------- Optional query parameter "orderby" ------------- - err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) } - // ------------- Path parameter "mset_id" ------------- - var msetId InPathMsetId + // ------------- Optional query parameter "groupby" ------------- - err = runtime.BindStyledParameterWithOptions("simple", "mset_id", ctx.Param("mset_id"), &msetId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter mset_id: %s", err)) + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) } - ctx.Set(BasicAuthScopes, []string{}) - - ctx.Set(BearerAuthScopes, []string{}) - // Invoke the callback with all the unmarshaled arguments - err = w.Handler.PostNodeComplianceModuleset(ctx, nodeId, msetId) + err = w.Handler.GetTags(ctx, params) return err } -// GetNodeComplianceRulesets converts echo context to params. -func (w *ServerInterfaceWrapper) GetNodeComplianceRulesets(ctx echo.Context) error { +// GetTagsNodes converts echo context to params. +func (w *ServerInterfaceWrapper) GetTagsNodes(ctx echo.Context) error { var err error - // ------------- Path parameter "node_id" ------------- - var nodeId InPathNodeId - - err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) - if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) - } ctx.Set(BasicAuthScopes, []string{}) ctx.Set(BearerAuthScopes, []string{}) // Parameter object where we will unmarshal all parameters from the context - var params GetNodeComplianceRulesetsParams + var params GetTagsNodesParams // ------------- Optional query parameter "props" ------------- err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) @@ -393,78 +2275,27 @@ func (w *ServerInterfaceWrapper) GetNodeComplianceRulesets(ctx echo.Context) err return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) } - // Invoke the callback with all the unmarshaled arguments - err = w.Handler.GetNodeComplianceRulesets(ctx, nodeId, params) - return err -} - -// DeleteNodeComplianceRuleset converts echo context to params. -func (w *ServerInterfaceWrapper) DeleteNodeComplianceRuleset(ctx echo.Context) error { - var err error - // ------------- Path parameter "node_id" ------------- - var nodeId InPathNodeId - - err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) - if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) - } - - // ------------- Path parameter "rset_id" ------------- - var rsetId InPathRsetId - - err = runtime.BindStyledParameterWithOptions("simple", "rset_id", ctx.Param("rset_id"), &rsetId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) - if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter rset_id: %s", err)) - } - - ctx.Set(BasicAuthScopes, []string{}) - - ctx.Set(BearerAuthScopes, []string{}) - - // Invoke the callback with all the unmarshaled arguments - err = w.Handler.DeleteNodeComplianceRuleset(ctx, nodeId, rsetId) - return err -} - -// PostNodeComplianceRuleset converts echo context to params. -func (w *ServerInterfaceWrapper) PostNodeComplianceRuleset(ctx echo.Context) error { - var err error - // ------------- Path parameter "node_id" ------------- - var nodeId InPathNodeId + // ------------- Optional query parameter "orderby" ------------- - err = runtime.BindStyledParameterWithOptions("simple", "node_id", ctx.Param("node_id"), &nodeId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter node_id: %s", err)) + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) } - // ------------- Path parameter "rset_id" ------------- - var rsetId InPathRsetId + // ------------- Optional query parameter "groupby" ------------- - err = runtime.BindStyledParameterWithOptions("simple", "rset_id", ctx.Param("rset_id"), &rsetId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter rset_id: %s", err)) + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) } - ctx.Set(BasicAuthScopes, []string{}) - - ctx.Set(BearerAuthScopes, []string{}) - - // Invoke the callback with all the unmarshaled arguments - err = w.Handler.PostNodeComplianceRuleset(ctx, nodeId, rsetId) - return err -} - -// GetSwagger converts echo context to params. -func (w *ServerInterfaceWrapper) GetSwagger(ctx echo.Context) error { - var err error - // Invoke the callback with all the unmarshaled arguments - err = w.Handler.GetSwagger(ctx) + err = w.Handler.GetTagsNodes(ctx, params) return err } -// GetTags converts echo context to params. -func (w *ServerInterfaceWrapper) GetTags(ctx echo.Context) error { +// GetTagsServices converts echo context to params. +func (w *ServerInterfaceWrapper) GetTagsServices(ctx echo.Context) error { var err error ctx.Set(BasicAuthScopes, []string{}) @@ -472,7 +2303,7 @@ func (w *ServerInterfaceWrapper) GetTags(ctx echo.Context) error { ctx.Set(BearerAuthScopes, []string{}) // Parameter object where we will unmarshal all parameters from the context - var params GetTagsParams + var params GetTagsServicesParams // ------------- Optional query parameter "props" ------------- err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) @@ -508,8 +2339,22 @@ func (w *ServerInterfaceWrapper) GetTags(ctx echo.Context) error { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) } + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + // Invoke the callback with all the unmarshaled arguments - err = w.Handler.GetTags(ctx, params) + err = w.Handler.GetTagsServices(ctx, params) return err } @@ -585,6 +2430,77 @@ func (w *ServerInterfaceWrapper) GetTagNodes(ctx echo.Context) error { return err } +// GetTagServices converts echo context to params. +func (w *ServerInterfaceWrapper) GetTagServices(ctx echo.Context) error { + var err error + // ------------- Path parameter "tag_id" ------------- + var tagId int + + err = runtime.BindStyledParameterWithOptions("simple", "tag_id", ctx.Param("tag_id"), &tagId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter tag_id: %s", err)) + } + + ctx.Set(BasicAuthScopes, []string{}) + + ctx.Set(BearerAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params GetTagServicesParams + // ------------- Optional query parameter "props" ------------- + + err = runtime.BindQueryParameter("form", true, false, "props", ctx.QueryParams(), ¶ms.Props) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter props: %s", err)) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) + } + + // ------------- Optional query parameter "meta" ------------- + + err = runtime.BindQueryParameter("form", true, false, "meta", ctx.QueryParams(), ¶ms.Meta) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter meta: %s", err)) + } + + // ------------- Optional query parameter "stats" ------------- + + err = runtime.BindQueryParameter("form", true, false, "stats", ctx.QueryParams(), ¶ms.Stats) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter stats: %s", err)) + } + + // ------------- Optional query parameter "orderby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "orderby", ctx.QueryParams(), ¶ms.Orderby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderby: %s", err)) + } + + // ------------- Optional query parameter "groupby" ------------- + + err = runtime.BindQueryParameter("form", true, false, "groupby", ctx.QueryParams(), ¶ms.Groupby) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter groupby: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetTagServices(ctx, tagId, params) + return err +} + // GetVersion converts echo context to params. func (w *ServerInterfaceWrapper) GetVersion(ctx echo.Context) error { var err error @@ -622,7 +2538,22 @@ func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL Handler: si, } + router.GET(baseURL+"/apps", wrapper.GetApps) + router.POST(baseURL+"/apps", wrapper.PostApps) + router.DELETE(baseURL+"/apps/:app_id", wrapper.DeleteApps) + router.GET(baseURL+"/apps/:app_id", wrapper.GetApp) + router.POST(baseURL+"/apps/:app_id", wrapper.PostApp) + router.GET(baseURL+"/apps/:app_id/am_i_responsible", wrapper.GetAppAmIResponsible) + router.GET(baseURL+"/apps/:app_id/publications", wrapper.GetAppPublications) + router.GET(baseURL+"/apps/:app_id/responsibles", wrapper.GetAppResponsibles) + router.GET(baseURL+"/arrays", wrapper.GetArrays) router.POST(baseURL+"/auth/node", wrapper.PostAuthNode) + router.GET(baseURL+"/disks", wrapper.GetDisks) + router.GET(baseURL+"/disks/:disk_id", wrapper.GetDisk) + router.GET(baseURL+"/nodes", wrapper.GetNodes) + router.GET(baseURL+"/nodes/hbas", wrapper.GetNodesHbas) + router.GET(baseURL+"/nodes/:node_id", wrapper.GetNode) + router.GET(baseURL+"/nodes/:node_id/candidate_tags", wrapper.GetNodeCandidateTags) router.GET(baseURL+"/nodes/:node_id/compliance/candidate_modulesets", wrapper.GetNodeComplianceCandidateModulesets) router.GET(baseURL+"/nodes/:node_id/compliance/candidate_rulesets", wrapper.GetNodeComplianceCandidateRulesets) router.GET(baseURL+"/nodes/:node_id/compliance/logs", wrapper.GetNodeComplianceLogs) @@ -632,10 +2563,25 @@ func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL router.GET(baseURL+"/nodes/:node_id/compliance/rulesets", wrapper.GetNodeComplianceRulesets) router.DELETE(baseURL+"/nodes/:node_id/compliance/rulesets/:rset_id", wrapper.DeleteNodeComplianceRuleset) router.POST(baseURL+"/nodes/:node_id/compliance/rulesets/:rset_id", wrapper.PostNodeComplianceRuleset) + router.GET(baseURL+"/nodes/:node_id/disks", wrapper.GetNodeDisks) + router.GET(baseURL+"/nodes/:node_id/hbas", wrapper.GetNodeHbas) + router.GET(baseURL+"/nodes/:node_id/interfaces", wrapper.GetNodeInterfaces) + router.GET(baseURL+"/nodes/:node_id/tags", wrapper.GetNodeTags) + router.GET(baseURL+"/nodes/:node_id/uuid", wrapper.GetNodeUUID) router.GET(baseURL+"/openapi.json", wrapper.GetSwagger) + router.GET(baseURL+"/services", wrapper.GetServices) + router.GET(baseURL+"/services/:svc_id", wrapper.GetService) + router.GET(baseURL+"/services/:svc_id/candidate_tags", wrapper.GetServiceCandidateTags) + router.GET(baseURL+"/services/:svc_id/tags", wrapper.GetServiceTags) + router.GET(baseURL+"/services_instances", wrapper.GetServicesInstances) + router.GET(baseURL+"/services_instances/:svc_id", wrapper.GetServicesInstance) + router.GET(baseURL+"/services_instances_status_log", wrapper.GetServicesInstancesStatusLog) router.GET(baseURL+"/tags", wrapper.GetTags) + router.GET(baseURL+"/tags/nodes", wrapper.GetTagsNodes) + router.GET(baseURL+"/tags/services", wrapper.GetTagsServices) router.GET(baseURL+"/tags/:tag_id", wrapper.GetTag) router.GET(baseURL+"/tags/:tag_id/nodes", wrapper.GetTagNodes) + router.GET(baseURL+"/tags/:tag_id/services", wrapper.GetTagServices) router.GET(baseURL+"/version", wrapper.GetVersion) } @@ -643,36 +2589,54 @@ func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/+xaT3PbuhH/Khi0R1WSX/wOTzfHTjJpHceVnfZgezIQuZSQkAADLB2rHn33zgIkRZnQ", - "XydynPFJI2KB/e3/XRL3PNJZrhUotHxwz3NhRAYIxv2T6lzg5IMFfB/T/xhsZGSOUis+4O9PmE4YToBl", - "Oi5SsIC8wyUt5QInvMOVyIAPeGYBP8uYd7iBb4U0EPMBmgI63EYTyAQdjdOcSC0aqcZ8NuuUzM90DKuZ", - "Kx1DmC+t7Mp3uFZos0pks6PI/y7ATE9lJrHN+pI0Le5kVmRMFdkIDEEBhUaCZaiZASyM6rI+y0Aoy5Rm", - "KR3VrTB+o9PnIN0ib0KKIRFFinzwZ7/DM6mIFx/0OxVWqRDGYJpgPwCKgJpUlBYxsAxQxAIFk8orDWyu", - "lYUue6PEKIWYjaas5NplnyywRKQWmDasTyLpTKJ3MUDBEglpvEwaouAb6fdjkpDhWqAvvsrcMUuksVhr", - "trS3EyMqjNVmGQTtDw5qdGOFnhud2za4I5ZKiwQmNzoHg6XRZalpqRiIaOJhxjKibUqY6TKsuWOzkb4u", - "UGAA0bFWaHRqnXYcDCu1mluanBHiJhZCL9g1t3TgNWdfYdphkVYopJJq7PZZSCFCiJtixtKiVBGyW5EW", - "YFmkC4V2mWTu9JWSzSgsvSM6uQ77ffohJKCcY4g8T2UkCHjviyVx7xvn/d1Awgf8b7158uz5Vds7N3qU", - "Qua5LCrstYjZEL4VYJHPOvywf7APrp+UKHCijfwfxJ7tq32wfavNSMYxKM/zcB88zzSyt7pQpZx/7YPn", - "sVZJKiNn0T/340fvFYJRImUXYG7BsDfGaJ9Cys109qm0WOXmeSg5TLdCppR8P+dVqpEImQ1ESp2nhDFi", - "Sv9d6DUo6wTW4VWUOh5xLAmtSM8XeLd3lU/06At4JZYJLd4FXVpVzjYfXSf9AAaNIg0thfCRYodl9mgr", - "l9Iv/WoFHxM+uGqjn5/0AP1yrT1Cmw8e3Mw6vlCu8b7ae3yurFqYKy/fTYBR5a8tjSDcYaicTYpMqH8Y", - "EDH5IoO7PBXKRQqzOUQykRHVN5xIy3QUFcaAiqCsxtcq9/y614p3AqWridkhCGG+BWOlD8pFzI0FuBNZ", - "ntK+frffPVjLrNra5kfxCVFhJE4vSM2e1UhYGR0VOKlTA+1xT+e8Jog5AR6BMGAqav/vrTaZQD7g//zv", - "ZVX13BFu9eEZvqwn2llGohNM56DsbcQinVLt1YaJXPKGevhBt9995aIoB0WLA/6q2+/2ecf1vU6QHpWZ", - "nuvGSZ/aBqw+hLG0CIYJ17Yz2gIKywzpTElmcP+o++bn2iKJe+abfOOr52sdT7dKtA8SYJ4HswlB8j3E", - "/Roj15QBK7e6iz+2rAqLYGtjPURbFDJej9RRlSYPgX1YW46iCHJc6BRCeaIWsEdE82q7jvavRplcTUtE", - "zZBxubQRLFc3lDGbAXF1MyMJxdiS4ORa/IZOcD5pe/flODhz/FIpVAS9SKhYxgLhcz3DOq2PQ/PBO0BW", - "b5gPvZYluvLogAu/AyTvPa6ZHldHfJiz7CxM3ldh5cxJegvDMSliLX1jttic3k+im9OXk9XmG3yN2Zjc", - "TyJk5kdF2LrKV5f3QICcllNYyBEare7DxjQGpjSypOpOyxhY0thZ39jBvLHbMQrqlL5NKJjtAsE8MgyG", - "L0Hw/IPA/A4hkOrxGqevaRnRbunxp3T8fp38sU6y6fASmovbqqpf1z5nJ9mwUWi0BwJRRBOIaZzZ3Fte", - "uoNnnBhrk/8mzcFcjN59+Tln5iGmgNAGewIkPxNz+VlidLbc/U/cQUsiYA8B0PjQFXCggNVqcMwWUQTW", - "JkWaTlkM3vCrra1NQzFPbfrOkmH9CFs2XJXAaFT/hey324uCwHy8+AGvPdz/sco3qjzg3aG/yYjcb3wb", - "WEd7sO2YvpfRe4u8stGoYR5XSF/mi+dfRn+L8cLUJdRsU0LNzgV0uNf0O9ymfA4fVTzNcymdZqfC+YR2", - "e8qyOXwpmvM8Un5p6VbKLqtjq9ZdfBfjsfvO82TZ+uO/fhntV9rMi1Eqo1KV/uGSBsOVGrhz367HzJEG", - "OopLsdOrm5d+4Ed62JPEIT3v3aMYV/U66EUn0uapmJL/VBeXpkv8qO1Gy24YoiMO3C70aDa5XNi4ybDn", - "N4drvzRWWeNwk0xw+GvY33d3K4cVR8G+T8BAZUQm56PLEqc4c+c+D8/46Yns6V5aV3NHaUSJE3//hPS9", - "rCe9FONgH7pfN23cWAm6pr+OyUQuWUUa8MT/1Es/LdVX3H9Mlq/VIXIxkql0tyZuZl6z1PD7OCpMyge8", - "2+Ozm9n/AwAA//94ygbJ8y4AAA==", + "H4sIAAAAAAAC/+xdzXLbOBJ+lS7uHpIqRVImnsO4ag4ZZ5L1bn68crJ7SFwuiGxJmJAAA4C2tS69+xYA", + "gqItUKTkWJYTnFwWm+gG8H39AwLkdRTzLOcMmZLR4XWUE0EyVCjMf5SdEDV7J1EdJ/r/BGUsaK4oZ9Fh", + "dPwK+ATUDCHjSZGiRBX1Iqov5UTNol7ESIbRYZRJVOc0iXqRwG8FFZhEh0oU2ItkPMOM6KbVPNeiUgnK", + "ptFi0SuVv+cJrlfOeIJ+vfrKtnpHrZ0W67ostuzyvwsU8zeCF/l4vqr8iGcZeSZRz5LCBFIqlTYnFzxH", + "oShKUBym+nZrIsoiVTCewxPsT/v2ynj+O8nznryIta1P+64D37TqZQ9K2aiTxW9pRtWqvR81NsgVzYoM", + "WJGNUWhrkSlRmipQFYL1YQgZEiaBcUh1U01GmYs3TEpwQopURYe/DntRRpnWFR0Oe85WyhROUdSNfYeK", + "eCaWxWmRIGSoSEIUAcrcGOacSezDn4yMU0z0cJZa+/BJIkxIKhG4gKHuEs+osqRARWBCMU2aeqMluo3v", + "h8lEQ23F6NOv1M70hAqpqpEtEWq6ERdCctFkArcNe0e084B+EAmK7fEqudAY7cOJwAm9AuKuz+GSqhk8", + "gwkXoFtGllA2Ba71lZDmVvfvmuu6T71nJM8bQV1Kdxv0E8Fzudqplw3doCWAKAMk8cyOfkJjfRsjYt5k", + "U27UdLLoVBElfcPMlOCpNJNuzJCUsyWANccwqduirSfwJZK6wS8RfMV5D2LOFKFMj7C+T2KKsZ61WjcT", + "KhVlsYILkhYoIeYFU7KpZ6b1tT1baP9o+WX6dTAc6j/aEmQG7yTPUxoTbfjgL6m7e11r7+8CJ9Fh9LfB", + "MooN7FU5OBF8nGJmtdwcsD9IAiP8VqBU0aIXHQyf70LrJ0YKNeOC/g8Tq/bFLtS+5mJMkwSZ1XmwC53v", + "uYLXvGBlP3/bhc4jziYpjc2M/robHB0zhYKRFE5RXKCAP4Xg1jOWN+u231KpXMhZUsnYdEFoqmPKee5c", + "DVWYSQ9TKvdLhCBz/b+hXk2y8su9yLHU6EgSqq0l6ckN3at3lb/w8V9oB7F0aMk21qUuIVjVw6tY5rGB", + "K5L6Lvns0wM7Kr3H6uBq96v/coYfJtHh51Xrly3dsr551O4wmrd+OFv0bPxvQV+FHusrXS752fbvzKPI", + "4XVlRBReKV84mxUZYc8EkkRjEfAqTwkzTAGZY0wnNNbxTc2oBB7HhRDIYiyTjC8st/r6X1jU84Suus3G", + "Ap/NFygktaS8aXPtAl6RLE/1fcP+sP+8VZm7dVWf5ifGhaBqfqqH2aoaE0njl4WaVa5B32N+XeqaKZVr", + "g8dIBAonbf97zUVGVHQY/fO/H13UM02Yq7fbsGF9ws3MUGU6xnNk8iKGmKc69nIBJKdRbXii5/1h/4Vh", + "UY5MXzyMXvSH/WHUMwWI6ciA5JauU1/KqAEFlecBI2uaE2bKdc0TvUH10v5erwc/+5G6FBncSJw0j7rJ", + "2+qhu3yZDXe/wRKos7hNszawp8wqu9/hKrzF2a0E6JfvGLhu+EdP9Prwr1qo9DVUWTbQQnXaGDDUCPP5", + "TPe9TorPZ7pvikw1cKIK0JH2ezmXHmAeCSQKgTCodRliW93fxOcJlw6gwqZxf/BkvtHA3YrEee4NayTP", + "zxOeEcoaLysk2XkZH1cEbvTwusVhaSM8zmpxew1hcUfMeBT4gHHQBRhaaJlBt8k+r6W9bbIvaqljm+xv", + "DwLkRc+62sG1xgFNFhbTKSpcRfcr83sndFtRvwO+FbvzHATGXCRAEzDhIndtehalrJkbrUmd7Qpr94Wf", + "gy6yB3uPtZ4/mL+iMk/J3Mx7zaP54/nDo6m3YQaxM/R1R8n+hMsZYVOvQ1mHhDJy7oljedShO8Tp7fzs", + "w8fpAcnO6XmpjI5TbCyWRmbtFPRsAi0f+1jUogAqodaGWaQ2NXJrgLfu+GV2PKqZ8KOE+jHnKRK237F+", + "DzCYF2M3mG3Fus/FL++2T/Wagv5JXc2jSwDCEsJjWEJ4ZMyrOe0tmFd3+WuZN6qrCcwLzPspmScEmbew", + "TCouiC5lrKyPTe5KWI4Oy9H3gdJCzQZmH5kuL73l9gin1GT9xGw4A30LMlUOhXn25am0C7uB7d7Xqd3u", + "l/ZF5krSt9J814r1prHV063b1hYFTdotNVLlMzL/svitGBrHmKsbWyv2Z43Z4LE7QDW6SmwmVH5tcaBW", + "xOM3X5UXgtsMbvMe3KbB3eBa/3GPP5pB6vYmTnR2u9xYoG9ugm5b1qxlgCbaDU+oecLuyZVL60KyHJLl", + "fU+WdWxucfVWxMOX9+WF4OqDq78vaA5mY9K2YpKmFqPw+ggIS4CeHp0ew4xLBeNCAklIbsDZBOF/aBUB", + "xgHG9wjj6/Jg0HYZC2t4pFMWemszFi1Ty1jgSWkJfPp0/Aq4AFeePf2OJ5oCfUIy8+BUG8SEJTQhCs/t", + "HeuYpyWAKEXimdmkqrhbdnnCuII5qvIqJibI6B/xyu5Wf9rEzSNnwEetPxA1EDUQ1UtUnuUpJSzGGmer", + "E77NzH2DCqoblkeCXfzU7XuWSR05K6UVTd8tVW6eD9aODgde/WC8elsev/SBrcY4j0PXcWLijqWVZGs4", + "0SXtiS5cnujaJd3EZmQTd6TaKBAtEK0L0cSPQLOUT1uIVcmClt2QVW/5dNdEuitIup6M9B26XR2q6qUc", + "jxkkHROeWppTVSRVtdIFLSHLCc53rfOtYPWDJDnLbgyuyxcDtRyc0v0Hsuw/TATPmilmj081sGwHJKu9", + "MskDIM+sVcaBLOIYpZwUaTqHBO3Er59tLmoD89BT33RW5aVamcN1TvKES7VH87fdxp0tjof8sg4bzg/s", + "y5GPfVur6FQyibsF61AnhVDdJVT/EGWSqMK02CRMi62D9GinLn60SYge3SlAi8cSnsVWwfkB5+0hQ/Mo", + "BOZmP9J116p9EV2nZ+sNm1nDc7sQzsNzu2TRZXOWfYbuztt03pTl35MViBeIF4iXLAZUJ20TEmM3+jFU", + "l1x8hdptDbw7rksE9gX2Bfatsm+j3WT1BZ8m1oXtYYFvgW+NfHOHN9e+j8wEOi3Zhw8sLf+vv3fBbNvM", + "CCNTFBKIQCBpyi/RvCvfS0vNrH2k5U/0hrwHwV/5otu+G7kSdysYOb0k06k5BPjgjN6DdR03mvY9QeVQ", + "ShQXtDVNraQ8RDxdXgsndMIJnXugu0Pf4FpexFuf0SlbWQPhtlBSit2IJtaiKpi4L+j4Y4kVDhleyPD2", + "PcKuUO7uZ3XKJrc9rlOSb6MTO4GwgbA/LWG3WgRpD5KBd4F3gXcrvDunTCrCOldSsJRfU1Md14RCcRWK", + "q50AuGOZVck3FFrwpHrxx9MuGA9BJfAsBJUGTp5LRVQhz1M+3TS+gL0VUj7tw58knpkFkjlQCQQUzRCE", + "+WrE5QwF1uo014C7/5KYpsYp9juFrFNz21s+DbErxK774Ul7iYNX5ruXU1Pr+GDrL2cCQANAvxdAu7zC", + "T2dKikyf2dcIm4o8M5/fb0BseLNfgO19w7bbk0GHXJc1dABveGAY8LsD/F4rMl1bxbqNKYpM3efR5g2Y", + "batNdflpPwWljLCn+rTWdKk+ax+4Dt/Gu/v8t8TfN1i+QbcsgMpJNOWRO8XjB0VDEN5LZNy7s3y41424", + "k5blJFI1s59c0+PddArvI5l6T949JEw324mzMVqbo+7PCdgQ3X+GlbTqK/kNnBL2Y44kp+BEPfT5T3Xp", + "3sbbaf8+iVQ1HCQnY5pS8/mVs4UdWXHhmF+INDqM+oNocbb4fwAAAP//b3zgBvaNAAA=", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/server/codegen_type_gen.go b/server/codegen_type_gen.go index 60afe6e..41f84ca 100644 --- a/server/codegen_type_gen.go +++ b/server/codegen_type_gen.go @@ -63,6 +63,9 @@ type InPathNodeId = string // InPathRsetId defines model for inPathRsetId. type InPathRsetId = string +// InQueryGroupby defines model for inQueryGroupby. +type InQueryGroupby = string + // InQueryLimit defines model for inQueryLimit. type InQueryLimit = int @@ -72,6 +75,9 @@ type InQueryMeta = string // InQueryOffset defines model for inQueryOffset. type InQueryOffset = int +// InQueryOrderby defines model for inQueryOrderby. +type InQueryOrderby = string + // InQueryProps defines model for inQueryProps. type InQueryProps = string @@ -96,12 +102,274 @@ type N409 = Problem // N500 defines model for 500. type N500 = Problem +// GetAppsParams defines parameters for GetApps. +type GetAppsParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + +// PostAppsJSONBody defines parameters for PostApps. +type PostAppsJSONBody struct { + App string `json:"app"` + AppDomain *string `json:"app_domain,omitempty"` + AppTeamOps *string `json:"app_team_ops,omitempty"` + Description *string `json:"description,omitempty"` +} + +// GetAppParams defines parameters for GetApp. +type GetAppParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` +} + +// PostAppJSONBody defines parameters for PostApp. +type PostAppJSONBody struct { + App *string `json:"app,omitempty"` + AppDomain *string `json:"app_domain,omitempty"` + AppTeamOps *string `json:"app_team_ops,omitempty"` + Description *string `json:"description,omitempty"` +} + +// GetAppPublicationsParams defines parameters for GetAppPublications. +type GetAppPublicationsParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + +// GetAppResponsiblesParams defines parameters for GetAppResponsibles. +type GetAppResponsiblesParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + +// GetArraysParams defines parameters for GetArrays. +type GetArraysParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + // PostAuthNodeJSONBody defines parameters for PostAuthNode. type PostAuthNodeJSONBody struct { App *string `json:"app,omitempty"` Nodename string `json:"nodename"` } +// GetDisksParams defines parameters for GetDisks. +type GetDisksParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + +// GetDiskParams defines parameters for GetDisk. +type GetDiskParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + +// GetNodesParams defines parameters for GetNodes. +type GetNodesParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + +// GetNodesHbasParams defines parameters for GetNodesHbas. +type GetNodesHbasParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + +// GetNodeParams defines parameters for GetNode. +type GetNodeParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + +// GetNodeCandidateTagsParams defines parameters for GetNodeCandidateTags. +type GetNodeCandidateTagsParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + // GetNodeComplianceCandidateModulesetsParams defines parameters for GetNodeComplianceCandidateModulesets. type GetNodeComplianceCandidateModulesetsParams struct { // Props A list of properties to include in each data dictionnary. @@ -118,6 +386,12 @@ type GetNodeComplianceCandidateModulesetsParams struct { // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` } // GetNodeComplianceCandidateRulesetsParams defines parameters for GetNodeComplianceCandidateRulesets. @@ -136,6 +410,12 @@ type GetNodeComplianceCandidateRulesetsParams struct { // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` } // GetNodeComplianceLogsParams defines parameters for GetNodeComplianceLogs. @@ -160,6 +440,12 @@ type GetNodeComplianceModulesetsParams struct { // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` } // PostNodeComplianceModulesetJSONBody defines parameters for PostNodeComplianceModuleset. @@ -181,11 +467,281 @@ type GetNodeComplianceRulesetsParams struct { // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` } // PostNodeComplianceRulesetJSONBody defines parameters for PostNodeComplianceRuleset. type PostNodeComplianceRulesetJSONBody = map[string]interface{} +// GetNodeDisksParams defines parameters for GetNodeDisks. +type GetNodeDisksParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + +// GetNodeHbasParams defines parameters for GetNodeHbas. +type GetNodeHbasParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + +// GetNodeInterfacesParams defines parameters for GetNodeInterfaces. +type GetNodeInterfacesParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + +// GetNodeTagsParams defines parameters for GetNodeTags. +type GetNodeTagsParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + +// GetServicesParams defines parameters for GetServices. +type GetServicesParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + +// GetServiceParams defines parameters for GetService. +type GetServiceParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + +// GetServiceCandidateTagsParams defines parameters for GetServiceCandidateTags. +type GetServiceCandidateTagsParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + +// GetServiceTagsParams defines parameters for GetServiceTags. +type GetServiceTagsParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + +// GetServicesInstancesParams defines parameters for GetServicesInstances. +type GetServicesInstancesParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + +// GetServicesInstanceParams defines parameters for GetServicesInstance. +type GetServicesInstanceParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + +// GetServicesInstancesStatusLogParams defines parameters for GetServicesInstancesStatusLog. +type GetServicesInstancesStatusLogParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + // GetTagsParams defines parameters for GetTags. type GetTagsParams struct { // Props A list of properties to include in each data dictionnary. @@ -202,6 +758,60 @@ type GetTagsParams struct { // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + +// GetTagsNodesParams defines parameters for GetTagsNodes. +type GetTagsNodesParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + +// GetTagsServicesParams defines parameters for GetTagsServices. +type GetTagsServicesParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` } // GetTagParams defines parameters for GetTag. @@ -222,6 +832,36 @@ type GetTagNodesParams struct { Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` } +// GetTagServicesParams defines parameters for GetTagServices. +type GetTagServicesParams struct { + // Props A list of properties to include in each data dictionnary. + Props *InQueryProps `form:"props,omitempty" json:"props,omitempty"` + + // Limit The maximum number of entries to return. 0 means no limit. + Limit *InQueryLimit `form:"limit,omitempty" json:"limit,omitempty"` + + // Offset Skip the first entries of the data cursor. + Offset *InQueryOffset `form:"offset,omitempty" json:"offset,omitempty"` + + // Meta Include metadata in the response. Enabled by default. Use false or 0 to omit the meta field. + Meta *InQueryMeta `form:"meta,omitempty" json:"meta,omitempty"` + + // Stats Controls the inclusion in the returned dictionnary of a "stats" key, containing the selected properties distinct values counts. + Stats *InQueryStats `form:"stats,omitempty" json:"stats,omitempty"` + + // Orderby Comma-separated list of properties to sort by. Prefix a property with - for descending order (e.g. orderby=nodename,-app). + Orderby *InQueryOrderby `form:"orderby,omitempty" json:"orderby,omitempty"` + + // Groupby Comma-separated list of properties to group the result by (e.g. groupby=app,svcname). + Groupby *InQueryGroupby `form:"groupby,omitempty" json:"groupby,omitempty"` +} + +// PostAppsJSONRequestBody defines body for PostApps for application/json ContentType. +type PostAppsJSONRequestBody PostAppsJSONBody + +// PostAppJSONRequestBody defines body for PostApp for application/json ContentType. +type PostAppJSONRequestBody PostAppJSONBody + // PostAuthNodeJSONRequestBody defines body for PostAuthNode for application/json ContentType. type PostAuthNodeJSONRequestBody PostAuthNodeJSONBody diff --git a/server/handlers/delete_apps.go b/server/handlers/delete_apps.go new file mode 100644 index 0000000..c7dd228 --- /dev/null +++ b/server/handlers/delete_apps.go @@ -0,0 +1,112 @@ +package serverhandlers + +import ( + "context" + "database/sql" + "net/http" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/util/echolog" + "github.com/opensvc/oc3/util/logkey" +) + +// DeleteApps handles DELETE /apps/{app_id} +func (a *Api) DeleteApps(c echo.Context, appId string) error { + log := echolog.GetLogHandler(c, "DeleteApps") + ctx, cancel := context.WithTimeout(c.Request().Context(), a.SyncTimeout) + defer cancel() + + if !IsAuthByUser(c) { + return JSONProblemf(c, http.StatusUnauthorized, "user authentication required") + } + + if !IsManager(c) { + return JSONProblemf(c, http.StatusForbidden, "AppManager privilege required") + } + + odb := cdb.New(a.DB) + odb.CreateSession(a.Ev) + + log.Info("called", "app_id", appId) + + isManager := IsManager(c) + + app, err := odb.GetApp(ctx, appId, nil, true) + if err != nil { + log.Error("cannot get app", "app_id", appId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot get app") + } + if app == nil { + return JSONProblemf(c, http.StatusNotFound, "app %s not found", appId) + } + + responsible, err := odb.AppResponsible(ctx, appId, UserGroupsFromContext(c), isManager, "") + if err != nil { + log.Error("cannot check app responsibility", "app_id", appId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot check app responsibility") + } + if !responsible { + return JSONProblemf(c, http.StatusForbidden, "you are not responsible for this app") + } + + nodesCount, servicesCount, err := odb.AppUsageCounts(ctx, app.App) + if err != nil { + log.Error("cannot count app usage", "app_id", appId, "app", app.App, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot count app usage") + } + if nodesCount+servicesCount > 0 { + return JSONProblemf(c, http.StatusConflict, "this app code cannot be deleted. used by %d nodes and %d services", nodesCount, servicesCount) + } + + markSuccess, endTx, err := odb.BeginTxWithControl(ctx, log, &sql.TxOptions{}) + if err != nil { + log.Error("cannot start transaction", logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot delete app") + } + defer endTx() + + if err := odb.DeleteApp(ctx, app.ID); err != nil { + log.Error("cannot delete app", "app_id", appId, "app", app.App, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot delete app") + } + if err := odb.DeleteAppResponsibles(ctx, app.ID); err != nil { + log.Error("cannot delete app responsibles", "app_id", appId, "app", app.App, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot delete app responsibles") + } + if err := odb.DeleteAppPublications(ctx, app.ID); err != nil { + log.Error("cannot delete app publications", "app_id", appId, "app", app.App, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot delete app publications") + } + + userEmail, _ := c.Get(XUserEmail).(string) + if err := odb.Log(ctx, cdb.LogEntry{ + Action: "apps.delete", + User: userEmail, + Fmt: "app %(app)s deleted", + Dict: map[string]any{ + "app": app.App, + }, + Level: "info", + }); err != nil { + log.Error("cannot write audit log", logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot write audit log") + } + + markSuccess() + + if err := odb.Session.NotifyTableChangeWithData(ctx, "apps", map[string]any{"id": app.ID}); err != nil { + log.Error("cannot notify apps change", logkey.Error, err) + } + if err := odb.Session.NotifyTableChangeWithData(ctx, "apps_responsibles", nil); err != nil { + log.Error("cannot notify apps_responsibles change", logkey.Error, err) + } + if err := odb.Session.NotifyTableChangeWithData(ctx, "apps_publications", nil); err != nil { + log.Error("cannot notify apps_publications change", logkey.Error, err) + } + + return c.JSON(http.StatusOK, map[string]string{ + "info": "app " + app.App + " deleted", + }) +} diff --git a/server/handlers/get_app.go b/server/handlers/get_app.go new file mode 100644 index 0000000..e3891ec --- /dev/null +++ b/server/handlers/get_app.go @@ -0,0 +1,44 @@ +package serverhandlers + +import ( + "net/http" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/server" + "github.com/opensvc/oc3/util/echolog" + "github.com/opensvc/oc3/util/logkey" +) + +// GetApp handles GET /apps/{app_id} +func (a *Api) GetApp(c echo.Context, appId string, params server.GetAppParams) error { + props, err := buildProps(params.Props, propsMapping["app"]) + if err != nil { + return JSONProblem(c, http.StatusBadRequest, err.Error()) + } + + log := echolog.GetLogHandler(c, "GetApp") + odb := a.getODB() + ctx := c.Request().Context() + groups := UserGroupsFromContext(c) + isManager := IsManager(c) + + log.Info("called", "app_id", appId, "props", props, "is_manager", isManager) + + app, err := odb.GetApp(ctx, appId, groups, isManager) + if err != nil { + log.Error("cannot get app", "app_id", appId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot get app") + } + if app == nil { + return JSONProblemf(c, http.StatusNotFound, "app %s not found", appId) + } + + filteredItem, err := filterItemFields(app, props) + if err != nil { + log.Error("cannot project app props", "app_id", appId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot project app props") + } + + return c.JSON(http.StatusOK, filteredItem) +} diff --git a/server/handlers/get_app_am_i_responsible.go b/server/handlers/get_app_am_i_responsible.go new file mode 100644 index 0000000..1e9f03d --- /dev/null +++ b/server/handlers/get_app_am_i_responsible.go @@ -0,0 +1,45 @@ +package serverhandlers + +import ( + "context" + "net/http" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/util/echolog" + "github.com/opensvc/oc3/util/logkey" +) + +// GetAppAmIResponsible handles GET /apps/{app_id}/am_i_responsible +func (a *Api) GetAppAmIResponsible(c echo.Context, appId string) error { + log := echolog.GetLogHandler(c, "GetAppAmIResponsible") + odb := a.getODB() + ctx, cancel := context.WithTimeout(c.Request().Context(), a.SyncTimeout) + defer cancel() + + groups := UserGroupsFromContext(c) + isManager := IsManager(c) + nodeID, _ := c.Get(XNodeID).(string) + + log.Info("called", "app_id", appId, "is_manager", isManager) + + app, err := odb.GetApp(ctx, appId, nil, true) + if err != nil { + log.Error("cannot resolve app", "app_id", appId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot resolve app %s", appId) + } + if app == nil { + return JSONProblemf(c, http.StatusNotFound, "app %s not found", appId) + } + + responsible, err := odb.AppResponsible(ctx, appId, groups, isManager, nodeID) + if err != nil { + log.Error("cannot check app responsibility", "app_id", appId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot check responsibility for app %s", appId) + } + if !responsible { + return JSONProblemf(c, http.StatusForbidden, "you are not responsible for app %s", appId) + } + + return c.JSON(http.StatusOK, true) +} diff --git a/server/handlers/get_app_publications.go b/server/handlers/get_app_publications.go new file mode 100644 index 0000000..7d79a31 --- /dev/null +++ b/server/handlers/get_app_publications.go @@ -0,0 +1,50 @@ +package serverhandlers + +import ( + "net/http" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/server" + "github.com/opensvc/oc3/util/echolog" + "github.com/opensvc/oc3/util/logkey" +) + +// GetAppPublications handles GET /apps/{app_id}/publications +func (a *Api) GetAppPublications(c echo.Context, appId string, params server.GetAppPublicationsParams) error { + query, err := buildListQueryParameters(params.Props, params.Limit, params.Offset, params.Meta, params.Stats, params.Orderby, params.Groupby, propsMapping["auth_group"]) + if err != nil { + return JSONProblem(c, http.StatusBadRequest, err.Error()) + } + + log := echolog.GetLogHandler(c, "GetAppPublications") + odb := a.getODB() + ctx := c.Request().Context() + groups := UserGroupsFromContext(c) + isManager := IsManager(c) + + log.Info("called", "app_id", appId, "limit", query.Page.Limit, "offset", query.Page.Offset, "props", query.Props, "is_manager", isManager) + + app, err := odb.GetApp(ctx, appId, nil, true) + if err != nil { + log.Error("cannot resolve app", "app_id", appId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot resolve app %s", appId) + } + if app == nil { + return JSONProblemf(c, http.StatusNotFound, "app %s not found", appId) + } + + items, err := odb.GetAppPublications(ctx, appId, groups, isManager, query.Page.Limit, query.Page.Offset) + if err != nil { + log.Error("cannot get app publications", "app_id", appId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot get publications for app %s", appId) + } + + filteredItems, err := filterItemsFields(items, query.Props) + if err != nil { + log.Error("cannot project group props", "app_id", appId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot project group props") + } + + return c.JSON(http.StatusOK, newListResponse(filteredItems, propsMapping["auth_group"], query)) +} diff --git a/server/handlers/get_app_responsibles.go b/server/handlers/get_app_responsibles.go new file mode 100644 index 0000000..a14d1ac --- /dev/null +++ b/server/handlers/get_app_responsibles.go @@ -0,0 +1,50 @@ +package serverhandlers + +import ( + "net/http" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/server" + "github.com/opensvc/oc3/util/echolog" + "github.com/opensvc/oc3/util/logkey" +) + +// GetAppResponsibles handles GET /apps/{app_id}/responsibles +func (a *Api) GetAppResponsibles(c echo.Context, appId string, params server.GetAppResponsiblesParams) error { + query, err := buildListQueryParameters(params.Props, params.Limit, params.Offset, params.Meta, params.Stats, params.Orderby, params.Groupby, propsMapping["auth_group"]) + if err != nil { + return JSONProblem(c, http.StatusBadRequest, err.Error()) + } + + log := echolog.GetLogHandler(c, "GetAppResponsibles") + odb := a.getODB() + ctx := c.Request().Context() + groups := UserGroupsFromContext(c) + isManager := IsManager(c) + + log.Info("called", "app_id", appId, "limit", query.Page.Limit, "offset", query.Page.Offset, "props", query.Props, "is_manager", isManager) + + app, err := odb.GetApp(ctx, appId, nil, true) + if err != nil { + log.Error("cannot resolve app", "app_id", appId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot resolve app %s", appId) + } + if app == nil { + return JSONProblemf(c, http.StatusNotFound, "app %s not found", appId) + } + + items, err := odb.GetAppResponsibles(ctx, appId, groups, isManager, query.Page.Limit, query.Page.Offset) + if err != nil { + log.Error("cannot get app responsibles", "app_id", appId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot get responsibles for app %s", appId) + } + + filteredItems, err := filterItemsFields(items, query.Props) + if err != nil { + log.Error("cannot project group props", "app_id", appId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot project group props") + } + + return c.JSON(http.StatusOK, newListResponse(filteredItems, propsMapping["auth_group"], query)) +} diff --git a/server/handlers/get_apps.go b/server/handlers/get_apps.go new file mode 100644 index 0000000..13c12db --- /dev/null +++ b/server/handlers/get_apps.go @@ -0,0 +1,21 @@ +package serverhandlers + +import ( + "context" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" +) + +// GetApps handles GET /apps +func (a *Api) GetApps(c echo.Context, params server.GetAppsParams) error { + odb := a.getODB() + return a.handleList(c, "GetApps", "app", listEndpointParams{ + props: params.Props, limit: params.Limit, offset: params.Offset, + meta: params.Meta, stats: params.Stats, orderby: params.Orderby, groupby: params.Groupby, + }, func(ctx context.Context, p cdb.ListParams) ([]map[string]any, error) { + return odb.GetApps(ctx, p) + }) +} diff --git a/server/handlers/get_arrays.go b/server/handlers/get_arrays.go new file mode 100644 index 0000000..cc88a4f --- /dev/null +++ b/server/handlers/get_arrays.go @@ -0,0 +1,21 @@ +package serverhandlers + +import ( + "context" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" +) + +// GetArrays handles GET /arrays +func (a *Api) GetArrays(c echo.Context, params server.GetArraysParams) error { + odb := a.getODB() + return a.handleList(c, "GetArrays", "array", listEndpointParams{ + props: params.Props, limit: params.Limit, offset: params.Offset, + meta: params.Meta, stats: params.Stats, orderby: params.Orderby, groupby: params.Groupby, + }, func(ctx context.Context, p cdb.ListParams) ([]map[string]any, error) { + return odb.GetArrays(ctx, p) + }) +} diff --git a/server/handlers/get_disk.go b/server/handlers/get_disk.go new file mode 100644 index 0000000..6a8ec94 --- /dev/null +++ b/server/handlers/get_disk.go @@ -0,0 +1,52 @@ +package serverhandlers + +import ( + "net/http" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" + "github.com/opensvc/oc3/util/echolog" + "github.com/opensvc/oc3/util/logkey" +) + +// GetDisk handles GET /disks/{disk_id} +func (a *Api) GetDisk(c echo.Context, diskId string, params server.GetDiskParams) error { + query, err := buildListQueryParameters(params.Props, params.Limit, params.Offset, params.Meta, params.Stats, params.Orderby, params.Groupby, propsMapping["disk"]) + if err != nil { + return JSONProblem(c, http.StatusBadRequest, err.Error()) + } + + log := echolog.GetLogHandler(c, "GetDisk") + odb := a.getODB() + ctx := c.Request().Context() + groups := UserGroupsFromContext(c) + isManager := IsManager(c) + + log.Info("called", "disk_id", diskId, "props", query.Props, "is_manager", isManager) + + selectExprs, err := buildSelectClause(query.Props, propsMapping["disk"]) + if err != nil { + log.Error("cannot build select clause", logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot build select clause") + } + + disks, err := odb.GetDisk(ctx, diskId, cdb.ListParams{ + Groups: groups, + IsManager: isManager, + Limit: query.Page.Limit, + Offset: query.Page.Offset, + Props: query.Props, + SelectExprs: selectExprs, + }) + if err != nil { + log.Error("cannot get disk", "disk_id", diskId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot get disk") + } + if len(disks) == 0 { + return JSONProblemf(c, http.StatusNotFound, "disk %s not found", diskId) + } + + return c.JSON(http.StatusOK, newListResponse(disks, propsMapping["disk"], query)) +} diff --git a/server/handlers/get_disks.go b/server/handlers/get_disks.go new file mode 100644 index 0000000..017c52a --- /dev/null +++ b/server/handlers/get_disks.go @@ -0,0 +1,21 @@ +package serverhandlers + +import ( + "context" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" +) + +// GetDisks handles GET /disks +func (a *Api) GetDisks(c echo.Context, params server.GetDisksParams) error { + odb := a.getODB() + return a.handleList(c, "GetDisks", "disk", listEndpointParams{ + props: params.Props, limit: params.Limit, offset: params.Offset, + meta: params.Meta, stats: params.Stats, orderby: params.Orderby, groupby: params.Groupby, + }, func(ctx context.Context, p cdb.ListParams) ([]map[string]any, error) { + return odb.GetDisks(ctx, p) + }) +} diff --git a/server/handlers/get_node.go b/server/handlers/get_node.go new file mode 100644 index 0000000..b753a02 --- /dev/null +++ b/server/handlers/get_node.go @@ -0,0 +1,52 @@ +package serverhandlers + +import ( + "net/http" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" + "github.com/opensvc/oc3/util/echolog" + "github.com/opensvc/oc3/util/logkey" +) + +// GetNode handles GET /nodes/{node_id} +func (a *Api) GetNode(c echo.Context, nodeId string, params server.GetNodeParams) error { + query, err := buildListQueryParameters(params.Props, params.Limit, params.Offset, params.Meta, params.Stats, params.Orderby, params.Groupby, propsMapping["node"]) + if err != nil { + return JSONProblem(c, http.StatusBadRequest, err.Error()) + } + + log := echolog.GetLogHandler(c, "GetNode") + odb := a.getODB() + ctx := c.Request().Context() + groups := UserGroupsFromContext(c) + isManager := IsManager(c) + + log.Info("called", "node_id", nodeId, "props", query.Props, "is_manager", isManager) + + selectExprs, err := buildSelectClause(query.Props, propsMapping["node"]) + if err != nil { + log.Error("cannot build select clause", logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot build select clause") + } + + nodes, err := odb.GetNode(ctx, nodeId, cdb.ListParams{ + Groups: groups, + IsManager: isManager, + Limit: query.Page.Limit, + Offset: query.Page.Offset, + Props: query.Props, + SelectExprs: selectExprs, + }) + if err != nil { + log.Error("cannot get node", "node_id", nodeId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot get node") + } + if len(nodes) == 0 { + return JSONProblemf(c, http.StatusNotFound, "node %s not found", nodeId) + } + + return c.JSON(http.StatusOK, newListResponse(nodes, propsMapping["node"], query)) +} diff --git a/server/handlers/get_node_candidate_tags.go b/server/handlers/get_node_candidate_tags.go new file mode 100644 index 0000000..17e6042 --- /dev/null +++ b/server/handlers/get_node_candidate_tags.go @@ -0,0 +1,36 @@ +package serverhandlers + +import ( + "context" + "net/http" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" + "github.com/opensvc/oc3/util/echolog" + "github.com/opensvc/oc3/util/logkey" +) + +// GetNodeCandidateTags handles GET /nodes/{node_id}/candidate_tags +func (a *Api) GetNodeCandidateTags(c echo.Context, nodeId string, params server.GetNodeCandidateTagsParams) error { + log := echolog.GetLogHandler(c, "GetNodeCandidateTags") + odb := a.getODB() + ctx := c.Request().Context() + + node, err := odb.NodeByNodeIDOrNodename(ctx, nodeId) + if err != nil { + log.Error("cannot resolve node", logkey.NodeID, nodeId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot resolve node") + } + if node == nil { + return JSONProblemf(c, http.StatusNotFound, "node %s not found", nodeId) + } + + return a.handleList(c, "GetNodeCandidateTags", "tag", listEndpointParams{ + props: params.Props, limit: params.Limit, offset: params.Offset, + meta: params.Meta, stats: params.Stats, orderby: params.Orderby, groupby: params.Groupby, + }, func(ctx context.Context, p cdb.ListParams) ([]map[string]any, error) { + return odb.GetNodeCandidateTags(ctx, node.NodeID, p) + }) +} diff --git a/server/handlers/get_node_compliance_candidate_modulesets.go b/server/handlers/get_node_compliance_candidate_modulesets.go index 364e42f..7cdefce 100644 --- a/server/handlers/get_node_compliance_candidate_modulesets.go +++ b/server/handlers/get_node_compliance_candidate_modulesets.go @@ -12,7 +12,7 @@ import ( // GetNodeComplianceCandidateModulesets handles GET /nodes/{node_id}/compliance/candidate_modulesets func (a *Api) GetNodeComplianceCandidateModulesets(c echo.Context, nodeId string, params server.GetNodeComplianceCandidateModulesetsParams) error { - query, err := buildListQueryParameters(params.Props, params.Limit, params.Offset, params.Meta, params.Stats, propsMapping["moduleset"]) + query, err := buildListQueryParameters(params.Props, params.Limit, params.Offset, params.Meta, params.Stats, params.Orderby, params.Groupby, propsMapping["moduleset"]) if err != nil { return JSONProblem(c, http.StatusBadRequest, err.Error()) } diff --git a/server/handlers/get_node_compliance_candidate_rulesets.go b/server/handlers/get_node_compliance_candidate_rulesets.go index faaaf45..29671e7 100644 --- a/server/handlers/get_node_compliance_candidate_rulesets.go +++ b/server/handlers/get_node_compliance_candidate_rulesets.go @@ -12,7 +12,7 @@ import ( // GetNodeComplianceCandidateRulesets handles GET /nodes/{node_id}/compliance/candidate_rulesets func (a *Api) GetNodeComplianceCandidateRulesets(c echo.Context, nodeId string, params server.GetNodeComplianceCandidateRulesetsParams) error { - query, err := buildListQueryParameters(params.Props, params.Limit, params.Offset, params.Meta, params.Stats, propsMapping["ruleset"]) + query, err := buildListQueryParameters(params.Props, params.Limit, params.Offset, params.Meta, params.Stats, params.Orderby, params.Groupby, propsMapping["ruleset"]) if err != nil { return JSONProblem(c, http.StatusBadRequest, err.Error()) } diff --git a/server/handlers/get_node_compliance_modulesets.go b/server/handlers/get_node_compliance_modulesets.go index 3c06f25..5b86192 100644 --- a/server/handlers/get_node_compliance_modulesets.go +++ b/server/handlers/get_node_compliance_modulesets.go @@ -12,7 +12,7 @@ import ( // GetNodeComplianceModulesets handles GET /nodes/{node_id}/compliance/modulesets func (a *Api) GetNodeComplianceModulesets(c echo.Context, nodeId string, params server.GetNodeComplianceModulesetsParams) error { - query, err := buildListQueryParameters(params.Props, params.Limit, params.Offset, params.Meta, params.Stats, propsMapping["moduleset"]) + query, err := buildListQueryParameters(params.Props, params.Limit, params.Offset, params.Meta, params.Stats, params.Orderby, params.Groupby, propsMapping["moduleset"]) if err != nil { return JSONProblem(c, http.StatusBadRequest, err.Error()) } diff --git a/server/handlers/get_node_compliance_rulesets.go b/server/handlers/get_node_compliance_rulesets.go index ce0e766..9677868 100644 --- a/server/handlers/get_node_compliance_rulesets.go +++ b/server/handlers/get_node_compliance_rulesets.go @@ -12,7 +12,7 @@ import ( // GetNodeComplianceRulesets handles GET /nodes/{node_id}/compliance/rulesets func (a *Api) GetNodeComplianceRulesets(c echo.Context, nodeId string, params server.GetNodeComplianceRulesetsParams) error { - query, err := buildListQueryParameters(params.Props, params.Limit, params.Offset, params.Meta, params.Stats, propsMapping["ruleset"]) + query, err := buildListQueryParameters(params.Props, params.Limit, params.Offset, params.Meta, params.Stats, params.Orderby, params.Groupby, propsMapping["ruleset"]) if err != nil { return JSONProblem(c, http.StatusBadRequest, err.Error()) } diff --git a/server/handlers/get_node_disks.go b/server/handlers/get_node_disks.go new file mode 100644 index 0000000..3c798bb --- /dev/null +++ b/server/handlers/get_node_disks.go @@ -0,0 +1,36 @@ +package serverhandlers + +import ( + "context" + "net/http" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" + "github.com/opensvc/oc3/util/echolog" + "github.com/opensvc/oc3/util/logkey" +) + +// GetNodeDisks handles GET /nodes/{node_id}/disks +func (a *Api) GetNodeDisks(c echo.Context, nodeId string, params server.GetNodeDisksParams) error { + log := echolog.GetLogHandler(c, "GetNodeDisks") + odb := a.getODB() + ctx := c.Request().Context() + + node, err := odb.NodeByNodeIDOrNodename(ctx, nodeId) + if err != nil { + log.Error("cannot resolve node", "node_id", nodeId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot resolve node") + } + if node == nil { + return JSONProblemf(c, http.StatusNotFound, "node %s not found", nodeId) + } + + return a.handleList(c, "GetNodeDisks", "disk", listEndpointParams{ + props: params.Props, limit: params.Limit, offset: params.Offset, + meta: params.Meta, stats: params.Stats, orderby: params.Orderby, groupby: params.Groupby, + }, func(ctx context.Context, p cdb.ListParams) ([]map[string]any, error) { + return odb.GetNodeDisks(ctx, node.NodeID, p) + }) +} diff --git a/server/handlers/get_node_hbas.go b/server/handlers/get_node_hbas.go new file mode 100644 index 0000000..9908b27 --- /dev/null +++ b/server/handlers/get_node_hbas.go @@ -0,0 +1,36 @@ +package serverhandlers + +import ( + "context" + "net/http" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" + "github.com/opensvc/oc3/util/echolog" + "github.com/opensvc/oc3/util/logkey" +) + +// GetNodeHbas handles GET /nodes/{node_id}/hbas +func (a *Api) GetNodeHbas(c echo.Context, nodeId string, params server.GetNodeHbasParams) error { + log := echolog.GetLogHandler(c, "GetNodeHbas") + odb := a.getODB() + ctx := c.Request().Context() + + node, err := odb.NodeByNodeIDOrNodename(ctx, nodeId) + if err != nil { + log.Error("cannot resolve node", "node_id", nodeId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot resolve node") + } + if node == nil { + return JSONProblemf(c, http.StatusNotFound, "node %s not found", nodeId) + } + + return a.handleList(c, "GetNodeHbas", "hba", listEndpointParams{ + props: params.Props, limit: params.Limit, offset: params.Offset, + meta: params.Meta, stats: params.Stats, orderby: params.Orderby, groupby: params.Groupby, + }, func(ctx context.Context, p cdb.ListParams) ([]map[string]any, error) { + return odb.GetNodeHbas(ctx, node.NodeID, p) + }) +} diff --git a/server/handlers/get_node_interfaces.go b/server/handlers/get_node_interfaces.go new file mode 100644 index 0000000..b979ecd --- /dev/null +++ b/server/handlers/get_node_interfaces.go @@ -0,0 +1,36 @@ +package serverhandlers + +import ( + "context" + "net/http" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" + "github.com/opensvc/oc3/util/echolog" + "github.com/opensvc/oc3/util/logkey" +) + +// GetNodeInterfaces handles GET /nodes/{node_id}/interfaces +func (a *Api) GetNodeInterfaces(c echo.Context, nodeId string, params server.GetNodeInterfacesParams) error { + log := echolog.GetLogHandler(c, "GetNodeInterfaces") + odb := a.getODB() + ctx := c.Request().Context() + + node, err := odb.NodeByNodeIDOrNodename(ctx, nodeId) + if err != nil { + log.Error("cannot resolve node", "node_id", nodeId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot resolve node") + } + if node == nil { + return JSONProblemf(c, http.StatusNotFound, "node %s not found", nodeId) + } + + return a.handleList(c, "GetNodeInterfaces", "node_interface", listEndpointParams{ + props: params.Props, limit: params.Limit, offset: params.Offset, + meta: params.Meta, stats: params.Stats, orderby: params.Orderby, groupby: params.Groupby, + }, func(ctx context.Context, p cdb.ListParams) ([]map[string]any, error) { + return odb.GetNodeInterfaces(ctx, node.NodeID, p) + }) +} diff --git a/server/handlers/get_node_tags.go b/server/handlers/get_node_tags.go new file mode 100644 index 0000000..28fcb56 --- /dev/null +++ b/server/handlers/get_node_tags.go @@ -0,0 +1,36 @@ +package serverhandlers + +import ( + "context" + "net/http" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" + "github.com/opensvc/oc3/util/echolog" + "github.com/opensvc/oc3/util/logkey" +) + +// GetNodeTags handles GET /nodes/{node_id}/tags +func (a *Api) GetNodeTags(c echo.Context, nodeId string, params server.GetNodeTagsParams) error { + log := echolog.GetLogHandler(c, "GetNodeTags") + odb := a.getODB() + ctx := c.Request().Context() + + node, err := odb.NodeByNodeIDOrNodename(ctx, nodeId) + if err != nil { + log.Error("cannot resolve node", logkey.NodeID, nodeId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot resolve node") + } + if node == nil { + return JSONProblemf(c, http.StatusNotFound, "node %s not found", nodeId) + } + + return a.handleList(c, "GetNodeTags", "tag", listEndpointParams{ + props: params.Props, limit: params.Limit, offset: params.Offset, + meta: params.Meta, stats: params.Stats, orderby: params.Orderby, groupby: params.Groupby, + }, func(ctx context.Context, p cdb.ListParams) ([]map[string]any, error) { + return odb.GetNodeTags(ctx, node.NodeID, p) + }) +} diff --git a/server/handlers/get_node_uuid.go b/server/handlers/get_node_uuid.go new file mode 100644 index 0000000..215c46b --- /dev/null +++ b/server/handlers/get_node_uuid.go @@ -0,0 +1,65 @@ +package serverhandlers + +import ( + "net/http" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/util/echolog" + "github.com/opensvc/oc3/util/logkey" +) + +// GetNodeUUID handles GET /nodes/{node_id}/uuid +func (a *Api) GetNodeUUID(c echo.Context, nodeId string) error { + log := echolog.GetLogHandler(c, "GetNodeUUID") + odb := a.getODB() + ctx := c.Request().Context() + groups := UserGroupsFromContext(c) + isManager := IsManager(c) + + log.Info("called", "node_id", nodeId) + + if !IsAuthByUser(c) { + return JSONProblemf(c, http.StatusUnauthorized, "user authentication required") + } + + node, err := odb.NodeByNodeIDOrNodename(ctx, nodeId) + if err != nil { + log.Error("cannot resolve node", "node_id", nodeId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot resolve node") + } + if node == nil { + return JSONProblemf(c, http.StatusNotFound, "node %s not found", nodeId) + } + + responsible, err := odb.NodeResponsible(ctx, node.NodeID, groups, isManager) + if err != nil { + log.Error("cannot check node responsibility", "node_id", nodeId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot check node responsibility") + } + if !responsible { + return JSONProblemf(c, http.StatusForbidden, "you are not responsible for this node") + } + + authNodes, err := odb.AuthNodesByNodeID(ctx, node.NodeID) + if err != nil { + log.Error("cannot get auth node", "node_id", node.NodeID, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot get node uuid") + } + if len(authNodes) == 0 { + return JSONProblemf(c, http.StatusNotFound, "no uuid found for node %s", nodeId) + } + + an := authNodes[0] + return c.JSON(http.StatusOK, map[string]any{ + "data": []map[string]any{ + { + "id": an.ID, + "nodename": an.Nodename, + "uuid": an.UUID, + "node_id": an.NodeID, + "updated": an.Updated, + }, + }, + }) +} diff --git a/server/handlers/get_nodes.go b/server/handlers/get_nodes.go new file mode 100644 index 0000000..cb4ca22 --- /dev/null +++ b/server/handlers/get_nodes.go @@ -0,0 +1,21 @@ +package serverhandlers + +import ( + "context" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" +) + +// GetNodes handles GET /nodes +func (a *Api) GetNodes(c echo.Context, params server.GetNodesParams) error { + odb := a.getODB() + return a.handleList(c, "GetNodes", "node", listEndpointParams{ + props: params.Props, limit: params.Limit, offset: params.Offset, + meta: params.Meta, stats: params.Stats, orderby: params.Orderby, groupby: params.Groupby, + }, func(ctx context.Context, p cdb.ListParams) ([]map[string]any, error) { + return odb.GetNodes(ctx, p) + }) +} diff --git a/server/handlers/get_nodes_hbas.go b/server/handlers/get_nodes_hbas.go new file mode 100644 index 0000000..c40af5d --- /dev/null +++ b/server/handlers/get_nodes_hbas.go @@ -0,0 +1,21 @@ +package serverhandlers + +import ( + "context" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" +) + +// GetNodesHbas handles GET /nodes/hbas +func (a *Api) GetNodesHbas(c echo.Context, params server.GetNodesHbasParams) error { + odb := a.getODB() + return a.handleList(c, "GetNodesHbas", "hba", listEndpointParams{ + props: params.Props, limit: params.Limit, offset: params.Offset, + meta: params.Meta, stats: params.Stats, orderby: params.Orderby, groupby: params.Groupby, + }, func(ctx context.Context, p cdb.ListParams) ([]map[string]any, error) { + return odb.GetHbas(ctx, p) + }) +} diff --git a/server/handlers/get_service.go b/server/handlers/get_service.go new file mode 100644 index 0000000..0b36f55 --- /dev/null +++ b/server/handlers/get_service.go @@ -0,0 +1,52 @@ +package serverhandlers + +import ( + "net/http" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" + "github.com/opensvc/oc3/util/echolog" + "github.com/opensvc/oc3/util/logkey" +) + +// GetService handles GET /services/{svc_id} +func (a *Api) GetService(c echo.Context, svcId string, params server.GetServiceParams) error { + query, err := buildListQueryParameters(params.Props, params.Limit, params.Offset, params.Meta, params.Stats, params.Orderby, params.Groupby, propsMapping["service"]) + if err != nil { + return JSONProblem(c, http.StatusBadRequest, err.Error()) + } + + log := echolog.GetLogHandler(c, "GetService") + odb := a.getODB() + ctx := c.Request().Context() + groups := UserGroupsFromContext(c) + isManager := IsManager(c) + + log.Info("called", "svc_id", svcId, "props", query.Props, "is_manager", isManager) + + selectExprs, err := buildSelectClause(query.Props, propsMapping["service"]) + if err != nil { + log.Error("cannot build select clause", logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot build select clause") + } + + services, err := odb.GetService(ctx, svcId, cdb.ListParams{ + Groups: groups, + IsManager: isManager, + Limit: query.Page.Limit, + Offset: query.Page.Offset, + Props: query.Props, + SelectExprs: selectExprs, + }) + if err != nil { + log.Error("cannot get service", "svc_id", svcId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot get service") + } + if len(services) == 0 { + return JSONProblemf(c, http.StatusNotFound, "service %s not found", svcId) + } + + return c.JSON(http.StatusOK, newListResponse(services, propsMapping["service"], query)) +} diff --git a/server/handlers/get_service_candidate_tags.go b/server/handlers/get_service_candidate_tags.go new file mode 100644 index 0000000..efdc19d --- /dev/null +++ b/server/handlers/get_service_candidate_tags.go @@ -0,0 +1,41 @@ +package serverhandlers + +import ( + "context" + "net/http" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" + "github.com/opensvc/oc3/util/echolog" + "github.com/opensvc/oc3/util/logkey" +) + +// GetServiceCandidateTags handles GET /services/{svc_id}/candidate_tags +func (a *Api) GetServiceCandidateTags(c echo.Context, svcId string, params server.GetServiceCandidateTagsParams) error { + log := echolog.GetLogHandler(c, "GetServiceCandidateTags") + odb := a.getODB() + ctx := c.Request().Context() + + groups := UserGroupsFromContext(c) + isManager := IsManager(c) + log.Info("called", "svc_id", svcId, "is_manager", isManager) + + // Verify service exists and is accessible to this user + svcs, err := odb.GetService(ctx, svcId, cdb.ListParams{Limit: 1, Groups: groups, IsManager: isManager}) + if err != nil { + log.Error("cannot resolve service", "svc_id", svcId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot resolve service") + } + if len(svcs) == 0 { + return JSONProblemf(c, http.StatusNotFound, "service %s not found", svcId) + } + + return a.handleList(c, "GetServiceCandidateTags", "tag", listEndpointParams{ + props: params.Props, limit: params.Limit, offset: params.Offset, + meta: params.Meta, stats: params.Stats, orderby: params.Orderby, groupby: params.Groupby, + }, func(ctx context.Context, p cdb.ListParams) ([]map[string]any, error) { + return odb.GetServiceCandidateTags(ctx, svcId, p) + }) +} diff --git a/server/handlers/get_service_tags.go b/server/handlers/get_service_tags.go new file mode 100644 index 0000000..9332745 --- /dev/null +++ b/server/handlers/get_service_tags.go @@ -0,0 +1,41 @@ +package serverhandlers + +import ( + "context" + "net/http" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" + "github.com/opensvc/oc3/util/echolog" + "github.com/opensvc/oc3/util/logkey" +) + +// GetServiceTags handles GET /services/{svc_id}/tags +func (a *Api) GetServiceTags(c echo.Context, svcId string, params server.GetServiceTagsParams) error { + log := echolog.GetLogHandler(c, "GetServiceTags") + odb := a.getODB() + ctx := c.Request().Context() + + groups := UserGroupsFromContext(c) + isManager := IsManager(c) + log.Info("called", "svc_id", svcId, "is_manager", isManager) + + // Verify service exists and is accessible to this user + svcs, err := odb.GetService(ctx, svcId, cdb.ListParams{Limit: 1, Groups: groups, IsManager: isManager}) + if err != nil { + log.Error("cannot resolve service", "svc_id", svcId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot resolve service") + } + if len(svcs) == 0 { + return JSONProblemf(c, http.StatusNotFound, "service %s not found", svcId) + } + + return a.handleList(c, "GetServiceTags", "tag", listEndpointParams{ + props: params.Props, limit: params.Limit, offset: params.Offset, + meta: params.Meta, stats: params.Stats, orderby: params.Orderby, groupby: params.Groupby, + }, func(ctx context.Context, p cdb.ListParams) ([]map[string]any, error) { + return odb.GetServiceTags(ctx, svcId, p) + }) +} diff --git a/server/handlers/get_services.go b/server/handlers/get_services.go new file mode 100644 index 0000000..68e8086 --- /dev/null +++ b/server/handlers/get_services.go @@ -0,0 +1,21 @@ +package serverhandlers + +import ( + "context" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" +) + +// GetServices handles GET /services +func (a *Api) GetServices(c echo.Context, params server.GetServicesParams) error { + odb := a.getODB() + return a.handleList(c, "GetServices", "service", listEndpointParams{ + props: params.Props, limit: params.Limit, offset: params.Offset, + meta: params.Meta, stats: params.Stats, orderby: params.Orderby, groupby: params.Groupby, + }, func(ctx context.Context, p cdb.ListParams) ([]map[string]any, error) { + return odb.GetServices(ctx, p) + }) +} diff --git a/server/handlers/get_services_instance.go b/server/handlers/get_services_instance.go new file mode 100644 index 0000000..220c0cc --- /dev/null +++ b/server/handlers/get_services_instance.go @@ -0,0 +1,52 @@ +package serverhandlers + +import ( + "net/http" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" + "github.com/opensvc/oc3/util/echolog" + "github.com/opensvc/oc3/util/logkey" +) + +// GetServicesInstance handles GET /services_instances/{svc_id} +func (a *Api) GetServicesInstance(c echo.Context, svcId string, params server.GetServicesInstanceParams) error { + query, err := buildListQueryParameters(params.Props, params.Limit, params.Offset, params.Meta, params.Stats, params.Orderby, params.Groupby, propsMapping["instance"]) + if err != nil { + return JSONProblem(c, http.StatusBadRequest, err.Error()) + } + + log := echolog.GetLogHandler(c, "GetServicesInstance") + odb := a.getODB() + ctx := c.Request().Context() + groups := UserGroupsFromContext(c) + isManager := IsManager(c) + + log.Info("called", "svc_id", svcId, "props", query.Props, "is_manager", isManager) + + selectExprs, err := buildSelectClause(query.Props, propsMapping["instance"]) + if err != nil { + log.Error("cannot build select clause", logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot build select clause") + } + + instances, err := odb.GetServicesInstance(ctx, svcId, cdb.ListParams{ + Groups: groups, + IsManager: isManager, + Limit: query.Page.Limit, + Offset: query.Page.Offset, + Props: query.Props, + SelectExprs: selectExprs, + }) + if err != nil { + log.Error("cannot get service instances", "svc_id", svcId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot get service instances") + } + if len(instances) == 0 { + return JSONProblemf(c, http.StatusNotFound, "service %s not found or has no instances", svcId) + } + + return c.JSON(http.StatusOK, newListResponse(instances, propsMapping["instance"], query)) +} diff --git a/server/handlers/get_services_instances.go b/server/handlers/get_services_instances.go new file mode 100644 index 0000000..6b4a906 --- /dev/null +++ b/server/handlers/get_services_instances.go @@ -0,0 +1,21 @@ +package serverhandlers + +import ( + "context" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" +) + +// GetServicesInstances handles GET /services_instances +func (a *Api) GetServicesInstances(c echo.Context, params server.GetServicesInstancesParams) error { + odb := a.getODB() + return a.handleList(c, "GetServicesInstances", "instance", listEndpointParams{ + props: params.Props, limit: params.Limit, offset: params.Offset, + meta: params.Meta, stats: params.Stats, orderby: params.Orderby, groupby: params.Groupby, + }, func(ctx context.Context, p cdb.ListParams) ([]map[string]any, error) { + return odb.GetServicesInstances(ctx, p) + }) +} diff --git a/server/handlers/get_services_instances_status_log.go b/server/handlers/get_services_instances_status_log.go new file mode 100644 index 0000000..5c62c42 --- /dev/null +++ b/server/handlers/get_services_instances_status_log.go @@ -0,0 +1,21 @@ +package serverhandlers + +import ( + "context" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" +) + +// GetServicesInstancesStatusLog handles GET /services_instances_status_log +func (a *Api) GetServicesInstancesStatusLog(c echo.Context, params server.GetServicesInstancesStatusLogParams) error { + odb := a.getODB() + return a.handleList(c, "GetServicesInstancesStatusLog", "instance_status_log", listEndpointParams{ + props: params.Props, limit: params.Limit, offset: params.Offset, + meta: params.Meta, stats: params.Stats, orderby: params.Orderby, groupby: params.Groupby, + }, func(ctx context.Context, p cdb.ListParams) ([]map[string]any, error) { + return odb.GetServicesInstancesStatusLog(ctx, p) + }) +} diff --git a/server/handlers/get_tag_nodes.go b/server/handlers/get_tag_nodes.go index 3399f13..15f0573 100644 --- a/server/handlers/get_tag_nodes.go +++ b/server/handlers/get_tag_nodes.go @@ -1,8 +1,11 @@ package serverhandlers import ( + "context" + "github.com/labstack/echo/v4" + "github.com/opensvc/oc3/cdb" "github.com/opensvc/oc3/server" "github.com/opensvc/oc3/util/echolog" "github.com/opensvc/oc3/util/logkey" @@ -11,10 +14,12 @@ import ( // GetTagNodes handles GET /tags/{tag_id}/nodes func (a *Api) GetTagNodes(c echo.Context, tagIdParam int, params server.GetTagNodesParams) error { log := echolog.GetLogHandler(c, "GetTagNodes") + log.Info("called", logkey.TagID, tagIdParam) - log.Info("called", logkey.TagID, tagIdParam, "props", params.Props, "limit", params.Limit, "offset", params.Offset) - - // TODO - - return c.JSON(200, []interface{}{}) + odb := a.getODB() + return a.handleList(c, "GetTagNodes", "node", listEndpointParams{ + props: params.Props, limit: params.Limit, offset: params.Offset, + }, func(ctx context.Context, p cdb.ListParams) ([]map[string]any, error) { + return odb.GetTagNodes(ctx, tagIdParam, p) + }) } diff --git a/server/handlers/get_tag_services.go b/server/handlers/get_tag_services.go new file mode 100644 index 0000000..09ec049 --- /dev/null +++ b/server/handlers/get_tag_services.go @@ -0,0 +1,26 @@ +package serverhandlers + +import ( + "context" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" + "github.com/opensvc/oc3/util/echolog" + "github.com/opensvc/oc3/util/logkey" +) + +// GetTagServices handles GET /tags/{tag_id}/services +func (a *Api) GetTagServices(c echo.Context, tagId int, params server.GetTagServicesParams) error { + log := echolog.GetLogHandler(c, "GetTagServices") + log.Info("called", logkey.TagID, tagId) + + odb := a.getODB() + return a.handleList(c, "GetTagServices", "service", listEndpointParams{ + props: params.Props, limit: params.Limit, offset: params.Offset, + meta: params.Meta, stats: params.Stats, orderby: params.Orderby, groupby: params.Groupby, + }, func(ctx context.Context, p cdb.ListParams) ([]map[string]any, error) { + return odb.GetTagServices(ctx, tagId, p) + }) +} diff --git a/server/handlers/get_tags.go b/server/handlers/get_tags.go index 7766c5d..659facf 100644 --- a/server/handlers/get_tags.go +++ b/server/handlers/get_tags.go @@ -46,7 +46,7 @@ func (a *Api) handleGetTags(c echo.Context, tagID *int, query ListQueryParameter // GetTags handles GET /tags func (a *Api) GetTags(c echo.Context, params server.GetTagsParams) error { - query, err := buildListQueryParameters(params.Props, params.Limit, params.Offset, params.Meta, params.Stats, propsMapping["tag"]) + query, err := buildListQueryParameters(params.Props, params.Limit, params.Offset, params.Meta, params.Stats, params.Orderby, params.Groupby, propsMapping["tag"]) if err != nil { return JSONProblem(c, http.StatusBadRequest, err.Error()) } diff --git a/server/handlers/get_tags_nodes.go b/server/handlers/get_tags_nodes.go new file mode 100644 index 0000000..91a3ec8 --- /dev/null +++ b/server/handlers/get_tags_nodes.go @@ -0,0 +1,25 @@ +package serverhandlers + +import ( + "context" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" + "github.com/opensvc/oc3/util/echolog" +) + +// GetTagsNodes handles GET /tags/nodes +func (a *Api) GetTagsNodes(c echo.Context, params server.GetTagsNodesParams) error { + log := echolog.GetLogHandler(c, "GetTagsNodes") + log.Info("called") + + odb := a.getODB() + return a.handleList(c, "GetTagsNodes", "node_tag", listEndpointParams{ + props: params.Props, limit: params.Limit, offset: params.Offset, + meta: params.Meta, stats: params.Stats, orderby: params.Orderby, groupby: params.Groupby, + }, func(ctx context.Context, p cdb.ListParams) ([]map[string]any, error) { + return odb.GetTagsNodes(ctx, p) + }) +} diff --git a/server/handlers/get_tags_services.go b/server/handlers/get_tags_services.go new file mode 100644 index 0000000..1df582d --- /dev/null +++ b/server/handlers/get_tags_services.go @@ -0,0 +1,25 @@ +package serverhandlers + +import ( + "context" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" + "github.com/opensvc/oc3/util/echolog" +) + +// GetTagsServices handles GET /tags/services +func (a *Api) GetTagsServices(c echo.Context, params server.GetTagsServicesParams) error { + log := echolog.GetLogHandler(c, "GetTagsServices") + log.Info("called") + + odb := a.getODB() + return a.handleList(c, "GetTagsServices", "svc_tag", listEndpointParams{ + props: params.Props, limit: params.Limit, offset: params.Offset, + meta: params.Meta, stats: params.Stats, orderby: params.Orderby, groupby: params.Groupby, + }, func(ctx context.Context, p cdb.ListParams) ([]map[string]any, error) { + return odb.GetTagsServices(ctx, p) + }) +} diff --git a/server/handlers/handle_list.go b/server/handlers/handle_list.go new file mode 100644 index 0000000..ae5b0e5 --- /dev/null +++ b/server/handlers/handle_list.go @@ -0,0 +1,89 @@ +package serverhandlers + +import ( + "context" + "net/http" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" + "github.com/opensvc/oc3/util/echolog" + "github.com/opensvc/oc3/util/logkey" +) + +// listFetcher is the DB call signature shared by all list endpoints. +type listFetcher func(ctx context.Context, p cdb.ListParams) ([]map[string]any, error) + +// listEndpointParams bundles the standard query parameters shared by every list endpoint. +type listEndpointParams struct { + props *server.InQueryProps + limit *server.InQueryLimit + offset *server.InQueryOffset + meta *server.InQueryMeta + stats *server.InQueryStats + orderby *server.InQueryOrderby + groupby *server.InQueryGroupby +} + +// handleList implements the common pipeline for all list endpoints: +// 1. Parse and validate query parameters (props, pagination, meta, stats) +// 2. Build SQL SELECT expressions from the resolved props +// 3. Build SQL JOIN fragments required by cross-table props +// 4. Call fetch to retrieve data from the database +// 5. Return a formatted JSON response with optional metadata +func (a *Api) handleList( + c echo.Context, + handlerName string, + mappingKey string, + p listEndpointParams, + fetch listFetcher, +) error { + mapping := propsMapping[mappingKey] + + query, err := buildListQueryParameters(p.props, p.limit, p.offset, p.meta, p.stats, p.orderby, p.groupby, mapping) + if err != nil { + return JSONProblem(c, http.StatusBadRequest, err.Error()) + } + + log := echolog.GetLogHandler(c, handlerName) + groups := UserGroupsFromContext(c) + isManager := IsManager(c) + + log.Info("called", + "limit", query.Page.Limit, + "offset", query.Page.Offset, + "props", query.Props, + "meta", query.WithMeta, + "stats", query.WithStats, + "orderby", query.OrderBy, + "groupby", query.GroupBy, + "is_manager", isManager, + ) + + selectExprs, err := buildSelectClause(query.Props, mapping) + if err != nil { + log.Error("cannot build select clause", logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot build select clause") + } + + dbParams := cdb.ListParams{ + Groups: groups, + IsManager: isManager, + Limit: query.Page.Limit, + Offset: query.Page.Offset, + Props: query.Props, + SelectExprs: selectExprs, + TypeHints: buildTypeHints(query.Props, mapping), + OrderBy: query.OrderBy, + GroupBy: query.GroupBy, + } + + items, err := fetch(c.Request().Context(), dbParams) + if err != nil { + log.Error("cannot fetch items", logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot get %s", mappingKey) + } + + return c.JSON(http.StatusOK, newListResponse(items, mapping, query)) +} diff --git a/server/handlers/list_query_parameters.go b/server/handlers/list_query_parameters.go index 6a207f4..2fd25a9 100644 --- a/server/handlers/list_query_parameters.go +++ b/server/handlers/list_query_parameters.go @@ -1,12 +1,19 @@ package serverhandlers -import "github.com/opensvc/oc3/server" +import ( + "fmt" + "strings" + + "github.com/opensvc/oc3/server" +) type ListQueryParameters struct { Page PageParams Props []string WithMeta bool WithStats bool + OrderBy []string + GroupBy []string } func buildListQueryParameters( @@ -15,6 +22,8 @@ func buildListQueryParameters( offset *server.InQueryOffset, meta *server.InQueryMeta, stats *server.InQueryStats, + orderby *server.InQueryOrderby, + groupby *server.InQueryGroupby, mapping propMapping, ) (ListQueryParameters, error) { selectedProps, err := buildProps(props, mapping) @@ -22,10 +31,79 @@ func buildListQueryParameters( return ListQueryParameters{}, err } + orderExprs, err := buildOrderBy(orderby, mapping) + if err != nil { + return ListQueryParameters{}, err + } + + groupExprs, err := buildGroupBy(groupby, mapping) + if err != nil { + return ListQueryParameters{}, err + } + return ListQueryParameters{ Page: buildPageParams(limit, offset), Props: selectedProps, WithMeta: queryWithMeta(meta), WithStats: queryWithStats(stats), + OrderBy: orderExprs, + GroupBy: groupExprs, }, nil } + +func buildGroupBy(groupby *server.InQueryGroupby, mapping propMapping) ([]string, error) { + if groupby == nil || *groupby == "" { + return nil, nil + } + tokens := strings.Split(*groupby, ",") + exprs := make([]string, 0, len(tokens)) + for _, token := range tokens { + token = strings.TrimSpace(token) + if token == "" { + continue + } + def, ok := mapping.Props[token] + if !ok { + return nil, fmt.Errorf("unknown groupby prop %q", token) + } + col := def.Col + if col == nil { + return nil, fmt.Errorf("prop %q cannot be used in groupby (no column reference)", token) + } + exprs = append(exprs, col.Qualified()) + } + return exprs, nil +} + +func buildOrderBy(orderby *server.InQueryOrderby, mapping propMapping) ([]string, error) { + if orderby == nil || *orderby == "" { + return nil, nil + } + tokens := strings.Split(*orderby, ",") + exprs := make([]string, 0, len(tokens)) + for _, token := range tokens { + token = strings.TrimSpace(token) + if token == "" { + continue + } + desc := false + if strings.HasPrefix(token, "-") { + desc = true + token = token[1:] + } + def, ok := mapping.Props[token] + if !ok { + return nil, fmt.Errorf("unknown orderby prop %q", token) + } + col := def.Col + if col == nil { + return nil, fmt.Errorf("prop %q cannot be used in orderby (no column reference)", token) + } + expr := col.Qualified() + if desc { + expr += " DESC" + } + exprs = append(exprs, expr) + } + return exprs, nil +} diff --git a/server/handlers/list_response.go b/server/handlers/list_response.go index b21c445..4aafa13 100644 --- a/server/handlers/list_response.go +++ b/server/handlers/list_response.go @@ -117,7 +117,7 @@ func newListResponse(items []map[string]any, mapping propMapping, query ListQuer response.Meta = &listMeta{ Count: len(items), - AvailableProps: allowedProps(mapping), + AvailableProps: availableProps(mapping), IncludedProps: query.Props, Limit: query.Page.Limit, Offset: query.Page.Offset, diff --git a/server/handlers/middleware.go b/server/handlers/middleware.go index 43ccff6..fc3612c 100644 --- a/server/handlers/middleware.go +++ b/server/handlers/middleware.go @@ -21,8 +21,9 @@ const ( ) const ( - AuthModeUser = "user" - AuthModeNode = "node" + AuthModeUser = "user" + AuthModeNode = "node" + AuthModeAnonRegister = "anon_register" ) // AuthMiddleware returns auth middleware that authenticate requests from strategies. @@ -37,6 +38,9 @@ func AuthMiddleware(strategies union.Union) echo.MiddlewareFunc { } ext := user.GetExtensions() + if authMode := ext.Get(xauth.XAuthMode); authMode != "" { + c.Set(XAuthMode, authMode) + } if nodeID := ext.Get(xauth.XNodeID); nodeID != "" { c.Set(XNodeID, nodeID) c.Set(XAuthMode, AuthModeNode) @@ -95,3 +99,13 @@ func IsAuthByNode(c echo.Context) bool { authMode, ok := c.Get(XAuthMode).(string) return ok && authMode == AuthModeNode } + +func IsAuthByUser(c echo.Context) bool { + authMode, ok := c.Get(XAuthMode).(string) + return ok && authMode == AuthModeUser +} + +func IsAuthByAnonRegister(c echo.Context) bool { + authMode, ok := c.Get(XAuthMode).(string) + return ok && authMode == AuthModeAnonRegister +} diff --git a/server/handlers/post_app.go b/server/handlers/post_app.go new file mode 100644 index 0000000..df0f383 --- /dev/null +++ b/server/handlers/post_app.go @@ -0,0 +1,121 @@ +package serverhandlers + +import ( + "context" + "database/sql" + "net/http" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" + "github.com/opensvc/oc3/util/echolog" + "github.com/opensvc/oc3/util/logkey" +) + +// PostApp handles POST /apps/{app_id} +func (a *Api) PostApp(c echo.Context, appId string) error { + log := echolog.GetLogHandler(c, "PostApp") + ctx, cancel := context.WithTimeout(c.Request().Context(), a.SyncTimeout) + defer cancel() + + if !IsAuthByUser(c) { + return JSONProblemf(c, http.StatusUnauthorized, "user authentication required") + } + + if !IsManager(c) { + return JSONProblemf(c, http.StatusForbidden, "AppManager privilege required") + } + + var body server.PostAppJSONRequestBody + if err := c.Bind(&body); err != nil { + log.Error("invalid request body", logkey.Error, err) + return JSONProblem(c, http.StatusBadRequest, err.Error()) + } + + log.Info("called", "app_id", appId) + + odb := cdb.New(a.DB) + odb.CreateSession(a.Ev) + + isManager := IsManager(c) + + app, err := odb.GetApp(ctx, appId, nil, true) + if err != nil { + log.Error("cannot get app", "app_id", appId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot get app") + } + if app == nil { + return JSONProblemf(c, http.StatusNotFound, "app %s not found", appId) + } + + responsible, err := odb.AppResponsible(ctx, appId, UserGroupsFromContext(c), isManager, "") + if err != nil { + log.Error("cannot check app responsibility", "app_id", appId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot check app responsibility") + } + if !responsible { + return JSONProblemf(c, http.StatusForbidden, "you are not responsible for this app") + } + + fields := cdb.UpdateAppFields{ + App: body.App, + Description: body.Description, + AppDomain: body.AppDomain, + AppTeamOps: body.AppTeamOps, + } + + markSuccess, endTx, err := odb.BeginTxWithControl(ctx, log, &sql.TxOptions{}) + if err != nil { + log.Error("cannot start transaction", logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot update app") + } + defer endTx() + + if err := odb.UpdateApp(ctx, app.ID, fields); err != nil { + log.Error("cannot update app", "app_id", appId, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot update app") + } + + // If the app code is renamed, update nodes and services references + if body.App != nil && *body.App != app.App { + if err := odb.UpdateNodesApp(ctx, app.App, *body.App); err != nil { + log.Error("cannot update nodes app", logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot update nodes app reference") + } + if err := odb.UpdateServicesApp(ctx, app.App, *body.App); err != nil { + log.Error("cannot update services app", logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot update services app reference") + } + } + + userEmail, _ := c.Get(XUserEmail).(string) + if err := odb.Log(ctx, cdb.LogEntry{ + Action: "apps.change", + User: userEmail, + Fmt: "app %(app)s changed", + Dict: map[string]any{ + "app": app.App, + }, + Level: "info", + }); err != nil { + log.Error("cannot write audit log", logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot write audit log") + } + + markSuccess() + + if err := odb.Session.NotifyTableChangeWithData(ctx, "apps", map[string]any{"id": app.ID}); err != nil { + log.Error("cannot notify apps change", logkey.Error, err) + } + + newAppId := appId + if body.App != nil { + newAppId = *body.App + } + updated, err := odb.GetApp(ctx, newAppId, nil, true) + if err != nil || updated == nil { + return JSONProblemf(c, http.StatusInternalServerError, "cannot fetch updated app") + } + return c.JSON(http.StatusOK, updated) +} diff --git a/server/handlers/post_apps.go b/server/handlers/post_apps.go new file mode 100644 index 0000000..a5cc375 --- /dev/null +++ b/server/handlers/post_apps.go @@ -0,0 +1,128 @@ +package serverhandlers + +import ( + "context" + "net/http" + "strconv" + + "github.com/labstack/echo/v4" + + "github.com/opensvc/oc3/cdb" + "github.com/opensvc/oc3/server" + "github.com/opensvc/oc3/util/echolog" + "github.com/opensvc/oc3/util/logkey" + "github.com/opensvc/oc3/xauth" +) + +// PostApps handles POST /apps +func (a *Api) PostApps(c echo.Context) error { + log := echolog.GetLogHandler(c, "PostApps") + odb := a.getODB() + ctx, cancel := context.WithTimeout(c.Request().Context(), a.SyncTimeout) + defer cancel() + + if !IsAuthByUser(c) { + return JSONProblemf(c, http.StatusUnauthorized, "user authentication required") + } + + if !IsManager(c) { + return JSONProblemf(c, http.StatusForbidden, "AppManager privilege required") + } + + var body server.PostAppsJSONRequestBody + if err := c.Bind(&body); err != nil { + log.Error("invalid request body", logkey.Error, err) + return JSONProblem(c, http.StatusBadRequest, err.Error()) + } + + if body.App == "" { + return JSONProblemf(c, http.StatusBadRequest, "missing required field: app") + } + + log.Info("called", "app", body.App) + + exists, err := odb.AppExists(ctx, body.App) + if err != nil { + log.Error("cannot check app existence", "app", body.App, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot check app existence") + } + if exists { + return JSONProblemf(c, http.StatusConflict, "app %s already exists", body.App) + } + + user := UserInfoFromContext(c) + if user == nil { + return JSONProblemf(c, http.StatusUnauthorized, "missing user context") + } + userIDStr := user.GetExtensions().Get(xauth.XUserID) + userID, err := strconv.ParseInt(userIDStr, 10, 64) + if err != nil { + return JSONProblemf(c, http.StatusBadRequest, "invalid user id") + } + + exceeded, err := odb.AppQuotaExceeded(ctx, userID) + if err != nil { + log.Error("cannot check app quota", logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot check app quota") + } + if exceeded { + return JSONProblemf(c, http.StatusForbidden, "app quota exceeded") + } + + groupID, ok, err := odb.UserDefaultGroupID(ctx, userID) + if err != nil { + log.Error("cannot find default group", logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot find default group") + } + if !ok { + return JSONProblemf(c, http.StatusInternalServerError, "user has no default group") + } + + var description, appDomain, appTeamOps string + if body.Description != nil { + description = *body.Description + } + if body.AppDomain != nil { + appDomain = *body.AppDomain + } + if body.AppTeamOps != nil { + appTeamOps = *body.AppTeamOps + } + + app, err := odb.InsertApp(ctx, body.App, description, appDomain, appTeamOps) + if err != nil { + log.Error("cannot insert app", "app", body.App, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot create app") + } + + if err := odb.InsertAppResponsible(ctx, app.ID, groupID); err != nil { + log.Error("cannot insert app responsible", "app", body.App, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot set app responsible") + } + + if err := odb.InsertAppPublication(ctx, app.ID, groupID); err != nil { + log.Error("cannot insert app publication", "app", body.App, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot set app publication") + } + + if err := odb.Session.NotifyChanges(ctx); err != nil { + log.Error("cannot notify changes", logkey.Error, err) + } + + userEmail, _ := c.Get(XUserEmail).(string) + logErr := odb.Log(ctx, cdb.LogEntry{ + Action: "apps.create", + User: userEmail, + Fmt: "app %(app)s created. data %(data)s", + Dict: map[string]any{ + "app": app.App, + "data": body, + }, + Level: "info", + }) + if logErr != nil { + log.Error("cannot write audit log", logkey.Error, logErr) + } + + return c.JSON(http.StatusOK, app) +} diff --git a/server/handlers/post_auth_node.go b/server/handlers/post_auth_node.go index be69e5f..cb501f1 100644 --- a/server/handlers/post_auth_node.go +++ b/server/handlers/post_auth_node.go @@ -31,12 +31,14 @@ func (a *Api) PostAuthNode(c echo.Context) error { var app string var userID int64 + var teamResponsible string if body.App != nil { app = *body.App } - if !IsAuthByNode(c) { + switch { + case IsAuthByUser(c): // User auth user := UserInfoFromContext(c) if user == nil { @@ -68,13 +70,34 @@ func (a *Api) PostAuthNode(c echo.Context) error { return JSONProblemf(c, http.StatusForbidden, "you are not responsible for the '%s' app", app) } } - } else { - // Node auth - // Check in config that refuse_anon_register is not set to true - allowAnonRegister := viper.GetBool("server.allow_anon_register") - if !allowAnonRegister { + + teamResponsible, _, err = odb.UserDefaultGroup(ctx, userID) + if err != nil { + log.Error("failed to find default group", logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot find default group") + } + case IsAuthByNode(c), IsAuthByAnonRegister(c): + if !viper.GetBool("server.allow_anon_register") { return JSONProblemf(c, http.StatusForbidden, "anonymous node registration is disabled") } + if app == "" && IsAuthByNode(c) { + if s, ok := c.Get(XApp).(string); ok { + app = s + } + } + if app == "" { + return JSONProblemf(c, http.StatusBadRequest, "missing app") + } + teamResponsible = "Everybody" + default: + return JSONProblemf(c, http.StatusUnauthorized, "missing authentication") + } + + if ok, err := odb.AppExists(ctx, app); err != nil { + log.Error("failed to verify app existence", "app", app, logkey.Error, err) + return JSONProblemf(c, http.StatusInternalServerError, "cannot verify app") + } else if !ok { + return JSONProblemf(c, http.StatusBadRequest, "unknown app %s", app) } var ( @@ -92,12 +115,6 @@ func (a *Api) PostAuthNode(c echo.Context) error { nodeID = node.NodeID } else { // Node does not exist: create it with a new node_id - teamResponsible, _, err := odb.UserDefaultGroup(ctx, userID) - if err != nil { - log.Error("failed to find default group", logkey.Error, err) - return JSONProblemf(c, http.StatusInternalServerError, "cannot find default group") - } - nodeID = uuid.New().String() if err := odb.InsertNode(ctx, nodename, teamResponsible, app, nodeID); err != nil { log.Error("failed to insert node", logkey.Error, err) diff --git a/server/handlers/props.go b/server/handlers/props.go index 602f185..1455087 100644 --- a/server/handlers/props.go +++ b/server/handlers/props.go @@ -8,7 +8,31 @@ import ( "github.com/opensvc/oc3/server" ) -func allowedProps(mapping propMapping) []string { +func buildSelectClause(props []string, mapping propMapping) ([]string, error) { + exprs := make([]string, 0, len(props)) + for _, prop := range props { + if strings.Contains(prop, ".") { + // Cross-table prop: use "table.column" + exprs = append(exprs, prop) + continue + } + if mapping.Props == nil { + return nil, fmt.Errorf("no SQL expressions defined for this resource") + } + def, ok := mapping.Props[prop] + if !ok { + return nil, fmt.Errorf("no SQL expression for prop %q", prop) + } + expr := def.selectExpr() + if expr == "" { + return nil, fmt.Errorf("prop %q has no SQL expression or column reference", prop) + } + exprs = append(exprs, expr) + } + return exprs, nil +} + +func availableProps(mapping propMapping) []string { props := make([]string, 0, len(mapping.Available)) for _, prop := range mapping.Available { if _, blocked := mapping.Blacklist[prop]; !blocked { @@ -18,9 +42,23 @@ func allowedProps(mapping propMapping) []string { return props } +func defaultProps(mapping propMapping) []string { + source := mapping.Available + if mapping.Default != nil { + source = mapping.Default + } + props := make([]string, 0, len(source)) + for _, prop := range source { + if _, blocked := mapping.Blacklist[prop]; !blocked { + props = append(props, prop) + } + } + return props +} + func buildProps(props *server.InQueryProps, mapping propMapping) ([]string, error) { allowedSet := make(map[string]struct{}, len(mapping.Available)) - defaultProps := allowedProps(mapping) + defaultProps := defaultProps(mapping) for _, prop := range mapping.Available { allowedSet[prop] = struct{}{} @@ -37,6 +75,33 @@ func buildProps(props *server.InQueryProps, mapping propMapping) ([]string, erro if prop == "" { continue } + // Cross-table prop: "table.column" + if table, col, ok := strings.Cut(prop, "."); ok { + jd, joinKnown := mapping.Joins[table] + if !joinKnown { + return nil, fmt.Errorf("prop does not exist: %v", []string{table, col}) + } + refMapping, refFound := propsMapping[jd.MappingKey] + if !refFound { + return nil, fmt.Errorf("prop does not exist: %v", []string{table, col}) + } + colAllowed := false + for _, c := range refMapping.Available { + if c == col { + colAllowed = true + break + } + } + if !colAllowed { + return nil, fmt.Errorf("prop does not exist: %v", []string{table, col}) + } + if _, done := seen[prop]; done { + continue + } + seen[prop] = struct{}{} + selected = append(selected, prop) + continue + } if _, ok := allowedSet[prop]; !ok { return nil, fmt.Errorf("unknown prop %q", prop) } @@ -57,6 +122,30 @@ func buildProps(props *server.InQueryProps, mapping propMapping) ([]string, erro return selected, nil } +func buildTypeHints(props []string, mapping propMapping) map[string]string { + hints := make(map[string]string, len(props)) + for _, prop := range props { + if table, col, ok := strings.Cut(prop, "."); ok { + jd, joinKnown := mapping.Joins[table] + if !joinKnown { + continue + } + refMapping, refFound := propsMapping[jd.MappingKey] + if !refFound { + continue + } + if def, ok := refMapping.Props[col]; ok && def.Kind != "" { + hints[prop] = def.Kind + } + continue + } + if def, ok := mapping.Props[prop]; ok && def.Kind != "" { + hints[prop] = def.Kind + } + } + return hints +} + func filterItemFields(v any, props []string) (map[string]any, error) { data, err := json.Marshal(v) if err != nil { diff --git a/server/handlers/props_mapping.go b/server/handlers/props_mapping.go index 858f146..8da0715 100644 --- a/server/handlers/props_mapping.go +++ b/server/handlers/props_mapping.go @@ -1,14 +1,405 @@ package serverhandlers +import ( + "fmt" + + "github.com/opensvc/oc3/schema" +) + +type propDef struct { + Col *schema.Col + SQLExpr string + Kind string +} + +func (p propDef) selectExpr() string { + if p.SQLExpr != "" { + return p.SQLExpr + } + if p.Col != nil { + return p.Col.Qualified() + } + return "" +} + +func col(c *schema.Col) propDef { + return propDef{Col: c} +} + +func colStr(c *schema.Col) propDef { + return propDef{Col: c, SQLExpr: fmt.Sprintf("COALESCE(%s, '')", c.Qualified()), Kind: "string"} +} + +func colInt(c *schema.Col) propDef { + return propDef{Col: c, SQLExpr: fmt.Sprintf("COALESCE(%s, 0)", c.Qualified()), Kind: "int64"} +} + +type JoinDef struct { + MappingKey string +} + type propMapping struct { Available []string + // Default is the subset of Available returned when no props are requested. + // If nil, all Available props are returned by default. + Default []string Blacklist map[string]struct{} + // Props maps prop names to their propDef (column reference + optional SQL override). + // Enables column pushdown: only requested columns are fetched from DB. + Props map[string]propDef + // Joins declares joinable tables. A prop "table.column" is valid when "table" + // is a key in Joins and "column" is listed in JoinDef.Columns. + Joins map[string]JoinDef } var propsMapping = map[string]propMapping{ + "node": { + Available: []string{ + "node_id", "nodename", "app", "node_env", "cluster_id", + "loc_country", "loc_city", "loc_addr", "loc_building", "loc_floor", "loc_room", "loc_rack", "loc_zip", + "cpu_freq", "cpu_cores", "cpu_dies", "cpu_vendor", "cpu_model", "cpu_threads", + "mem_banks", "mem_slots", "mem_bytes", + "os_name", "os_release", "os_update", "os_segment", "os_arch", "os_vendor", "os_kernel", "os_concat", + "team_responsible", "team_integ", "team_support", + "serial", "model", "manufacturer", "type", "assetname", "asset_env", + "warranty_end", "maintenance_end", + "status", "role", "sec_zone", + "power_cabinet1", "power_cabinet2", "power_supply_nb", "power_protect", "power_protect_breaker", "power_breaker1", "power_breaker2", + "blade_cabinet", "enclosure", "enclosureslot", + "hv", "hvpool", "hvvdc", + "fqdn", "connect_to", "listener_port", "version", "collector", "sp_version", "bios_version", + "tz", "last_boot", "last_comm", + "node_frozen", "node_frozen_at", + "snooze_till", "notifications", "action_type", + "hw_obs_warn_date", "hw_obs_alert_date", "os_obs_warn_date", "os_obs_alert_date", + "updated", + }, + Props: map[string]propDef{ + "node_id": colStr(schema.NodesNodeID), + "nodename": colStr(schema.NodesNodename), + "app": colStr(schema.NodesApp), + "node_env": colStr(schema.NodesNodeEnv), + "cluster_id": colStr(schema.NodesClusterID), + "loc_country": colStr(schema.NodesLocCountry), + "loc_city": colStr(schema.NodesLocCity), + "loc_addr": colStr(schema.NodesLocAddr), + "loc_building": colStr(schema.NodesLocBuilding), + "loc_floor": colStr(schema.NodesLocFloor), + "loc_room": colStr(schema.NodesLocRoom), + "loc_rack": colStr(schema.NodesLocRack), + "loc_zip": colStr(schema.NodesLocZip), + "cpu_freq": colStr(schema.NodesCPUFreq), + "cpu_cores": colInt(schema.NodesCPUCores), + "cpu_dies": colInt(schema.NodesCPUDies), + "cpu_vendor": colStr(schema.NodesCPUVendor), + "cpu_model": colStr(schema.NodesCPUModel), + "cpu_threads": colInt(schema.NodesCPUThreads), + "mem_banks": colInt(schema.NodesMEMBanks), + "mem_slots": colInt(schema.NodesMEMSlots), + "mem_bytes": colInt(schema.NodesMEMBytes), + "os_name": colStr(schema.NodesOSName), + "os_release": colStr(schema.NodesOSRelease), + "os_update": colStr(schema.NodesOSUpdate), + "os_segment": colStr(schema.NodesOSSegment), + "os_arch": colStr(schema.NodesOSArch), + "os_vendor": colStr(schema.NodesOSVendor), + "os_kernel": colStr(schema.NodesOSKernel), + "os_concat": colStr(schema.NodesOSConcat), + "team_responsible": colStr(schema.NodesTeamResponsible), + "team_integ": colStr(schema.NodesTeamInteg), + "team_support": colStr(schema.NodesTeamSupport), + "serial": colStr(schema.NodesSerial), + "model": colStr(schema.NodesModel), + "manufacturer": colStr(schema.NodesManufacturer), + "type": colStr(schema.NodesType), + "assetname": colStr(schema.NodesAssetname), + "asset_env": colStr(schema.NodesAssetEnv), + "warranty_end": colStr(schema.NodesWarrantyEnd), + "maintenance_end": colStr(schema.NodesMaintenanceEnd), + "status": colStr(schema.NodesStatus), + "role": colStr(schema.NodesRole), + "sec_zone": colStr(schema.NodesSecZone), + "power_cabinet1": colStr(schema.NodesPowerCabinet1), + "power_cabinet2": colStr(schema.NodesPowerCabinet2), + "power_supply_nb": colInt(schema.NodesPowerSupplyNb), + "power_protect": colStr(schema.NodesPowerProtect), + "power_protect_breaker": colStr(schema.NodesPowerProtectBreaker), + "power_breaker1": colStr(schema.NodesPowerBreaker1), + "power_breaker2": colStr(schema.NodesPowerBreaker2), + "blade_cabinet": colStr(schema.NodesBladeCabinet), + "enclosure": colStr(schema.NodesEnclosure), + "enclosureslot": colStr(schema.NodesEnclosureslot), + "hv": colStr(schema.NodesHv), + "hvpool": colStr(schema.NodesHvpool), + "hvvdc": colStr(schema.NodesHvvdc), + "fqdn": colStr(schema.NodesFqdn), + "connect_to": colStr(schema.NodesConnectTo), + "listener_port": colInt(schema.NodesListenerPort), + "version": colStr(schema.NodesVersion), + "collector": colStr(schema.NodesCollector), + "sp_version": colStr(schema.NodesSpVersion), + "bios_version": colStr(schema.NodesBiosVersion), + "tz": colStr(schema.NodesTz), + "last_boot": colStr(schema.NodesLastBoot), + "last_comm": colStr(schema.NodesLastComm), + "node_frozen": colStr(schema.NodesNodeFrozen), + "node_frozen_at": colStr(schema.NodesNodeFrozenAt), + "snooze_till": colStr(schema.NodesSnoozeTill), + "notifications": colStr(schema.NodesNotifications), + "action_type": colStr(schema.NodesActionType), + "hw_obs_warn_date": colStr(schema.NodesHWObsWarnDate), + "hw_obs_alert_date": colStr(schema.NodesHWObsAlertDate), + "os_obs_warn_date": colStr(schema.NodesOSObsWarnDate), + "os_obs_alert_date": colStr(schema.NodesOSObsAlertDate), + "updated": colStr(schema.NodesUpdated), + }, + }, + "disk": { + Available: []string{ + "disk_id", "disk_name", "disk_devid", "disk_vendor", "disk_model", + "disk_size", "disk_used", "disk_alloc", "disk_raid", "disk_group", + "disk_level", "disk_arrayid", "disk_dg", "disk_region", + "node_id", "nodename", "svc_id", "svcname", "app", "updated", + }, + Props: map[string]propDef{ + "disk_id": col(schema.DiskinfoDiskID), + "disk_name": colStr(schema.DiskinfoDiskName), + "disk_devid": colStr(schema.DiskinfoDiskDevid), + "disk_vendor": colStr(schema.SvcdisksDiskVendor), + "disk_model": colStr(schema.SvcdisksDiskModel), + "disk_size": colInt(schema.DiskinfoDiskSize), + "disk_used": colInt(schema.SvcdisksDiskUsed), + "disk_alloc": colInt(schema.DiskinfoDiskAlloc), + "disk_raid": colStr(schema.DiskinfoDiskRaid), + "disk_group": colStr(schema.DiskinfoDiskGroup), + "disk_level": colInt(schema.DiskinfoDiskLevel), + "disk_arrayid": colStr(schema.DiskinfoDiskArrayid), + "disk_dg": colStr(schema.SvcdisksDiskDG), + "disk_region": colStr(schema.SvcdisksDiskRegion), + "node_id": colStr(schema.SvcdisksNodeID), + "nodename": colStr(schema.NodesNodename), + "svc_id": colStr(schema.SvcdisksSvcID), + "svcname": colStr(schema.ServicesSvcname), + "app": colStr(schema.AppsApp), + "updated": colStr(schema.DiskinfoDiskUpdated), + }, + }, + "node_interface": { + Available: []string{"id", "node_id", "intf", "mac", "type", "addr", "mask", "updated", "flag_deprecated"}, + Default: []string{"id", "node_id", "intf", "mac", "updated", "flag_deprecated"}, + Blacklist: map[string]struct{}{"type": {}, "addr": {}, "mask": {}}, + Props: map[string]propDef{ + "id": col(schema.NodeIPID), + "node_id": colStr(schema.NodeIPNodeID), + "intf": colStr(schema.NodeIPIntf), + "mac": colStr(schema.NodeIPMac), + "type": colStr(schema.NodeIPType), + "addr": colStr(schema.NodeIPAddr), + "mask": colStr(schema.NodeIPMask), + "updated": colStr(schema.NodeIPUpdated), + "flag_deprecated": colInt(schema.NodeIPFlagDeprecated), + }, + Joins: map[string]JoinDef{ + "nodes": { + MappingKey: "node", + }, + }, + }, + "hba": { + Available: []string{"id", "node_id", "hba_id", "hba_type", "updated"}, + Props: map[string]propDef{ + "id": col(schema.NodeHBAID), + "node_id": colStr(schema.NodeHBANodeID), + "hba_id": colStr(schema.NodeHBAHBAID), + "hba_type": colStr(schema.NodeHBAHBAType), + "updated": colStr(schema.NodeHBAUpdated), + }, + }, + "array": { + Available: []string{ + "id", "array_name", "array_comment", "array_model", + "array_firmware", "array_cache", "array_updated", "array_level", + }, + Props: map[string]propDef{ + "id": col(schema.StorArrayID), + "array_name": colStr(schema.StorArrayArrayName), + "array_comment": colStr(schema.StorArrayArrayComment), + "array_model": colStr(schema.StorArrayArrayModel), + "array_firmware": colStr(schema.StorArrayArrayFirmware), + "array_cache": colInt(schema.StorArrayArrayCache), + "array_updated": colStr(schema.StorArrayArrayUpdated), + "array_level": colInt(schema.StorArrayArrayLevel), + }, + }, + "app": { + Available: []string{"id", "app", "updated", "app_domain", "app_team_ops", "description"}, + Props: map[string]propDef{ + "id": col(schema.AppsID), + "app": col(schema.AppsApp), + "updated": colStr(schema.AppsUpdated), + "app_domain": colStr(schema.AppsAppDomain), + "app_team_ops": colStr(schema.AppsAppTeamOps), + "description": colStr(schema.AppsDescription), + }, + }, + "auth_group": { + Available: []string{"id", "role", "privilege", "description"}, + }, "tag": { Available: []string{"id", "tag_name", "tag_created", "tag_exclude", "tag_data", "tag_id"}, Blacklist: map[string]struct{}{"id": {}}, + Props: map[string]propDef{ + "id": col(schema.TagsID), + "tag_name": colStr(schema.TagsTagName), + "tag_created": colStr(schema.TagsTagCreated), + "tag_exclude": colStr(schema.TagsTagExclude), + "tag_data": col(schema.TagsTagData), + "tag_id": colStr(schema.TagsTagID), + }, + }, + "node_tag": { + Available: []string{"id", "created", "node_id", "tag_id", "tag_attach_data"}, + Blacklist: map[string]struct{}{"id": {}}, + Props: map[string]propDef{ + "id": col(schema.NodeTagsID), + "created": colStr(schema.NodeTagsCreated), + "node_id": colStr(schema.NodeTagsNodeID), + "tag_id": colStr(schema.NodeTagsTagID), + "tag_attach_data": colStr(schema.NodeTagsTagAttachData), + }, + }, + "svc_tag": { + Available: []string{"id", "created", "svc_id", "tag_id", "tag_attach_data"}, + Blacklist: map[string]struct{}{"id": {}}, + Props: map[string]propDef{ + "id": col(schema.SvcTagsID), + "created": colStr(schema.SvcTagsCreated), + "svc_id": colStr(schema.SvcTagsSvcID), + "tag_id": colStr(schema.SvcTagsTagID), + "tag_attach_data": colStr(schema.SvcTagsTagAttachData), + }, + }, + "service": { + Available: []string{ + "svc_id", "svcname", "cluster_id", + "svc_status", "svc_availstatus", + "svc_app", "svc_env", "svc_ha", + "svc_topology", "svc_frozen", "svc_placement", "svc_provisioned", + "svc_flex_min_nodes", "svc_flex_max_nodes", + "svc_flex_cpu_low_threshold", "svc_flex_cpu_high_threshold", + "svc_autostart", + "svc_nodes", "svc_drpnode", "svc_drpnodes", + "svc_comment", "svc_created", "svc_status_updated", + "svc_notifications", "svc_snooze_till", + "updated", + }, + Default: []string{"svc_id", "svcname", "cluster_id", "svc_status", "svc_availstatus", "svc_app", "svc_env", "updated"}, + Props: map[string]propDef{ + "svc_id": colStr(schema.ServicesSvcID), + "svcname": colStr(schema.ServicesSvcname), + "cluster_id": colStr(schema.ServicesClusterID), + "svc_status": colStr(schema.ServicesSvcStatus), + "svc_availstatus": colStr(schema.ServicesSvcAvailstatus), + "svc_app": colStr(schema.ServicesSvcApp), + "svc_env": colStr(schema.ServicesSvcEnv), + "svc_ha": colStr(schema.ServicesSvcHa), + "svc_topology": colStr(schema.ServicesSvcTopology), + "svc_frozen": colStr(schema.ServicesSvcFrozen), + "svc_placement": colStr(schema.ServicesSvcPlacement), + "svc_provisioned": colStr(schema.ServicesSvcProvisioned), + "svc_flex_min_nodes": colInt(schema.ServicesSvcFlexMinNodes), + "svc_flex_max_nodes": colInt(schema.ServicesSvcFlexMaxNodes), + "svc_flex_cpu_low_threshold": colInt(schema.ServicesSvcFlexCPULowThreshold), + "svc_flex_cpu_high_threshold": colInt(schema.ServicesSvcFlexCPUHighThreshold), + "svc_autostart": colStr(schema.ServicesSvcAutostart), + "svc_nodes": colStr(schema.ServicesSvcNodes), + "svc_drpnode": colStr(schema.ServicesSvcDrpnode), + "svc_drpnodes": colStr(schema.ServicesSvcDrpnodes), + "svc_comment": colStr(schema.ServicesSvcComment), + "svc_created": colStr(schema.ServicesSvcCreated), + "svc_status_updated": colStr(schema.ServicesSvcStatusUpdated), + "svc_notifications": colStr(schema.ServicesSvcNotifications), + "svc_snooze_till": colStr(schema.ServicesSvcSnoozeTill), + "updated": colStr(schema.ServicesUpdated), + }, + }, + "instance": { + Available: []string{ + "svc_id", "node_id", + "mon_svctype", + "mon_availstatus", "mon_overallstatus", + "mon_smon_status", "mon_smon_global_expect", + "mon_ipstatus", "mon_fsstatus", "mon_diskstatus", "mon_containerstatus", + "mon_sharestatus", "mon_syncstatus", "mon_appstatus", "mon_hbstatus", + "mon_frozen", "mon_frozen_at", "mon_encap_frozen_at", + "mon_vmname", "mon_vmtype", "mon_guestos", "mon_vcpus", "mon_vmem", + "mon_updated", "mon_changed", + }, + Default: []string{ + "svc_id", "node_id", + "mon_availstatus", "mon_overallstatus", "mon_smon_status", + "mon_frozen", "mon_updated", + }, + Props: map[string]propDef{ + "svc_id": colStr(schema.SvcmonSvcID), + "node_id": colStr(schema.SvcmonNodeID), + "mon_svctype": colStr(schema.SvcmonMonSvctype), + "mon_availstatus": colStr(schema.SvcmonMonAvailstatus), + "mon_overallstatus": colStr(schema.SvcmonMonOverallstatus), + "mon_smon_status": colStr(schema.SvcmonMonSmonStatus), + "mon_smon_global_expect": colStr(schema.SvcmonMonSmonGlobalExpect), + "mon_ipstatus": colStr(schema.SvcmonMonIpstatus), + "mon_fsstatus": colStr(schema.SvcmonMonFsstatus), + "mon_diskstatus": colStr(schema.SvcmonMonDiskstatus), + "mon_containerstatus": colStr(schema.SvcmonMonContainerstatus), + "mon_sharestatus": colStr(schema.SvcmonMonSharestatus), + "mon_syncstatus": colStr(schema.SvcmonMonSyncstatus), + "mon_appstatus": colStr(schema.SvcmonMonAppstatus), + "mon_hbstatus": colStr(schema.SvcmonMonHbstatus), + "mon_frozen": colStr(schema.SvcmonMonFrozen), + "mon_frozen_at": colStr(schema.SvcmonMonFrozenAt), + "mon_encap_frozen_at": colStr(schema.SvcmonMonEncapFrozenAt), + "mon_vmname": colStr(schema.SvcmonMonVmname), + "mon_vmtype": colStr(schema.SvcmonMonVmtype), + "mon_guestos": colStr(schema.SvcmonMonGuestos), + "mon_vcpus": colInt(schema.SvcmonMonVcpus), + "mon_vmem": colInt(schema.SvcmonMonVmem), + "mon_updated": colStr(schema.SvcmonMonUpdated), + "mon_changed": colStr(schema.SvcmonMonChanged), + }, + }, + "instance_status_log": { + Available: []string{ + "id", + "svc_id", "node_id", + "mon_begin", "mon_end", + "mon_availstatus", "mon_overallstatus", + "mon_ipstatus", "mon_fsstatus", "mon_diskstatus", + "mon_sharestatus", "mon_containerstatus", + "mon_syncstatus", "mon_hbstatus", "mon_appstatus", + }, + Default: []string{ + "svc_id", "node_id", + "mon_begin", "mon_end", + "mon_availstatus", "mon_overallstatus", + }, + Props: map[string]propDef{ + "id": col(schema.SvcmonLogID), + "svc_id": colStr(schema.SvcmonLogSvcID), + "node_id": colStr(schema.SvcmonLogNodeID), + "mon_begin": colStr(schema.SvcmonLogMonBegin), + "mon_end": colStr(schema.SvcmonLogMonEnd), + "mon_availstatus": colStr(schema.SvcmonLogMonAvailstatus), + "mon_overallstatus": colStr(schema.SvcmonLogMonOverallstatus), + "mon_ipstatus": colStr(schema.SvcmonLogMonIpstatus), + "mon_fsstatus": colStr(schema.SvcmonLogMonFsstatus), + "mon_diskstatus": colStr(schema.SvcmonLogMonDiskstatus), + "mon_sharestatus": colStr(schema.SvcmonLogMonSharestatus), + "mon_containerstatus": colStr(schema.SvcmonLogMonContainerstatus), + "mon_syncstatus": colStr(schema.SvcmonLogMonSyncstatus), + "mon_hbstatus": colStr(schema.SvcmonLogMonHbstatus), + "mon_appstatus": colStr(schema.SvcmonLogMonAppstatus), + }, }, "moduleset": { Available: []string{"id", "modset_name", "modset_author", "modset_updated"}, diff --git a/xauth/anon-register.go b/xauth/anon-register.go new file mode 100644 index 0000000..292ad4e --- /dev/null +++ b/xauth/anon-register.go @@ -0,0 +1,39 @@ +package xauth + +import ( + "context" + "net/http" + + "github.com/shaj13/go-guardian/v2/auth" + "github.com/spf13/viper" +) + +const ( + XAuthMode = "auth_mode" + AuthModeAnonRegister = "anon_register" +) + +type anonRegister struct{} + +func NewAnonRegister() auth.Strategy { + return &anonRegister{} +} + +func (a *anonRegister) Authenticate(_ context.Context, r *http.Request) (auth.Info, error) { + if r.Method != http.MethodPost { + return nil, ErrPrivatePath + } + if r.URL.Path != "/api/auth/node" { + return nil, ErrPrivatePath + } + if !viper.GetBool("server.allow_anon_register") { + return nil, ErrPrivatePath + } + if r.Header.Get("Authorization") != "" { + return nil, ErrPrivatePath + } + + ext := make(auth.Extensions) + ext.Set(XAuthMode, AuthModeAnonRegister) + return auth.NewUserInfo("anon-register", "", nil, ext), nil +}