mirror of https://github.com/grafana/grafana
Investigations: Add experimental app platform backend (#100584)
* add investigations group? * Investigations: Add experimental app platform backend * change `grafana-app-sdk/logging` version * investigations: add feature flag to test --------- Co-authored-by: Sven Grossmann <svennergr@gmail.com>pull/100834/head
parent
78ef9fd9d9
commit
ff7ba54cbc
@ -1,2 +0,0 @@ |
||||
module: "github.com/grafana/grafana/apps/investigation/kinds" |
||||
language: version: "v0.8.2" |
@ -1,87 +0,0 @@ |
||||
package investigation |
||||
|
||||
// This is our Investigation definition, which contains metadata about the kind, and the kind's schema |
||||
investigation: { |
||||
kind: "Investigation" |
||||
pluralName: "Investigations" |
||||
current: "v1alpha1" |
||||
versions: { |
||||
"v1alpha1": { |
||||
codegen: { |
||||
frontend: false |
||||
backend: true |
||||
} |
||||
schema: { |
||||
#InvestigationSpec: { |
||||
title: string |
||||
status: "open" | "closed" |
||||
items: [...#InvestigationItem] |
||||
} |
||||
|
||||
// InvestigationItem is an item in an investigation. |
||||
#InvestigationItem: { |
||||
id: string |
||||
title: string |
||||
// type is the type of the item "timeseries", "heatmap", "log-table" (not an enum to allow for future extensions). |
||||
type: string |
||||
// url is the URL to the item. |
||||
url: string |
||||
// origin is where the item was created from. |
||||
origin: string // "explore-metrics", "explore-logs", "explore-traces" (not an enum to allow for future extensions) |
||||
// iconPath (optional) is the path to the icon for the item. |
||||
iconPath?: string |
||||
// timeRange (optional) is the time range of the item. |
||||
timeRange: #AbsoluteTimeRange |
||||
// note (optional) is a comment on the item. |
||||
note?: [...#Comment] |
||||
// queryType is the type of the query used to generate this item. |
||||
queryType: "logs" | "metrics" |
||||
// dataQuery contains the query used to generate this item. |
||||
dataQuery: #DataQueryLogs | #DataQueryMetrics |
||||
} |
||||
|
||||
// DataQueryLogs is a data query for logs. |
||||
#DataQueryLogs: { |
||||
// refId is the reference ID of the query. |
||||
refId: string |
||||
// datasource is the datasource of the query. |
||||
datasource: #DatasourceRef |
||||
// expr is the expression of the query. |
||||
expr: string |
||||
// maxLines (optional) is used to limit the number of log rows returned. |
||||
maxLines?: int64 |
||||
} |
||||
|
||||
// DataQueryMetrics is a data query for metrics. |
||||
#DataQueryMetrics: { |
||||
refId: string |
||||
datasource: #DatasourceRef |
||||
expr: string |
||||
} |
||||
|
||||
// Comment is a comment on an investigation item. |
||||
#Comment: { |
||||
authorUserID: string |
||||
bodyMarkdown: string |
||||
} |
||||
|
||||
// DatasourceRef is a reference to a datasource. |
||||
#DatasourceRef: { |
||||
uid: string |
||||
type: string |
||||
apiVersion: string |
||||
name: string |
||||
} |
||||
|
||||
// AbsoluteTimeRange is a time range specified by absolute timestamps. |
||||
#AbsoluteTimeRange: { |
||||
from: number |
||||
to: number |
||||
} |
||||
|
||||
// spec is the schema of our resource. The spec should include all the user-ediable information for the kind. |
||||
spec: #InvestigationSpec |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,9 +0,0 @@ |
||||
package investigation |
||||
|
||||
manifest: { |
||||
appName: "investigation" |
||||
groupOverride: "investigation.grafana.app" |
||||
kinds: [ |
||||
investigation, |
||||
] |
||||
} |
@ -1,136 +0,0 @@ |
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
package v1alpha1 |
||||
|
||||
// AbsoluteTimeRange is a time range specified by absolute timestamps.
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationAbsoluteTimeRange struct { |
||||
From float64 `json:"from"` |
||||
To float64 `json:"to"` |
||||
} |
||||
|
||||
// NewInvestigationAbsoluteTimeRange creates a new InvestigationAbsoluteTimeRange object.
|
||||
func NewInvestigationAbsoluteTimeRange() *InvestigationAbsoluteTimeRange { |
||||
return &InvestigationAbsoluteTimeRange{} |
||||
} |
||||
|
||||
// Comment is a comment on an investigation item.
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationComment struct { |
||||
AuthorUserID string `json:"authorUserID"` |
||||
BodyMarkdown string `json:"bodyMarkdown"` |
||||
} |
||||
|
||||
// NewInvestigationComment creates a new InvestigationComment object.
|
||||
func NewInvestigationComment() *InvestigationComment { |
||||
return &InvestigationComment{} |
||||
} |
||||
|
||||
// DatasourceRef is a reference to a datasource.
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationDatasourceRef struct { |
||||
Uid string `json:"uid"` |
||||
Type string `json:"type"` |
||||
ApiVersion string `json:"apiVersion"` |
||||
Name string `json:"name"` |
||||
} |
||||
|
||||
// NewInvestigationDatasourceRef creates a new InvestigationDatasourceRef object.
|
||||
func NewInvestigationDatasourceRef() *InvestigationDatasourceRef { |
||||
return &InvestigationDatasourceRef{} |
||||
} |
||||
|
||||
// DataQueryLogs is a data query for logs.
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationDataQueryLogs struct { |
||||
// refId is the reference ID of the query.
|
||||
RefId string `json:"refId"` |
||||
// datasource is the datasource of the query.
|
||||
Datasource InvestigationDatasourceRef `json:"datasource"` |
||||
// expr is the expression of the query.
|
||||
Expr string `json:"expr"` |
||||
// maxLines (optional) is used to limit the number of log rows returned.
|
||||
MaxLines *int64 `json:"maxLines,omitempty"` |
||||
} |
||||
|
||||
// NewInvestigationDataQueryLogs creates a new InvestigationDataQueryLogs object.
|
||||
func NewInvestigationDataQueryLogs() *InvestigationDataQueryLogs { |
||||
return &InvestigationDataQueryLogs{ |
||||
Datasource: *NewInvestigationDatasourceRef(), |
||||
} |
||||
} |
||||
|
||||
// DataQueryMetrics is a data query for metrics.
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationDataQueryMetrics struct { |
||||
RefId string `json:"refId"` |
||||
Datasource InvestigationDatasourceRef `json:"datasource"` |
||||
Expr string `json:"expr"` |
||||
} |
||||
|
||||
// NewInvestigationDataQueryMetrics creates a new InvestigationDataQueryMetrics object.
|
||||
func NewInvestigationDataQueryMetrics() *InvestigationDataQueryMetrics { |
||||
return &InvestigationDataQueryMetrics{ |
||||
Datasource: *NewInvestigationDatasourceRef(), |
||||
} |
||||
} |
||||
|
||||
// InvestigationItem is an item in an investigation.
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationInvestigationItem struct { |
||||
Id string `json:"id"` |
||||
Title string `json:"title"` |
||||
// type is the type of the item "timeseries", "heatmap", "log-table" (not an enum to allow for future extensions).
|
||||
Type string `json:"type"` |
||||
// url is the URL to the item.
|
||||
Url string `json:"url"` |
||||
// origin is where the item was created from.
|
||||
// "explore-metrics", "explore-logs", "explore-traces" (not an enum to allow for future extensions)
|
||||
Origin string `json:"origin"` |
||||
// iconPath (optional) is the path to the icon for the item.
|
||||
IconPath *string `json:"iconPath,omitempty"` |
||||
// timeRange (optional) is the time range of the item.
|
||||
TimeRange InvestigationAbsoluteTimeRange `json:"timeRange"` |
||||
// note (optional) is a comment on the item.
|
||||
Note []InvestigationComment `json:"note,omitempty"` |
||||
// queryType is the type of the query used to generate this item.
|
||||
QueryType InvestigationInvestigationItemQueryType `json:"queryType"` |
||||
// dataQuery contains the query used to generate this item.
|
||||
DataQuery interface{} `json:"dataQuery"` |
||||
} |
||||
|
||||
// NewInvestigationInvestigationItem creates a new InvestigationInvestigationItem object.
|
||||
func NewInvestigationInvestigationItem() *InvestigationInvestigationItem { |
||||
return &InvestigationInvestigationItem{ |
||||
TimeRange: *NewInvestigationAbsoluteTimeRange(), |
||||
} |
||||
} |
||||
|
||||
// spec is the schema of our resource. The spec should include all the user-ediable information for the kind.
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationSpec struct { |
||||
Title string `json:"title"` |
||||
Status InvestigationSpecStatus `json:"status"` |
||||
Items []InvestigationInvestigationItem `json:"items"` |
||||
} |
||||
|
||||
// NewInvestigationSpec creates a new InvestigationSpec object.
|
||||
func NewInvestigationSpec() *InvestigationSpec { |
||||
return &InvestigationSpec{} |
||||
} |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationInvestigationItemQueryType string |
||||
|
||||
const ( |
||||
InvestigationInvestigationItemQueryTypeLogs InvestigationInvestigationItemQueryType = "logs" |
||||
InvestigationInvestigationItemQueryTypeMetrics InvestigationInvestigationItemQueryType = "metrics" |
||||
) |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationSpecStatus string |
||||
|
||||
const ( |
||||
InvestigationSpecStatusOpen InvestigationSpecStatus = "open" |
||||
InvestigationSpecStatusClosed InvestigationSpecStatus = "closed" |
||||
) |
@ -1,537 +0,0 @@ |
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
|
||||
package v1alpha1 |
||||
|
||||
import ( |
||||
common "k8s.io/kube-openapi/pkg/common" |
||||
spec "k8s.io/kube-openapi/pkg/validation/spec" |
||||
) |
||||
|
||||
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { |
||||
return map[string]common.OpenAPIDefinition{ |
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.Investigation": schema_pkg_apis_investigation_v1alpha1_Investigation(ref), |
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationAbsoluteTimeRange": schema_pkg_apis_investigation_v1alpha1_InvestigationAbsoluteTimeRange(ref), |
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationComment": schema_pkg_apis_investigation_v1alpha1_InvestigationComment(ref), |
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationDataQueryLogs": schema_pkg_apis_investigation_v1alpha1_InvestigationDataQueryLogs(ref), |
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationDataQueryMetrics": schema_pkg_apis_investigation_v1alpha1_InvestigationDataQueryMetrics(ref), |
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationDatasourceRef": schema_pkg_apis_investigation_v1alpha1_InvestigationDatasourceRef(ref), |
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationInvestigationItem": schema_pkg_apis_investigation_v1alpha1_InvestigationInvestigationItem(ref), |
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationList": schema_pkg_apis_investigation_v1alpha1_InvestigationList(ref), |
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationSpec": schema_pkg_apis_investigation_v1alpha1_InvestigationSpec(ref), |
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationStatus": schema_pkg_apis_investigation_v1alpha1_InvestigationStatus(ref), |
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationstatusOperatorState": schema_pkg_apis_investigation_v1alpha1_InvestigationstatusOperatorState(ref), |
||||
} |
||||
} |
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_Investigation(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"kind": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"apiVersion": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"metadata": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), |
||||
}, |
||||
}, |
||||
"spec": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationSpec"), |
||||
}, |
||||
}, |
||||
"status": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationStatus"), |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"metadata", "spec", "status"}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationSpec", "github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, |
||||
} |
||||
} |
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_InvestigationAbsoluteTimeRange(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "AbsoluteTimeRange is a time range specified by absolute timestamps.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"from": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: 0, |
||||
Type: []string{"number"}, |
||||
Format: "double", |
||||
}, |
||||
}, |
||||
"to": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: 0, |
||||
Type: []string{"number"}, |
||||
Format: "double", |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"from", "to"}, |
||||
}, |
||||
}, |
||||
} |
||||
} |
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_InvestigationComment(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Comment is a comment on an investigation item.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"authorUserID": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"bodyMarkdown": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"authorUserID", "bodyMarkdown"}, |
||||
}, |
||||
}, |
||||
} |
||||
} |
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_InvestigationDataQueryLogs(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "DataQueryLogs is a data query for logs.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"refId": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "refId is the reference ID of the query.", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"datasource": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "datasource is the datasource of the query.", |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationDatasourceRef"), |
||||
}, |
||||
}, |
||||
"expr": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "expr is the expression of the query.", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"maxLines": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "maxLines (optional) is used to limit the number of log rows returned.", |
||||
Type: []string{"integer"}, |
||||
Format: "int64", |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"refId", "datasource", "expr"}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationDatasourceRef"}, |
||||
} |
||||
} |
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_InvestigationDataQueryMetrics(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "DataQueryMetrics is a data query for metrics.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"refId": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"datasource": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationDatasourceRef"), |
||||
}, |
||||
}, |
||||
"expr": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"refId", "datasource", "expr"}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationDatasourceRef"}, |
||||
} |
||||
} |
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_InvestigationDatasourceRef(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "DatasourceRef is a reference to a datasource.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"uid": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"type": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"apiVersion": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"name": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"uid", "type", "apiVersion", "name"}, |
||||
}, |
||||
}, |
||||
} |
||||
} |
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_InvestigationInvestigationItem(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "InvestigationItem is an item in an investigation.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"id": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"title": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"type": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "type is the type of the item \"timeseries\", \"heatmap\", \"log-table\" (not an enum to allow for future extensions).", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"url": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "url is the URL to the item.", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"origin": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "origin is where the item was created from. \"explore-metrics\", \"explore-logs\", \"explore-traces\" (not an enum to allow for future extensions)", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"iconPath": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "iconPath (optional) is the path to the icon for the item.", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"timeRange": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "timeRange (optional) is the time range of the item.", |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationAbsoluteTimeRange"), |
||||
}, |
||||
}, |
||||
"note": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "note (optional) is a comment on the item.", |
||||
Type: []string{"array"}, |
||||
Items: &spec.SchemaOrArray{ |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationComment"), |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"queryType": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "queryType is the type of the query used to generate this item.", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"dataQuery": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "dataQuery contains the query used to generate this item.", |
||||
Type: []string{"object"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"id", "title", "type", "url", "origin", "timeRange", "queryType", "dataQuery"}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationAbsoluteTimeRange", "github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationComment"}, |
||||
} |
||||
} |
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_InvestigationList(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"kind": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"apiVersion": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"metadata": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), |
||||
}, |
||||
}, |
||||
"items": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"array"}, |
||||
Items: &spec.SchemaOrArray{ |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.Investigation"), |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"metadata", "items"}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.Investigation", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, |
||||
} |
||||
} |
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_InvestigationSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "spec is the schema of our resource. The spec should include all the user-ediable information for the kind.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"title": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"status": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"items": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"array"}, |
||||
Items: &spec.SchemaOrArray{ |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationInvestigationItem"), |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"title", "status", "items"}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationInvestigationItem"}, |
||||
} |
||||
} |
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_InvestigationStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"operatorStates": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "operatorStates is a map of operator ID to operator state evaluations. Any operator which consumes this kind SHOULD add its state evaluation information to this field.", |
||||
Type: []string{"object"}, |
||||
AdditionalProperties: &spec.SchemaOrBool{ |
||||
Allows: true, |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationstatusOperatorState"), |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"additionalFields": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "additionalFields is reserved for future use", |
||||
Type: []string{"object"}, |
||||
AdditionalProperties: &spec.SchemaOrBool{ |
||||
Allows: true, |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1.InvestigationstatusOperatorState"}, |
||||
} |
||||
} |
||||
|
||||
func schema_pkg_apis_investigation_v1alpha1_InvestigationstatusOperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"lastEvaluation": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "lastEvaluation is the ResourceVersion last evaluated", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"state": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "state describes the state of the lastEvaluation. It is limited to three possible states for machine evaluation.", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"descriptiveState": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "descriptiveState is an optional more descriptive state field which has no requirements on format", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"details": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "details contains any extra information that is operator-specific", |
||||
Type: []string{"object"}, |
||||
AdditionalProperties: &spec.SchemaOrBool{ |
||||
Allows: true, |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"lastEvaluation", "state"}, |
||||
}, |
||||
}, |
||||
} |
||||
} |
@ -1,50 +0,0 @@ |
||||
//
|
||||
// This file is generated by grafana-app-sdk
|
||||
// DO NOT EDIT
|
||||
//
|
||||
|
||||
package apis |
||||
|
||||
import ( |
||||
"encoding/json" |
||||
|
||||
"github.com/grafana/grafana-app-sdk/app" |
||||
) |
||||
|
||||
var ( |
||||
rawSchemaInvestigationv1alpha1 = []byte(`{"spec":{"description":"spec is the schema of our resource. The spec should include all the user-ediable information for the kind.","properties":{"items":{"items":{"properties":{"dataQuery":{"description":"dataQuery contains the query used to generate this item.","oneOf":[{"allOf":[{"required":["refId","datasource","expr"]},{"not":{"anyOf":[{"required":["refId","datasource","expr"]}]}}]},{"allOf":[{"required":["refId","datasource","expr"]},{"not":{"anyOf":[{"required":["refId","datasource","expr"]}]}}]}],"properties":{"datasource":{"description":"datasource is the datasource of the query.","properties":{"apiVersion":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"uid":{"type":"string"}},"required":["uid","type","apiVersion","name"],"type":"object"},"expr":{"description":"expr is the expression of the query.","type":"string"},"maxLines":{"description":"maxLines (optional) is used to limit the number of log rows returned.","format":"int64","type":"integer"},"refId":{"description":"refId is the reference ID of the query.","type":"string"}},"type":"object"},"iconPath":{"description":"iconPath (optional) is the path to the icon for the item.","type":"string"},"id":{"type":"string"},"note":{"description":"note (optional) is a comment on the item.","items":{"properties":{"authorUserID":{"type":"string"},"bodyMarkdown":{"type":"string"}},"required":["authorUserID","bodyMarkdown"],"type":"object"},"type":"array"},"origin":{"description":"origin is where the item was created from.","type":"string"},"queryType":{"description":"queryType is the type of the query used to generate this item.","enum":["logs","metrics"],"type":"string"},"timeRange":{"description":"timeRange (optional) is the time range of the item.","properties":{"from":{"type":"number"},"to":{"type":"number"}},"required":["from","to"],"type":"object"},"title":{"type":"string"},"type":{"description":"type is the type of the item \"timeseries\", \"heatmap\", \"log-table\" (not an enum to allow for future extensions).","type":"string"},"url":{"description":"url is the URL to the item.","type":"string"}},"required":["id","title","type","url","origin","timeRange","queryType","dataQuery"],"type":"object"},"type":"array"},"status":{"enum":["open","closed"],"type":"string"},"title":{"type":"string"}},"required":["title","status","items"],"type":"object"},"status":{"properties":{"additionalFields":{"description":"additionalFields is reserved for future use","type":"object","x-kubernetes-preserve-unknown-fields":true},"operatorStates":{"additionalProperties":{"properties":{"descriptiveState":{"description":"descriptiveState is an optional more descriptive state field which has no requirements on format","type":"string"},"details":{"description":"details contains any extra information that is operator-specific","type":"object","x-kubernetes-preserve-unknown-fields":true},"lastEvaluation":{"description":"lastEvaluation is the ResourceVersion last evaluated","type":"string"},"state":{"description":"state describes the state of the lastEvaluation.\nIt is limited to three possible states for machine evaluation.","enum":["success","in_progress","failed"],"type":"string"}},"required":["lastEvaluation","state"],"type":"object"},"description":"operatorStates is a map of operator ID to operator state evaluations.\nAny operator which consumes this kind SHOULD add its state evaluation information to this field.","type":"object"}},"type":"object","x-kubernetes-preserve-unknown-fields":true}}`) |
||||
versionSchemaInvestigationv1alpha1 app.VersionSchema |
||||
_ = json.Unmarshal(rawSchemaInvestigationv1alpha1, &versionSchemaInvestigationv1alpha1) |
||||
) |
||||
|
||||
var appManifestData = app.ManifestData{ |
||||
AppName: "investigation", |
||||
Group: "investigation.grafana.app", |
||||
Kinds: []app.ManifestKind{ |
||||
{ |
||||
Kind: "Investigation", |
||||
Scope: "Namespaced", |
||||
Conversion: false, |
||||
Versions: []app.ManifestKindVersion{ |
||||
{ |
||||
Name: "v1alpha1", |
||||
Schema: &versionSchemaInvestigationv1alpha1, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
} |
||||
|
||||
func jsonToMap(j string) map[string]any { |
||||
m := make(map[string]any) |
||||
json.Unmarshal([]byte(j), &j) |
||||
return m |
||||
} |
||||
|
||||
func LocalManifest() app.Manifest { |
||||
return app.NewEmbeddedManifest(appManifestData) |
||||
} |
||||
|
||||
func RemoteManifest() app.Manifest { |
||||
return app.NewAPIServerManifest("investigation") |
||||
} |
@ -0,0 +1,152 @@ |
||||
[ |
||||
{ |
||||
"id": "896312ce-65b0-4b50-ade1-e7f04fa22c66", |
||||
"title": "Thursday morning investigation", |
||||
"hasCustomName": false, |
||||
"isFavorite": false, |
||||
"collectables": [ |
||||
{ |
||||
"origin": "Explore Logs", |
||||
"type": "timeseries", |
||||
"queries": [ |
||||
{ |
||||
"refId": "LABEL_BREAKDOWN_VALUES", |
||||
"queryType": "range", |
||||
"editorMode": "code", |
||||
"supportingQueryType": "grafana-lokiexplore-app", |
||||
"legendFormat": "{{detected_level}}", |
||||
"expr": "sum(count_over_time({service_name=\"web_app_1\"} | detected_level != \"\"[$__auto])) by (detected_level)" |
||||
} |
||||
], |
||||
"timeRange": { |
||||
"to": "2025-02-13T11:31:20.536Z", |
||||
"from": "2025-02-13T11:16:20.536Z", |
||||
"raw": { |
||||
"from": "now-15m", |
||||
"to": "now" |
||||
} |
||||
}, |
||||
"datasource": { |
||||
"uid": "fe9k7u07b1a0wc" |
||||
}, |
||||
"url": "http://localhost:3000/a/grafana-lokiexplore-app/explore/service/web_app_1/labels?patterns=%5B%5D&from=now-15m&to=now&var-ds=fe9k7u07b1a0wc&var-filters=service_name%7C%3D%7Cweb_app_1&var-fields=&var-levels=&var-metadata=&var-patterns=&var-lineFilterV2=&var-lineFilters=&urlColumns=%5B%5D&visualizationType=%22logs%22&displayedFields=%5B%5D&timezone=browser&var-all-fields=&var-labelBy=$__all", |
||||
"id": "LABEL_BREAKDOWN_VALUES_detected_level", |
||||
"title": "detected_level", |
||||
"logoPath": "public/plugins/grafana-lokiexplore-app/img/img/logo.svg", |
||||
"createdAt": "2025-02-13T11:31:23.637Z" |
||||
} |
||||
], |
||||
"createdAt": "2025-02-13T11:31:23.636Z", |
||||
"updatedAt": "2025-02-13T11:31:23.637Z", |
||||
"viewMode": { |
||||
"mode": "compact", |
||||
"showComments": true, |
||||
"showTooltips": false |
||||
} |
||||
}, |
||||
{ |
||||
"id": "e9cf1958-d0ed-46b7-b597-9052c7648656", |
||||
"title": "Thursday morning investigation", |
||||
"hasCustomName": false, |
||||
"isFavorite": false, |
||||
"collectables": [ |
||||
{ |
||||
"origin": "Explore Logs", |
||||
"type": "timeseries", |
||||
"queries": [ |
||||
{ |
||||
"refId": "LABEL_BREAKDOWN_VALUES", |
||||
"queryType": "range", |
||||
"editorMode": "code", |
||||
"supportingQueryType": "grafana-lokiexplore-app", |
||||
"legendFormat": "{{detected_level}}", |
||||
"expr": "sum(count_over_time({service_name=\"web_app_1\"} | detected_level != \"\"[$__auto])) by (detected_level)" |
||||
} |
||||
], |
||||
"timeRange": { |
||||
"to": "2025-02-13T11:31:20.536Z", |
||||
"from": "2025-02-13T11:16:20.536Z", |
||||
"raw": { |
||||
"from": "now-15m", |
||||
"to": "now" |
||||
} |
||||
}, |
||||
"datasource": { |
||||
"uid": "fe9k7u07b1a0wc" |
||||
}, |
||||
"url": "http://localhost:3000/a/grafana-lokiexplore-app/explore/service/web_app_1/labels?patterns=%5B%5D&from=now-15m&to=now&var-ds=fe9k7u07b1a0wc&var-filters=service_name%7C%3D%7Cweb_app_1&var-fields=&var-levels=&var-metadata=&var-patterns=&var-lineFilterV2=&var-lineFilters=&urlColumns=%5B%5D&visualizationType=%22logs%22&displayedFields=%5B%5D&timezone=browser&var-all-fields=&var-labelBy=$__all", |
||||
"id": "LABEL_BREAKDOWN_VALUES_detected_level", |
||||
"title": "detected_level", |
||||
"logoPath": "public/plugins/grafana-lokiexplore-app/img/img/logo.svg", |
||||
"createdAt": "2025-02-13T11:31:23.638Z" |
||||
}, |
||||
{ |
||||
"origin": "Explore Logs", |
||||
"type": "timeseries", |
||||
"queries": [ |
||||
{ |
||||
"refId": "LABEL_BREAKDOWN_VALUES", |
||||
"queryType": "range", |
||||
"editorMode": "code", |
||||
"supportingQueryType": "grafana-lokiexplore-app", |
||||
"legendFormat": "{{service_name}}", |
||||
"expr": "sum(count_over_time({service_name=\"web_app_1\",service_name != \"\"} [$__auto])) by (service_name)" |
||||
} |
||||
], |
||||
"timeRange": { |
||||
"to": "2025-02-13T11:31:20.536Z", |
||||
"from": "2025-02-13T11:16:20.536Z", |
||||
"raw": { |
||||
"from": "now-15m", |
||||
"to": "now" |
||||
} |
||||
}, |
||||
"datasource": { |
||||
"uid": "fe9k7u07b1a0wc" |
||||
}, |
||||
"url": "http://localhost:3000/a/grafana-lokiexplore-app/explore/service/web_app_1/labels?patterns=%5B%5D&from=now-15m&to=now&var-ds=fe9k7u07b1a0wc&var-filters=service_name%7C%3D%7Cweb_app_1&var-fields=&var-levels=&var-metadata=&var-patterns=&var-lineFilterV2=&var-lineFilters=&urlColumns=%5B%5D&visualizationType=%22logs%22&displayedFields=%5B%5D&timezone=browser&var-all-fields=&var-labelBy=$__all", |
||||
"id": "LABEL_BREAKDOWN_VALUES_service_name", |
||||
"title": "service_name", |
||||
"logoPath": "public/plugins/grafana-lokiexplore-app/img/img/logo.svg", |
||||
"createdAt": "2025-02-13T11:31:41.507Z" |
||||
}, |
||||
{ |
||||
"origin": "Explore Logs", |
||||
"type": "timeseries", |
||||
"queries": [ |
||||
{ |
||||
"refId": "LABEL_BREAKDOWN_VALUES", |
||||
"queryType": "range", |
||||
"editorMode": "code", |
||||
"supportingQueryType": "grafana-lokiexplore-app", |
||||
"legendFormat": "{{service}}", |
||||
"expr": "sum(count_over_time({service_name=\"web_app_1\",service != \"\"} [$__auto])) by (service)" |
||||
} |
||||
], |
||||
"timeRange": { |
||||
"to": "2025-02-13T11:31:20.536Z", |
||||
"from": "2025-02-13T11:16:20.536Z", |
||||
"raw": { |
||||
"from": "now-15m", |
||||
"to": "now" |
||||
} |
||||
}, |
||||
"datasource": { |
||||
"uid": "fe9k7u07b1a0wc" |
||||
}, |
||||
"url": "http://localhost:3000/a/grafana-lokiexplore-app/explore/service/web_app_1/labels?patterns=%5B%5D&from=now-15m&to=now&var-ds=fe9k7u07b1a0wc&var-filters=service_name%7C%3D%7Cweb_app_1&var-fields=&var-levels=&var-metadata=&var-patterns=&var-lineFilterV2=&var-lineFilters=&urlColumns=%5B%5D&visualizationType=%22logs%22&displayedFields=%5B%5D&timezone=browser&var-all-fields=&var-labelBy=$__all", |
||||
"id": "LABEL_BREAKDOWN_VALUES_service", |
||||
"title": "service", |
||||
"logoPath": "public/plugins/grafana-lokiexplore-app/img/img/logo.svg", |
||||
"createdAt": "2025-02-13T11:31:43.698Z" |
||||
} |
||||
], |
||||
"createdAt": "2025-02-13T11:31:23.637Z", |
||||
"updatedAt": "2025-02-13T11:31:43.698Z", |
||||
"viewMode": { |
||||
"mode": "compact", |
||||
"showComments": true, |
||||
"showTooltips": false |
||||
} |
||||
} |
||||
] |
@ -1,4 +1,4 @@ |
||||
module github.com/grafana/grafana/apps/investigation |
||||
module github.com/grafana/grafana/apps/investigations |
||||
|
||||
go 1.23.4 |
||||
|
@ -0,0 +1,51 @@ |
||||
package investigations |
||||
|
||||
// Collectable represents an item collected during investigation |
||||
#Collectable: { |
||||
id: string |
||||
createdAt: string |
||||
|
||||
title: string |
||||
origin: string |
||||
type: string |
||||
queries: [...#Query] // +listType=atomic |
||||
timeRange: #TimeRange |
||||
datasource: #DatasourceRef |
||||
url: string |
||||
logoPath?: string |
||||
|
||||
note: string |
||||
noteUpdatedAt: string |
||||
} |
||||
|
||||
#CollectableSummary: { |
||||
id: string |
||||
title: string |
||||
logoPath: string |
||||
origin: string |
||||
} |
||||
|
||||
// Query represents a data query |
||||
#Query: { |
||||
refId: string |
||||
queryType: string |
||||
editorMode: string |
||||
supportingQueryType: string |
||||
legendFormat: string |
||||
expr: string |
||||
} |
||||
|
||||
// TimeRange represents a time range with both absolute and relative values |
||||
#TimeRange: { |
||||
from: string |
||||
to: string |
||||
raw: { |
||||
from: string |
||||
to: string |
||||
} |
||||
} |
||||
|
||||
// DatasourceRef is a reference to a datasource |
||||
#DatasourceRef: { |
||||
uid: string |
||||
} |
@ -0,0 +1 @@ |
||||
module: "github.com/grafana/grafana/apps/investigations" |
@ -0,0 +1,64 @@ |
||||
package investigations |
||||
|
||||
// This is our Investigation definition, which contains metadata about the kind, and the kind's schema |
||||
investigation: { |
||||
kind: "Investigation" |
||||
group: "investigations.grafana.app" |
||||
apiResource: { |
||||
groupOverride: "investigations.grafana.app" |
||||
} |
||||
pluralName: "Investigations" |
||||
current: "v0alpha1" |
||||
versions: { |
||||
"v0alpha1": { |
||||
codegen: { |
||||
frontend: true |
||||
backend: true |
||||
options: { |
||||
generateObjectMeta: true |
||||
generateClient: true |
||||
k8sLike: true |
||||
package: "github.com/grafana/grafana/apps/investigations" |
||||
} |
||||
} |
||||
schema: { |
||||
// spec is the schema of our resource |
||||
spec: { |
||||
title: string |
||||
createdByProfile: #Person |
||||
hasCustomName: bool |
||||
isFavorite: bool |
||||
overviewNote: string |
||||
overviewNoteUpdatedAt: string |
||||
collectables: [...#Collectable] // +listType=atomic |
||||
viewMode: #ViewMode |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
// Type definition for investigation summaries |
||||
#InvestigationSummary: { |
||||
title: string |
||||
createdByProfile: #Person |
||||
hasCustomName: bool |
||||
isFavorite: bool |
||||
overviewNote: string |
||||
overviewNoteUpdatedAt: string |
||||
viewMode: #ViewMode |
||||
collectableSummaries: [...#CollectableSummary] // +listType=atomic |
||||
} |
||||
|
||||
// Person represents a user profile with basic information |
||||
#Person: { |
||||
uid: string // Unique identifier for the user |
||||
name: string // Display name of the user |
||||
gravatarUrl: string // URL to user's Gravatar image |
||||
} |
||||
|
||||
#ViewMode: { |
||||
mode: "compact" | "full" |
||||
showComments: bool |
||||
showTooltips: bool |
||||
} |
@ -0,0 +1,37 @@ |
||||
package investigations |
||||
|
||||
investigationIndex: { |
||||
kind: "InvestigationIndex" |
||||
group: "investigations.grafana.app" |
||||
apiResource: { |
||||
groupOverride: "investigations.grafana.app" |
||||
} |
||||
pluralName: "InvestigationIndexes" |
||||
current: "v0alpha1" |
||||
versions: { |
||||
"v0alpha1": { |
||||
codegen: { |
||||
frontend: true |
||||
backend: true |
||||
options: { |
||||
generateObjectMeta: true |
||||
generateClient: true |
||||
k8sLike: true |
||||
package: "github.com/grafana/grafana/apps/investigations" |
||||
} |
||||
} |
||||
schema: { |
||||
spec: { |
||||
// Title of the index, e.g. 'Favorites' or 'My Investigations' |
||||
title: string |
||||
|
||||
// The Person who owns this investigation index |
||||
owner: #Person |
||||
|
||||
// Array of investigation summaries |
||||
investigationSummaries: [...#InvestigationSummary] // +listType=atomic |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,10 @@ |
||||
package investigations |
||||
|
||||
manifest: { |
||||
appName: "investigations" |
||||
groupOverride: "investigations.grafana.app" |
||||
kinds: [ |
||||
investigation, |
||||
investigationIndex, |
||||
] |
||||
} |
@ -1,12 +1,12 @@ |
||||
package v1alpha1 |
||||
package v0alpha1 |
||||
|
||||
import "k8s.io/apimachinery/pkg/runtime/schema" |
||||
|
||||
const ( |
||||
// Group is the API group used by all kinds in this package
|
||||
Group = "investigation.grafana.app" |
||||
Group = "investigations.grafana.app" |
||||
// Version is the API version used by all kinds in this package
|
||||
Version = "v1alpha1" |
||||
Version = "v0alpha1" |
||||
) |
||||
|
||||
var ( |
@ -1,6 +1,6 @@ |
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
package v1alpha1 |
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
time "time" |
@ -0,0 +1,140 @@ |
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
package v0alpha1 |
||||
|
||||
// Person represents a user profile with basic information
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationPerson struct { |
||||
// Unique identifier for the user
|
||||
Uid string `json:"uid"` |
||||
// Display name of the user
|
||||
Name string `json:"name"` |
||||
// URL to user's Gravatar image
|
||||
GravatarUrl string `json:"gravatarUrl"` |
||||
} |
||||
|
||||
// NewInvestigationPerson creates a new InvestigationPerson object.
|
||||
func NewInvestigationPerson() *InvestigationPerson { |
||||
return &InvestigationPerson{} |
||||
} |
||||
|
||||
// Collectable represents an item collected during investigation
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationCollectable struct { |
||||
Id string `json:"id"` |
||||
CreatedAt string `json:"createdAt"` |
||||
Title string `json:"title"` |
||||
Origin string `json:"origin"` |
||||
Type string `json:"type"` |
||||
// +listType=atomic
|
||||
Queries []InvestigationQuery `json:"queries"` |
||||
TimeRange InvestigationTimeRange `json:"timeRange"` |
||||
Datasource InvestigationDatasourceRef `json:"datasource"` |
||||
Url string `json:"url"` |
||||
LogoPath *string `json:"logoPath,omitempty"` |
||||
Note string `json:"note"` |
||||
NoteUpdatedAt string `json:"noteUpdatedAt"` |
||||
} |
||||
|
||||
// NewInvestigationCollectable creates a new InvestigationCollectable object.
|
||||
func NewInvestigationCollectable() *InvestigationCollectable { |
||||
return &InvestigationCollectable{ |
||||
TimeRange: *NewInvestigationTimeRange(), |
||||
Datasource: *NewInvestigationDatasourceRef(), |
||||
} |
||||
} |
||||
|
||||
// Query represents a data query
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationQuery struct { |
||||
RefId string `json:"refId"` |
||||
QueryType string `json:"queryType"` |
||||
EditorMode string `json:"editorMode"` |
||||
SupportingQueryType string `json:"supportingQueryType"` |
||||
LegendFormat string `json:"legendFormat"` |
||||
Expr string `json:"expr"` |
||||
} |
||||
|
||||
// NewInvestigationQuery creates a new InvestigationQuery object.
|
||||
func NewInvestigationQuery() *InvestigationQuery { |
||||
return &InvestigationQuery{} |
||||
} |
||||
|
||||
// TimeRange represents a time range with both absolute and relative values
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationTimeRange struct { |
||||
From string `json:"from"` |
||||
To string `json:"to"` |
||||
Raw InvestigationV0alpha1TimeRangeRaw `json:"raw"` |
||||
} |
||||
|
||||
// NewInvestigationTimeRange creates a new InvestigationTimeRange object.
|
||||
func NewInvestigationTimeRange() *InvestigationTimeRange { |
||||
return &InvestigationTimeRange{ |
||||
Raw: *NewInvestigationV0alpha1TimeRangeRaw(), |
||||
} |
||||
} |
||||
|
||||
// DatasourceRef is a reference to a datasource
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationDatasourceRef struct { |
||||
Uid string `json:"uid"` |
||||
} |
||||
|
||||
// NewInvestigationDatasourceRef creates a new InvestigationDatasourceRef object.
|
||||
func NewInvestigationDatasourceRef() *InvestigationDatasourceRef { |
||||
return &InvestigationDatasourceRef{} |
||||
} |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationViewMode struct { |
||||
Mode InvestigationViewModeMode `json:"mode"` |
||||
ShowComments bool `json:"showComments"` |
||||
ShowTooltips bool `json:"showTooltips"` |
||||
} |
||||
|
||||
// NewInvestigationViewMode creates a new InvestigationViewMode object.
|
||||
func NewInvestigationViewMode() *InvestigationViewMode { |
||||
return &InvestigationViewMode{} |
||||
} |
||||
|
||||
// spec is the schema of our resource
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationSpec struct { |
||||
Title string `json:"title"` |
||||
CreatedByProfile InvestigationPerson `json:"createdByProfile"` |
||||
HasCustomName bool `json:"hasCustomName"` |
||||
IsFavorite bool `json:"isFavorite"` |
||||
OverviewNote string `json:"overviewNote"` |
||||
OverviewNoteUpdatedAt string `json:"overviewNoteUpdatedAt"` |
||||
// +listType=atomic
|
||||
Collectables []InvestigationCollectable `json:"collectables"` |
||||
ViewMode InvestigationViewMode `json:"viewMode"` |
||||
} |
||||
|
||||
// NewInvestigationSpec creates a new InvestigationSpec object.
|
||||
func NewInvestigationSpec() *InvestigationSpec { |
||||
return &InvestigationSpec{ |
||||
CreatedByProfile: *NewInvestigationPerson(), |
||||
ViewMode: *NewInvestigationViewMode(), |
||||
} |
||||
} |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationV0alpha1TimeRangeRaw struct { |
||||
From string `json:"from"` |
||||
To string `json:"to"` |
||||
} |
||||
|
||||
// NewInvestigationV0alpha1TimeRangeRaw creates a new InvestigationV0alpha1TimeRangeRaw object.
|
||||
func NewInvestigationV0alpha1TimeRangeRaw() *InvestigationV0alpha1TimeRangeRaw { |
||||
return &InvestigationV0alpha1TimeRangeRaw{} |
||||
} |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationViewModeMode string |
||||
|
||||
const ( |
||||
InvestigationViewModeModeCompact InvestigationViewModeMode = "compact" |
||||
InvestigationViewModeModeFull InvestigationViewModeMode = "full" |
||||
) |
@ -1,6 +1,6 @@ |
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
package v1alpha1 |
||||
package v0alpha1 |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationstatusOperatorState struct { |
@ -0,0 +1,28 @@ |
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
"encoding/json" |
||||
"io" |
||||
|
||||
"github.com/grafana/grafana-app-sdk/resource" |
||||
) |
||||
|
||||
// InvestigationIndexJSONCodec is an implementation of resource.Codec for kubernetes JSON encoding
|
||||
type InvestigationIndexJSONCodec struct{} |
||||
|
||||
// Read reads JSON-encoded bytes from `reader` and unmarshals them into `into`
|
||||
func (*InvestigationIndexJSONCodec) Read(reader io.Reader, into resource.Object) error { |
||||
return json.NewDecoder(reader).Decode(into) |
||||
} |
||||
|
||||
// Write writes JSON-encoded bytes into `writer` marshaled from `from`
|
||||
func (*InvestigationIndexJSONCodec) Write(writer io.Writer, from resource.Object) error { |
||||
return json.NewEncoder(writer).Encode(from) |
||||
} |
||||
|
||||
// Interface compliance checks
|
||||
var _ resource.Codec = &InvestigationIndexJSONCodec{} |
@ -0,0 +1,28 @@ |
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
time "time" |
||||
) |
||||
|
||||
// metadata contains embedded CommonMetadata and can be extended with custom string fields
|
||||
// TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
|
||||
// without external reference as using the CommonMetadata reference breaks thema codegen.
|
||||
type InvestigationIndexMetadata struct { |
||||
UpdateTimestamp time.Time `json:"updateTimestamp"` |
||||
CreatedBy string `json:"createdBy"` |
||||
Uid string `json:"uid"` |
||||
CreationTimestamp time.Time `json:"creationTimestamp"` |
||||
DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"` |
||||
Finalizers []string `json:"finalizers"` |
||||
ResourceVersion string `json:"resourceVersion"` |
||||
Generation int64 `json:"generation"` |
||||
UpdatedBy string `json:"updatedBy"` |
||||
Labels map[string]string `json:"labels"` |
||||
} |
||||
|
||||
// NewInvestigationIndexMetadata creates a new InvestigationIndexMetadata object.
|
||||
func NewInvestigationIndexMetadata() *InvestigationIndexMetadata { |
||||
return &InvestigationIndexMetadata{} |
||||
} |
@ -0,0 +1,266 @@ |
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
"fmt" |
||||
"github.com/grafana/grafana-app-sdk/resource" |
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
||||
"k8s.io/apimachinery/pkg/runtime" |
||||
"k8s.io/apimachinery/pkg/runtime/schema" |
||||
"k8s.io/apimachinery/pkg/types" |
||||
"time" |
||||
) |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndex struct { |
||||
metav1.TypeMeta `json:",inline" yaml:",inline"` |
||||
metav1.ObjectMeta `json:"metadata" yaml:"metadata"` |
||||
Spec InvestigationIndexSpec `json:"spec" yaml:"spec"` |
||||
InvestigationIndexStatus InvestigationIndexStatus `json:"status" yaml:"status"` |
||||
} |
||||
|
||||
func (o *InvestigationIndex) GetSpec() any { |
||||
return o.Spec |
||||
} |
||||
|
||||
func (o *InvestigationIndex) SetSpec(spec any) error { |
||||
cast, ok := spec.(InvestigationIndexSpec) |
||||
if !ok { |
||||
return fmt.Errorf("cannot set spec type %#v, not of type Spec", spec) |
||||
} |
||||
o.Spec = cast |
||||
return nil |
||||
} |
||||
|
||||
func (o *InvestigationIndex) GetSubresources() map[string]any { |
||||
return map[string]any{ |
||||
"status": o.InvestigationIndexStatus, |
||||
} |
||||
} |
||||
|
||||
func (o *InvestigationIndex) GetSubresource(name string) (any, bool) { |
||||
switch name { |
||||
case "status": |
||||
return o.InvestigationIndexStatus, true |
||||
default: |
||||
return nil, false |
||||
} |
||||
} |
||||
|
||||
func (o *InvestigationIndex) SetSubresource(name string, value any) error { |
||||
switch name { |
||||
case "status": |
||||
cast, ok := value.(InvestigationIndexStatus) |
||||
if !ok { |
||||
return fmt.Errorf("cannot set status type %#v, not of type InvestigationIndexStatus", value) |
||||
} |
||||
o.InvestigationIndexStatus = cast |
||||
return nil |
||||
default: |
||||
return fmt.Errorf("subresource '%s' does not exist", name) |
||||
} |
||||
} |
||||
|
||||
func (o *InvestigationIndex) GetStaticMetadata() resource.StaticMetadata { |
||||
gvk := o.GroupVersionKind() |
||||
return resource.StaticMetadata{ |
||||
Name: o.ObjectMeta.Name, |
||||
Namespace: o.ObjectMeta.Namespace, |
||||
Group: gvk.Group, |
||||
Version: gvk.Version, |
||||
Kind: gvk.Kind, |
||||
} |
||||
} |
||||
|
||||
func (o *InvestigationIndex) SetStaticMetadata(metadata resource.StaticMetadata) { |
||||
o.Name = metadata.Name |
||||
o.Namespace = metadata.Namespace |
||||
o.SetGroupVersionKind(schema.GroupVersionKind{ |
||||
Group: metadata.Group, |
||||
Version: metadata.Version, |
||||
Kind: metadata.Kind, |
||||
}) |
||||
} |
||||
|
||||
func (o *InvestigationIndex) GetCommonMetadata() resource.CommonMetadata { |
||||
dt := o.DeletionTimestamp |
||||
var deletionTimestamp *time.Time |
||||
if dt != nil { |
||||
deletionTimestamp = &dt.Time |
||||
} |
||||
// Legacy ExtraFields support
|
||||
extraFields := make(map[string]any) |
||||
if o.Annotations != nil { |
||||
extraFields["annotations"] = o.Annotations |
||||
} |
||||
if o.ManagedFields != nil { |
||||
extraFields["managedFields"] = o.ManagedFields |
||||
} |
||||
if o.OwnerReferences != nil { |
||||
extraFields["ownerReferences"] = o.OwnerReferences |
||||
} |
||||
return resource.CommonMetadata{ |
||||
UID: string(o.UID), |
||||
ResourceVersion: o.ResourceVersion, |
||||
Generation: o.Generation, |
||||
Labels: o.Labels, |
||||
CreationTimestamp: o.CreationTimestamp.Time, |
||||
DeletionTimestamp: deletionTimestamp, |
||||
Finalizers: o.Finalizers, |
||||
UpdateTimestamp: o.GetUpdateTimestamp(), |
||||
CreatedBy: o.GetCreatedBy(), |
||||
UpdatedBy: o.GetUpdatedBy(), |
||||
ExtraFields: extraFields, |
||||
} |
||||
} |
||||
|
||||
func (o *InvestigationIndex) SetCommonMetadata(metadata resource.CommonMetadata) { |
||||
o.UID = types.UID(metadata.UID) |
||||
o.ResourceVersion = metadata.ResourceVersion |
||||
o.Generation = metadata.Generation |
||||
o.Labels = metadata.Labels |
||||
o.CreationTimestamp = metav1.NewTime(metadata.CreationTimestamp) |
||||
if metadata.DeletionTimestamp != nil { |
||||
dt := metav1.NewTime(*metadata.DeletionTimestamp) |
||||
o.DeletionTimestamp = &dt |
||||
} else { |
||||
o.DeletionTimestamp = nil |
||||
} |
||||
o.Finalizers = metadata.Finalizers |
||||
if o.Annotations == nil { |
||||
o.Annotations = make(map[string]string) |
||||
} |
||||
if !metadata.UpdateTimestamp.IsZero() { |
||||
o.SetUpdateTimestamp(metadata.UpdateTimestamp) |
||||
} |
||||
if metadata.CreatedBy != "" { |
||||
o.SetCreatedBy(metadata.CreatedBy) |
||||
} |
||||
if metadata.UpdatedBy != "" { |
||||
o.SetUpdatedBy(metadata.UpdatedBy) |
||||
} |
||||
// Legacy support for setting Annotations, ManagedFields, and OwnerReferences via ExtraFields
|
||||
if metadata.ExtraFields != nil { |
||||
if annotations, ok := metadata.ExtraFields["annotations"]; ok { |
||||
if cast, ok := annotations.(map[string]string); ok { |
||||
o.Annotations = cast |
||||
} |
||||
} |
||||
if managedFields, ok := metadata.ExtraFields["managedFields"]; ok { |
||||
if cast, ok := managedFields.([]metav1.ManagedFieldsEntry); ok { |
||||
o.ManagedFields = cast |
||||
} |
||||
} |
||||
if ownerReferences, ok := metadata.ExtraFields["ownerReferences"]; ok { |
||||
if cast, ok := ownerReferences.([]metav1.OwnerReference); ok { |
||||
o.OwnerReferences = cast |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
func (o *InvestigationIndex) GetCreatedBy() string { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
return o.ObjectMeta.Annotations["grafana.com/createdBy"] |
||||
} |
||||
|
||||
func (o *InvestigationIndex) SetCreatedBy(createdBy string) { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
o.ObjectMeta.Annotations["grafana.com/createdBy"] = createdBy |
||||
} |
||||
|
||||
func (o *InvestigationIndex) GetUpdateTimestamp() time.Time { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
parsed, _ := time.Parse(time.RFC3339, o.ObjectMeta.Annotations["grafana.com/updateTimestamp"]) |
||||
return parsed |
||||
} |
||||
|
||||
func (o *InvestigationIndex) SetUpdateTimestamp(updateTimestamp time.Time) { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
o.ObjectMeta.Annotations["grafana.com/updateTimestamp"] = updateTimestamp.Format(time.RFC3339) |
||||
} |
||||
|
||||
func (o *InvestigationIndex) GetUpdatedBy() string { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
return o.ObjectMeta.Annotations["grafana.com/updatedBy"] |
||||
} |
||||
|
||||
func (o *InvestigationIndex) SetUpdatedBy(updatedBy string) { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
o.ObjectMeta.Annotations["grafana.com/updatedBy"] = updatedBy |
||||
} |
||||
|
||||
func (o *InvestigationIndex) Copy() resource.Object { |
||||
return resource.CopyObject(o) |
||||
} |
||||
|
||||
func (o *InvestigationIndex) DeepCopyObject() runtime.Object { |
||||
return o.Copy() |
||||
} |
||||
|
||||
// Interface compliance compile-time check
|
||||
var _ resource.Object = &InvestigationIndex{} |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndexList struct { |
||||
metav1.TypeMeta `json:",inline" yaml:",inline"` |
||||
metav1.ListMeta `json:"metadata" yaml:"metadata"` |
||||
Items []InvestigationIndex `json:"items" yaml:"items"` |
||||
} |
||||
|
||||
func (o *InvestigationIndexList) DeepCopyObject() runtime.Object { |
||||
return o.Copy() |
||||
} |
||||
|
||||
func (o *InvestigationIndexList) Copy() resource.ListObject { |
||||
cpy := &InvestigationIndexList{ |
||||
TypeMeta: o.TypeMeta, |
||||
Items: make([]InvestigationIndex, len(o.Items)), |
||||
} |
||||
o.ListMeta.DeepCopyInto(&cpy.ListMeta) |
||||
for i := 0; i < len(o.Items); i++ { |
||||
if item, ok := o.Items[i].Copy().(*InvestigationIndex); ok { |
||||
cpy.Items[i] = *item |
||||
} |
||||
} |
||||
return cpy |
||||
} |
||||
|
||||
func (o *InvestigationIndexList) GetItems() []resource.Object { |
||||
items := make([]resource.Object, len(o.Items)) |
||||
for i := 0; i < len(o.Items); i++ { |
||||
items[i] = &o.Items[i] |
||||
} |
||||
return items |
||||
} |
||||
|
||||
func (o *InvestigationIndexList) SetItems(items []resource.Object) { |
||||
o.Items = make([]InvestigationIndex, len(items)) |
||||
for i := 0; i < len(items); i++ { |
||||
o.Items[i] = *items[i].(*InvestigationIndex) |
||||
} |
||||
} |
||||
|
||||
// Interface compliance compile-time check
|
||||
var _ resource.ListObject = &InvestigationIndexList{} |
@ -0,0 +1,34 @@ |
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
"github.com/grafana/grafana-app-sdk/resource" |
||||
) |
||||
|
||||
// schema is unexported to prevent accidental overwrites
|
||||
var ( |
||||
schemaInvestigationIndex = resource.NewSimpleSchema("investigations.grafana.app", "v0alpha1", &InvestigationIndex{}, &InvestigationIndexList{}, resource.WithKind("InvestigationIndex"), |
||||
resource.WithPlural("investigationindexes"), resource.WithScope(resource.NamespacedScope)) |
||||
kindInvestigationIndex = resource.Kind{ |
||||
Schema: schemaInvestigationIndex, |
||||
Codecs: map[resource.KindEncoding]resource.Codec{ |
||||
resource.KindEncodingJSON: &InvestigationIndexJSONCodec{}, |
||||
}, |
||||
} |
||||
) |
||||
|
||||
// Kind returns a resource.Kind for this Schema with a JSON codec
|
||||
func InvestigationIndexKind() resource.Kind { |
||||
return kindInvestigationIndex |
||||
} |
||||
|
||||
// Schema returns a resource.SimpleSchema representation of InvestigationIndex
|
||||
func InvestigationIndexSchema() *resource.SimpleSchema { |
||||
return schemaInvestigationIndex |
||||
} |
||||
|
||||
// Interface compliance checks
|
||||
var _ resource.Schema = kindInvestigationIndex |
@ -0,0 +1,92 @@ |
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
package v0alpha1 |
||||
|
||||
// Person represents a user profile with basic information
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndexPerson struct { |
||||
// Unique identifier for the user
|
||||
Uid string `json:"uid"` |
||||
// Display name of the user
|
||||
Name string `json:"name"` |
||||
// URL to user's Gravatar image
|
||||
GravatarUrl string `json:"gravatarUrl"` |
||||
} |
||||
|
||||
// NewInvestigationIndexPerson creates a new InvestigationIndexPerson object.
|
||||
func NewInvestigationIndexPerson() *InvestigationIndexPerson { |
||||
return &InvestigationIndexPerson{} |
||||
} |
||||
|
||||
// Type definition for investigation summaries
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndexInvestigationSummary struct { |
||||
Title string `json:"title"` |
||||
CreatedByProfile InvestigationIndexPerson `json:"createdByProfile"` |
||||
HasCustomName bool `json:"hasCustomName"` |
||||
IsFavorite bool `json:"isFavorite"` |
||||
OverviewNote string `json:"overviewNote"` |
||||
OverviewNoteUpdatedAt string `json:"overviewNoteUpdatedAt"` |
||||
ViewMode InvestigationIndexViewMode `json:"viewMode"` |
||||
// +listType=atomic
|
||||
CollectableSummaries []InvestigationIndexCollectableSummary `json:"collectableSummaries"` |
||||
} |
||||
|
||||
// NewInvestigationIndexInvestigationSummary creates a new InvestigationIndexInvestigationSummary object.
|
||||
func NewInvestigationIndexInvestigationSummary() *InvestigationIndexInvestigationSummary { |
||||
return &InvestigationIndexInvestigationSummary{ |
||||
CreatedByProfile: *NewInvestigationIndexPerson(), |
||||
ViewMode: *NewInvestigationIndexViewMode(), |
||||
} |
||||
} |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndexViewMode struct { |
||||
Mode InvestigationIndexViewModeMode `json:"mode"` |
||||
ShowComments bool `json:"showComments"` |
||||
ShowTooltips bool `json:"showTooltips"` |
||||
} |
||||
|
||||
// NewInvestigationIndexViewMode creates a new InvestigationIndexViewMode object.
|
||||
func NewInvestigationIndexViewMode() *InvestigationIndexViewMode { |
||||
return &InvestigationIndexViewMode{} |
||||
} |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndexCollectableSummary struct { |
||||
Id string `json:"id"` |
||||
Title string `json:"title"` |
||||
LogoPath string `json:"logoPath"` |
||||
Origin string `json:"origin"` |
||||
} |
||||
|
||||
// NewInvestigationIndexCollectableSummary creates a new InvestigationIndexCollectableSummary object.
|
||||
func NewInvestigationIndexCollectableSummary() *InvestigationIndexCollectableSummary { |
||||
return &InvestigationIndexCollectableSummary{} |
||||
} |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndexSpec struct { |
||||
// Title of the index, e.g. 'Favorites' or 'My Investigations'
|
||||
Title string `json:"title"` |
||||
// The Person who owns this investigation index
|
||||
Owner InvestigationIndexPerson `json:"owner"` |
||||
// Array of investigation summaries
|
||||
// +listType=atomic
|
||||
InvestigationSummaries []InvestigationIndexInvestigationSummary `json:"investigationSummaries"` |
||||
} |
||||
|
||||
// NewInvestigationIndexSpec creates a new InvestigationIndexSpec object.
|
||||
func NewInvestigationIndexSpec() *InvestigationIndexSpec { |
||||
return &InvestigationIndexSpec{ |
||||
Owner: *NewInvestigationIndexPerson(), |
||||
} |
||||
} |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndexViewModeMode string |
||||
|
||||
const ( |
||||
InvestigationIndexViewModeModeCompact InvestigationIndexViewModeMode = "compact" |
||||
InvestigationIndexViewModeModeFull InvestigationIndexViewModeMode = "full" |
||||
) |
@ -0,0 +1,44 @@ |
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
package v0alpha1 |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndexstatusOperatorState struct { |
||||
// lastEvaluation is the ResourceVersion last evaluated
|
||||
LastEvaluation string `json:"lastEvaluation"` |
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
State InvestigationIndexStatusOperatorStateState `json:"state"` |
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
DescriptiveState *string `json:"descriptiveState,omitempty"` |
||||
// details contains any extra information that is operator-specific
|
||||
Details map[string]interface{} `json:"details,omitempty"` |
||||
} |
||||
|
||||
// NewInvestigationIndexstatusOperatorState creates a new InvestigationIndexstatusOperatorState object.
|
||||
func NewInvestigationIndexstatusOperatorState() *InvestigationIndexstatusOperatorState { |
||||
return &InvestigationIndexstatusOperatorState{} |
||||
} |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndexStatus struct { |
||||
// operatorStates is a map of operator ID to operator state evaluations.
|
||||
// Any operator which consumes this kind SHOULD add its state evaluation information to this field.
|
||||
OperatorStates map[string]InvestigationIndexstatusOperatorState `json:"operatorStates,omitempty"` |
||||
// additionalFields is reserved for future use
|
||||
AdditionalFields map[string]interface{} `json:"additionalFields,omitempty"` |
||||
} |
||||
|
||||
// NewInvestigationIndexStatus creates a new InvestigationIndexStatus object.
|
||||
func NewInvestigationIndexStatus() *InvestigationIndexStatus { |
||||
return &InvestigationIndexStatus{} |
||||
} |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type InvestigationIndexStatusOperatorStateState string |
||||
|
||||
const ( |
||||
InvestigationIndexStatusOperatorStateStateSuccess InvestigationIndexStatusOperatorStateState = "success" |
||||
InvestigationIndexStatusOperatorStateStateInProgress InvestigationIndexStatusOperatorStateState = "in_progress" |
||||
InvestigationIndexStatusOperatorStateStateFailed InvestigationIndexStatusOperatorStateState = "failed" |
||||
) |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,65 @@ |
||||
//
|
||||
// This file is generated by grafana-app-sdk
|
||||
// DO NOT EDIT
|
||||
//
|
||||
|
||||
package apis |
||||
|
||||
import ( |
||||
"encoding/json" |
||||
|
||||
"github.com/grafana/grafana-app-sdk/app" |
||||
) |
||||
|
||||
var ( |
||||
rawSchemaInvestigationv0alpha1 = []byte(`{"spec":{"description":"spec is the schema of our resource","properties":{"collectables":{"items":{"properties":{"createdAt":{"type":"string"},"datasource":{"properties":{"uid":{"type":"string"}},"required":["uid"],"type":"object"},"id":{"type":"string"},"logoPath":{"type":"string"},"note":{"type":"string"},"noteUpdatedAt":{"type":"string"},"origin":{"type":"string"},"queries":{"items":{"properties":{"editorMode":{"type":"string"},"expr":{"type":"string"},"legendFormat":{"type":"string"},"queryType":{"type":"string"},"refId":{"type":"string"},"supportingQueryType":{"type":"string"}},"required":["refId","queryType","editorMode","supportingQueryType","legendFormat","expr"],"type":"object"},"type":"array"},"timeRange":{"properties":{"from":{"type":"string"},"raw":{"properties":{"from":{"type":"string"},"to":{"type":"string"}},"required":["from","to"],"type":"object"},"to":{"type":"string"}},"required":["from","to","raw"],"type":"object"},"title":{"type":"string"},"type":{"type":"string"},"url":{"type":"string"}},"required":["id","createdAt","title","origin","type","queries","timeRange","datasource","url","note","noteUpdatedAt"],"type":"object"},"type":"array"},"createdByProfile":{"properties":{"gravatarUrl":{"type":"string"},"name":{"type":"string"},"uid":{"type":"string"}},"required":["uid","name","gravatarUrl"],"type":"object"},"hasCustomName":{"type":"boolean"},"isFavorite":{"type":"boolean"},"overviewNote":{"type":"string"},"overviewNoteUpdatedAt":{"type":"string"},"title":{"type":"string"},"viewMode":{"properties":{"mode":{"enum":["compact","full"],"type":"string"},"showComments":{"type":"boolean"},"showTooltips":{"type":"boolean"}},"required":["mode","showComments","showTooltips"],"type":"object"}},"required":["title","createdByProfile","hasCustomName","isFavorite","overviewNote","overviewNoteUpdatedAt","collectables","viewMode"],"type":"object"},"status":{"properties":{"additionalFields":{"description":"additionalFields is reserved for future use","type":"object","x-kubernetes-preserve-unknown-fields":true},"operatorStates":{"additionalProperties":{"properties":{"descriptiveState":{"description":"descriptiveState is an optional more descriptive state field which has no requirements on format","type":"string"},"details":{"description":"details contains any extra information that is operator-specific","type":"object","x-kubernetes-preserve-unknown-fields":true},"lastEvaluation":{"description":"lastEvaluation is the ResourceVersion last evaluated","type":"string"},"state":{"description":"state describes the state of the lastEvaluation.\nIt is limited to three possible states for machine evaluation.","enum":["success","in_progress","failed"],"type":"string"}},"required":["lastEvaluation","state"],"type":"object"},"description":"operatorStates is a map of operator ID to operator state evaluations.\nAny operator which consumes this kind SHOULD add its state evaluation information to this field.","type":"object"}},"type":"object","x-kubernetes-preserve-unknown-fields":true}}`) |
||||
versionSchemaInvestigationv0alpha1 app.VersionSchema |
||||
_ = json.Unmarshal(rawSchemaInvestigationv0alpha1, &versionSchemaInvestigationv0alpha1) |
||||
rawSchemaInvestigationIndexv0alpha1 = []byte(`{"spec":{"properties":{"investigationSummaries":{"description":"Array of investigation summaries","items":{"properties":{"collectableSummaries":{"items":{"properties":{"id":{"type":"string"},"logoPath":{"type":"string"},"origin":{"type":"string"},"title":{"type":"string"}},"required":["id","title","logoPath","origin"],"type":"object"},"type":"array"},"createdByProfile":{"properties":{"gravatarUrl":{"type":"string"},"name":{"type":"string"},"uid":{"type":"string"}},"required":["uid","name","gravatarUrl"],"type":"object"},"hasCustomName":{"type":"boolean"},"isFavorite":{"type":"boolean"},"overviewNote":{"type":"string"},"overviewNoteUpdatedAt":{"type":"string"},"title":{"type":"string"},"viewMode":{"properties":{"mode":{"enum":["compact","full"],"type":"string"},"showComments":{"type":"boolean"},"showTooltips":{"type":"boolean"}},"required":["mode","showComments","showTooltips"],"type":"object"}},"required":["title","createdByProfile","hasCustomName","isFavorite","overviewNote","overviewNoteUpdatedAt","viewMode","collectableSummaries"],"type":"object"},"type":"array"},"owner":{"description":"The Person who owns this investigation index","properties":{"gravatarUrl":{"type":"string"},"name":{"type":"string"},"uid":{"type":"string"}},"required":["uid","name","gravatarUrl"],"type":"object"},"title":{"description":"Title of the index, e.g. 'Favorites' or 'My Investigations'","type":"string"}},"required":["title","owner","investigationSummaries"],"type":"object"},"status":{"properties":{"additionalFields":{"description":"additionalFields is reserved for future use","type":"object","x-kubernetes-preserve-unknown-fields":true},"operatorStates":{"additionalProperties":{"properties":{"descriptiveState":{"description":"descriptiveState is an optional more descriptive state field which has no requirements on format","type":"string"},"details":{"description":"details contains any extra information that is operator-specific","type":"object","x-kubernetes-preserve-unknown-fields":true},"lastEvaluation":{"description":"lastEvaluation is the ResourceVersion last evaluated","type":"string"},"state":{"description":"state describes the state of the lastEvaluation.\nIt is limited to three possible states for machine evaluation.","enum":["success","in_progress","failed"],"type":"string"}},"required":["lastEvaluation","state"],"type":"object"},"description":"operatorStates is a map of operator ID to operator state evaluations.\nAny operator which consumes this kind SHOULD add its state evaluation information to this field.","type":"object"}},"type":"object","x-kubernetes-preserve-unknown-fields":true}}`) |
||||
versionSchemaInvestigationIndexv0alpha1 app.VersionSchema |
||||
_ = json.Unmarshal(rawSchemaInvestigationIndexv0alpha1, &versionSchemaInvestigationIndexv0alpha1) |
||||
) |
||||
|
||||
var appManifestData = app.ManifestData{ |
||||
AppName: "investigations", |
||||
Group: "investigations.grafana.app", |
||||
Kinds: []app.ManifestKind{ |
||||
{ |
||||
Kind: "Investigation", |
||||
Scope: "Namespaced", |
||||
Conversion: false, |
||||
Versions: []app.ManifestKindVersion{ |
||||
{ |
||||
Name: "v0alpha1", |
||||
Schema: &versionSchemaInvestigationv0alpha1, |
||||
}, |
||||
}, |
||||
}, |
||||
|
||||
{ |
||||
Kind: "InvestigationIndex", |
||||
Scope: "Namespaced", |
||||
Conversion: false, |
||||
Versions: []app.ManifestKindVersion{ |
||||
{ |
||||
Name: "v0alpha1", |
||||
Schema: &versionSchemaInvestigationIndexv0alpha1, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
} |
||||
|
||||
func jsonToMap(j string) map[string]any { |
||||
m := make(map[string]any) |
||||
json.Unmarshal([]byte(j), &j) |
||||
return m |
||||
} |
||||
|
||||
func LocalManifest() app.Manifest { |
||||
return app.NewEmbeddedManifest(appManifestData) |
||||
} |
||||
|
||||
func RemoteManifest() app.Manifest { |
||||
return app.NewAPIServerManifest("investigations") |
||||
} |
@ -0,0 +1,49 @@ |
||||
/* |
||||
* This file was generated by grafana-app-sdk. DO NOT EDIT. |
||||
*/ |
||||
import { Spec } from './types.spec.gen'; |
||||
import { Status } from './types.status.gen'; |
||||
|
||||
export interface Metadata { |
||||
name: string; |
||||
namespace: string; |
||||
generateName?: string; |
||||
selfLink?: string; |
||||
uid?: string; |
||||
resourceVersion?: string; |
||||
generation?: number; |
||||
creationTimestamp?: string; |
||||
deletionTimestamp?: string; |
||||
deletionGracePeriodSeconds?: number; |
||||
labels?: Record<string, string>; |
||||
annotations?: Record<string, string>; |
||||
ownerReferences?: OwnerReference[]; |
||||
finalizers?: string[]; |
||||
managedFields?: ManagedFieldsEntry[]; |
||||
} |
||||
|
||||
export interface OwnerReference { |
||||
apiVersion: string; |
||||
kind: string; |
||||
name: string; |
||||
uid: string; |
||||
controller?: boolean; |
||||
blockOwnerDeletion?: boolean; |
||||
} |
||||
|
||||
export interface ManagedFieldsEntry { |
||||
manager?: string; |
||||
operation?: string; |
||||
apiVersion?: string; |
||||
time?: string; |
||||
fieldsType?: string; |
||||
subresource?: string; |
||||
} |
||||
|
||||
export interface Investigation { |
||||
kind: string; |
||||
apiVersion: string; |
||||
metadata: Metadata; |
||||
spec: Spec; |
||||
status: Status; |
||||
} |
@ -0,0 +1,30 @@ |
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
// metadata contains embedded CommonMetadata and can be extended with custom string fields
|
||||
// TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
|
||||
// without external reference as using the CommonMetadata reference breaks thema codegen.
|
||||
export interface Metadata { |
||||
updateTimestamp: string; |
||||
createdBy: string; |
||||
uid: string; |
||||
creationTimestamp: string; |
||||
deletionTimestamp?: string; |
||||
finalizers: string[]; |
||||
resourceVersion: string; |
||||
generation: number; |
||||
updatedBy: string; |
||||
labels: Record<string, string>; |
||||
} |
||||
|
||||
export const defaultMetadata = (): Metadata => ({ |
||||
updateTimestamp: "", |
||||
createdBy: "", |
||||
uid: "", |
||||
creationTimestamp: "", |
||||
finalizers: [], |
||||
resourceVersion: "", |
||||
generation: 0, |
||||
updatedBy: "", |
||||
labels: {}, |
||||
}); |
||||
|
@ -0,0 +1,132 @@ |
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
// Person represents a user profile with basic information
|
||||
export interface Person { |
||||
// Unique identifier for the user
|
||||
uid: string; |
||||
// Display name of the user
|
||||
name: string; |
||||
// URL to user's Gravatar image
|
||||
gravatarUrl: string; |
||||
} |
||||
|
||||
export const defaultPerson = (): Person => ({ |
||||
uid: "", |
||||
name: "", |
||||
gravatarUrl: "", |
||||
}); |
||||
|
||||
// Collectable represents an item collected during investigation
|
||||
export interface Collectable { |
||||
id: string; |
||||
createdAt: string; |
||||
title: string; |
||||
origin: string; |
||||
type: string; |
||||
// +listType=atomic
|
||||
queries: Query[]; |
||||
timeRange: TimeRange; |
||||
datasource: DatasourceRef; |
||||
url: string; |
||||
logoPath?: string; |
||||
note: string; |
||||
noteUpdatedAt: string; |
||||
} |
||||
|
||||
export const defaultCollectable = (): Collectable => ({ |
||||
id: "", |
||||
createdAt: "", |
||||
title: "", |
||||
origin: "", |
||||
type: "", |
||||
queries: [], |
||||
timeRange: defaultTimeRange(), |
||||
datasource: defaultDatasourceRef(), |
||||
url: "", |
||||
note: "", |
||||
noteUpdatedAt: "", |
||||
}); |
||||
|
||||
// Query represents a data query
|
||||
export interface Query { |
||||
refId: string; |
||||
queryType: string; |
||||
editorMode: string; |
||||
supportingQueryType: string; |
||||
legendFormat: string; |
||||
expr: string; |
||||
} |
||||
|
||||
export const defaultQuery = (): Query => ({ |
||||
refId: "", |
||||
queryType: "", |
||||
editorMode: "", |
||||
supportingQueryType: "", |
||||
legendFormat: "", |
||||
expr: "", |
||||
}); |
||||
|
||||
// TimeRange represents a time range with both absolute and relative values
|
||||
export interface TimeRange { |
||||
from: string; |
||||
to: string; |
||||
raw: { |
||||
from: string; |
||||
to: string; |
||||
}; |
||||
} |
||||
|
||||
export const defaultTimeRange = (): TimeRange => ({ |
||||
from: "", |
||||
to: "", |
||||
raw: { |
||||
from: "", |
||||
to: "", |
||||
}, |
||||
}); |
||||
|
||||
// DatasourceRef is a reference to a datasource
|
||||
export interface DatasourceRef { |
||||
uid: string; |
||||
} |
||||
|
||||
export const defaultDatasourceRef = (): DatasourceRef => ({ |
||||
uid: "", |
||||
}); |
||||
|
||||
export interface ViewMode { |
||||
mode: "compact" | "full"; |
||||
showComments: boolean; |
||||
showTooltips: boolean; |
||||
} |
||||
|
||||
export const defaultViewMode = (): ViewMode => ({ |
||||
mode: "compact", |
||||
showComments: false, |
||||
showTooltips: false, |
||||
}); |
||||
|
||||
// spec is the schema of our resource
|
||||
export interface Spec { |
||||
title: string; |
||||
createdByProfile: Person; |
||||
hasCustomName: boolean; |
||||
isFavorite: boolean; |
||||
overviewNote: string; |
||||
overviewNoteUpdatedAt: string; |
||||
// +listType=atomic
|
||||
collectables: Collectable[]; |
||||
viewMode: ViewMode; |
||||
} |
||||
|
||||
export const defaultSpec = (): Spec => ({ |
||||
title: "", |
||||
createdByProfile: defaultPerson(), |
||||
hasCustomName: false, |
||||
isFavorite: false, |
||||
overviewNote: "", |
||||
overviewNoteUpdatedAt: "", |
||||
collectables: [], |
||||
viewMode: defaultViewMode(), |
||||
}); |
||||
|
@ -0,0 +1,30 @@ |
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
export interface OperatorState { |
||||
// lastEvaluation is the ResourceVersion last evaluated
|
||||
lastEvaluation: string; |
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
state: "success" | "in_progress" | "failed"; |
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
descriptiveState?: string; |
||||
// details contains any extra information that is operator-specific
|
||||
details?: Record<string, any>; |
||||
} |
||||
|
||||
export const defaultOperatorState = (): OperatorState => ({ |
||||
lastEvaluation: "", |
||||
state: "success", |
||||
}); |
||||
|
||||
export interface Status { |
||||
// operatorStates is a map of operator ID to operator state evaluations.
|
||||
// Any operator which consumes this kind SHOULD add its state evaluation information to this field.
|
||||
operatorStates?: Record<string, OperatorState>; |
||||
// additionalFields is reserved for future use
|
||||
additionalFields?: Record<string, any>; |
||||
} |
||||
|
||||
export const defaultStatus = (): Status => ({ |
||||
}); |
||||
|
@ -0,0 +1,49 @@ |
||||
/* |
||||
* This file was generated by grafana-app-sdk. DO NOT EDIT. |
||||
*/ |
||||
import { Spec } from './types.spec.gen'; |
||||
import { Status } from './types.status.gen'; |
||||
|
||||
export interface Metadata { |
||||
name: string; |
||||
namespace: string; |
||||
generateName?: string; |
||||
selfLink?: string; |
||||
uid?: string; |
||||
resourceVersion?: string; |
||||
generation?: number; |
||||
creationTimestamp?: string; |
||||
deletionTimestamp?: string; |
||||
deletionGracePeriodSeconds?: number; |
||||
labels?: Record<string, string>; |
||||
annotations?: Record<string, string>; |
||||
ownerReferences?: OwnerReference[]; |
||||
finalizers?: string[]; |
||||
managedFields?: ManagedFieldsEntry[]; |
||||
} |
||||
|
||||
export interface OwnerReference { |
||||
apiVersion: string; |
||||
kind: string; |
||||
name: string; |
||||
uid: string; |
||||
controller?: boolean; |
||||
blockOwnerDeletion?: boolean; |
||||
} |
||||
|
||||
export interface ManagedFieldsEntry { |
||||
manager?: string; |
||||
operation?: string; |
||||
apiVersion?: string; |
||||
time?: string; |
||||
fieldsType?: string; |
||||
subresource?: string; |
||||
} |
||||
|
||||
export interface InvestigationIndex { |
||||
kind: string; |
||||
apiVersion: string; |
||||
metadata: Metadata; |
||||
spec: Spec; |
||||
status: Status; |
||||
} |
@ -0,0 +1,30 @@ |
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
// metadata contains embedded CommonMetadata and can be extended with custom string fields
|
||||
// TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
|
||||
// without external reference as using the CommonMetadata reference breaks thema codegen.
|
||||
export interface Metadata { |
||||
updateTimestamp: string; |
||||
createdBy: string; |
||||
uid: string; |
||||
creationTimestamp: string; |
||||
deletionTimestamp?: string; |
||||
finalizers: string[]; |
||||
resourceVersion: string; |
||||
generation: number; |
||||
updatedBy: string; |
||||
labels: Record<string, string>; |
||||
} |
||||
|
||||
export const defaultMetadata = (): Metadata => ({ |
||||
updateTimestamp: "", |
||||
createdBy: "", |
||||
uid: "", |
||||
creationTimestamp: "", |
||||
finalizers: [], |
||||
resourceVersion: "", |
||||
generation: 0, |
||||
updatedBy: "", |
||||
labels: {}, |
||||
}); |
||||
|
@ -0,0 +1,84 @@ |
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
// Person represents a user profile with basic information
|
||||
export interface Person { |
||||
// Unique identifier for the user
|
||||
uid: string; |
||||
// Display name of the user
|
||||
name: string; |
||||
// URL to user's Gravatar image
|
||||
gravatarUrl: string; |
||||
} |
||||
|
||||
export const defaultPerson = (): Person => ({ |
||||
uid: "", |
||||
name: "", |
||||
gravatarUrl: "", |
||||
}); |
||||
|
||||
// Type definition for investigation summaries
|
||||
export interface InvestigationSummary { |
||||
title: string; |
||||
createdByProfile: Person; |
||||
hasCustomName: boolean; |
||||
isFavorite: boolean; |
||||
overviewNote: string; |
||||
overviewNoteUpdatedAt: string; |
||||
viewMode: ViewMode; |
||||
// +listType=atomic
|
||||
collectableSummaries: CollectableSummary[]; |
||||
} |
||||
|
||||
export const defaultInvestigationSummary = (): InvestigationSummary => ({ |
||||
title: "", |
||||
createdByProfile: defaultPerson(), |
||||
hasCustomName: false, |
||||
isFavorite: false, |
||||
overviewNote: "", |
||||
overviewNoteUpdatedAt: "", |
||||
viewMode: defaultViewMode(), |
||||
collectableSummaries: [], |
||||
}); |
||||
|
||||
export interface ViewMode { |
||||
mode: "compact" | "full"; |
||||
showComments: boolean; |
||||
showTooltips: boolean; |
||||
} |
||||
|
||||
export const defaultViewMode = (): ViewMode => ({ |
||||
mode: "compact", |
||||
showComments: false, |
||||
showTooltips: false, |
||||
}); |
||||
|
||||
export interface CollectableSummary { |
||||
id: string; |
||||
title: string; |
||||
logoPath: string; |
||||
origin: string; |
||||
} |
||||
|
||||
export const defaultCollectableSummary = (): CollectableSummary => ({ |
||||
id: "", |
||||
title: "", |
||||
logoPath: "", |
||||
origin: "", |
||||
}); |
||||
|
||||
export interface Spec { |
||||
// Title of the index, e.g. 'Favorites' or 'My Investigations'
|
||||
title: string; |
||||
// The Person who owns this investigation index
|
||||
owner: Person; |
||||
// Array of investigation summaries
|
||||
// +listType=atomic
|
||||
investigationSummaries: InvestigationSummary[]; |
||||
} |
||||
|
||||
export const defaultSpec = (): Spec => ({ |
||||
title: "", |
||||
owner: defaultPerson(), |
||||
investigationSummaries: [], |
||||
}); |
||||
|
@ -0,0 +1,30 @@ |
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
export interface OperatorState { |
||||
// lastEvaluation is the ResourceVersion last evaluated
|
||||
lastEvaluation: string; |
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
state: "success" | "in_progress" | "failed"; |
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
descriptiveState?: string; |
||||
// details contains any extra information that is operator-specific
|
||||
details?: Record<string, any>; |
||||
} |
||||
|
||||
export const defaultOperatorState = (): OperatorState => ({ |
||||
lastEvaluation: "", |
||||
state: "success", |
||||
}); |
||||
|
||||
export interface Status { |
||||
// operatorStates is a map of operator ID to operator state evaluations.
|
||||
// Any operator which consumes this kind SHOULD add its state evaluation information to this field.
|
||||
operatorStates?: Record<string, OperatorState>; |
||||
// additionalFields is reserved for future use
|
||||
additionalFields?: Record<string, any>; |
||||
} |
||||
|
||||
export const defaultStatus = (): Status => ({ |
||||
}); |
||||
|
@ -1,28 +1,28 @@ |
||||
package investigation |
||||
package investigations |
||||
|
||||
import ( |
||||
"github.com/grafana/grafana-app-sdk/app" |
||||
"github.com/grafana/grafana-app-sdk/simple" |
||||
"github.com/grafana/grafana/apps/investigation/pkg/apis" |
||||
investigationv1alpha1 "github.com/grafana/grafana/apps/investigation/pkg/apis/investigation/v1alpha1" |
||||
investigationapp "github.com/grafana/grafana/apps/investigation/pkg/app" |
||||
"github.com/grafana/grafana/apps/investigations/pkg/apis" |
||||
investigationv0alpha1 "github.com/grafana/grafana/apps/investigations/pkg/apis/investigations/v0alpha1" |
||||
investigationapp "github.com/grafana/grafana/apps/investigations/pkg/app" |
||||
"github.com/grafana/grafana/pkg/services/apiserver/builder/runner" |
||||
"github.com/grafana/grafana/pkg/setting" |
||||
) |
||||
|
||||
type InvestigationAppProvider struct { |
||||
type InvestigationsAppProvider struct { |
||||
app.Provider |
||||
cfg *setting.Cfg |
||||
} |
||||
|
||||
func RegisterApp( |
||||
cfg *setting.Cfg, |
||||
) *InvestigationAppProvider { |
||||
provider := &InvestigationAppProvider{ |
||||
) *InvestigationsAppProvider { |
||||
provider := &InvestigationsAppProvider{ |
||||
cfg: cfg, |
||||
} |
||||
appCfg := &runner.AppBuilderConfig{ |
||||
OpenAPIDefGetter: investigationv1alpha1.GetOpenAPIDefinitions, |
||||
OpenAPIDefGetter: investigationv0alpha1.GetOpenAPIDefinitions, |
||||
ManagedKinds: investigationapp.GetKinds(), |
||||
} |
||||
provider.Provider = simple.NewAppProvider(apis.LocalManifest(), appCfg, investigationapp.New) |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue