|
| 1 | +package apiview |
| 2 | + |
| 3 | +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 4 | + |
| 5 | +type ViewType string |
| 6 | + |
| 7 | +const ( |
| 8 | + ViewTypeGrid ViewType = "grid" |
| 9 | + ViewTypeTable ViewType = "table" |
| 10 | + ViewTypeChart ViewType = "chart" |
| 11 | +) |
| 12 | + |
| 13 | +type ViewFieldType string |
| 14 | + |
| 15 | +type ViewMetadata struct { |
| 16 | + Id string |
| 17 | + Description string |
| 18 | + Name string |
| 19 | + Version string |
| 20 | +} |
| 21 | + |
| 22 | +const ( |
| 23 | + ViewFieldTypeString ViewFieldType = "string" |
| 24 | + ViewFieldTypeNumber ViewFieldType = "number" |
| 25 | + ViewFieldTypeDate ViewFieldType = "date" |
| 26 | + ViewFieldTypeDateTime ViewFieldType = "datetime" |
| 27 | + ViewFieldTypeBoolean ViewFieldType = "boolean" |
| 28 | + ViewFieldTypeEnum ViewFieldType = "enum" |
| 29 | +) |
| 30 | + |
| 31 | +type View struct { |
| 32 | + Type ViewType `json:"type,omitempty"` |
| 33 | + Columns []ViewField `json:"columns,omitempty"` |
| 34 | + Rows []ViewRow `json:"rows,omitempty"` |
| 35 | +} |
| 36 | + |
| 37 | +type ViewRow []ViewData |
| 38 | + |
| 39 | +type ViewField struct { |
| 40 | + Name string `json:"name"` |
| 41 | + Description string `json:"description,omitempty"` |
| 42 | + Order int `json:"order"` |
| 43 | + Default bool `json:"default"` |
| 44 | + Writeable bool `json:"writeable,omitempty"` |
| 45 | + Type ViewFieldType `json:"type,omitempty"` |
| 46 | + PossibleValues []string `json:"possibleValues,omitempty"` |
| 47 | + ResourceType metav1.TypeMeta `json:"resourceType,omitempty"` |
| 48 | + ResourceFieldRef string `json:"resourceFieldRef,omitempty"` //"spec.clusterdata.clustername" |
| 49 | +} |
| 50 | + |
| 51 | +type ViewData struct { |
| 52 | + FieldName string `json:"fieldName"` |
| 53 | + FieldValue string `json:"fieldValue"` |
| 54 | + Description string `json:"description,omitempty"` |
| 55 | + ResourceUid string `json:"resourceUid,omitempty"` |
| 56 | +} |
0 commit comments