diff --git a/apps/investigations/kinds/collectable.cue b/apps/investigations/kinds/collectable.cue index 6844c0a8cae..f9fc754a67c 100644 --- a/apps/investigations/kinds/collectable.cue +++ b/apps/investigations/kinds/collectable.cue @@ -8,7 +8,7 @@ package investigations title: string origin: string type: string - queries: [...#Query] // +listType=atomic + queries: [...string] // +listType=atomic timeRange: #TimeRange datasource: #DatasourceRef url: string @@ -16,6 +16,8 @@ package investigations note: string noteUpdatedAt: string + + fieldConfig: string } #CollectableSummary: { @@ -25,16 +27,6 @@ package investigations 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 diff --git a/apps/investigations/kinds/cue.mod/module.cue b/apps/investigations/kinds/cue.mod/module.cue index 55fe474ed5f..1c9c98f497f 100644 --- a/apps/investigations/kinds/cue.mod/module.cue +++ b/apps/investigations/kinds/cue.mod/module.cue @@ -1 +1,4 @@ module: "github.com/grafana/grafana/apps/investigations" +language: { + version: "v0.9.0" +} \ No newline at end of file diff --git a/apps/investigations/pkg/apis/investigations/v0alpha1/investigation_object_gen.go b/apps/investigations/pkg/apis/investigations/v0alpha1/investigation_object_gen.go index 21c8d760fe6..eb819564176 100644 --- a/apps/investigations/pkg/apis/investigations/v0alpha1/investigation_object_gen.go +++ b/apps/investigations/pkg/apis/investigations/v0alpha1/investigation_object_gen.go @@ -16,10 +16,13 @@ import ( // +k8s:openapi-gen=true type Investigation struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata" yaml:"metadata"` - Spec InvestigationSpec `json:"spec" yaml:"spec"` - InvestigationStatus InvestigationStatus `json:"status" yaml:"status"` + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata" yaml:"metadata"` + + // Spec is the spec of the Investigation + Spec InvestigationSpec `json:"spec" yaml:"spec"` + + Status InvestigationStatus `json:"status" yaml:"status"` } func (o *Investigation) GetSpec() any { @@ -37,14 +40,14 @@ func (o *Investigation) SetSpec(spec any) error { func (o *Investigation) GetSubresources() map[string]any { return map[string]any{ - "status": o.InvestigationStatus, + "status": o.Status, } } func (o *Investigation) GetSubresource(name string) (any, bool) { switch name { case "status": - return o.InvestigationStatus, true + return o.Status, true default: return nil, false } @@ -57,7 +60,7 @@ func (o *Investigation) SetSubresource(name string, value any) error { if !ok { return fmt.Errorf("cannot set status type %#v, not of type InvestigationStatus", value) } - o.InvestigationStatus = cast + o.Status = cast return nil default: return fmt.Errorf("subresource '%s' does not exist", name) @@ -219,6 +222,20 @@ func (o *Investigation) DeepCopyObject() runtime.Object { return o.Copy() } +func (o *Investigation) DeepCopy() *Investigation { + cpy := &Investigation{} + o.DeepCopyInto(cpy) + return cpy +} + +func (o *Investigation) DeepCopyInto(dst *Investigation) { + dst.TypeMeta.APIVersion = o.TypeMeta.APIVersion + dst.TypeMeta.Kind = o.TypeMeta.Kind + o.ObjectMeta.DeepCopyInto(&dst.ObjectMeta) + o.Spec.DeepCopyInto(&dst.Spec) + o.Status.DeepCopyInto(&dst.Status) +} + // Interface compliance compile-time check var _ resource.Object = &Investigation{} @@ -262,5 +279,41 @@ func (o *InvestigationList) SetItems(items []resource.Object) { } } +func (o *InvestigationList) DeepCopy() *InvestigationList { + cpy := &InvestigationList{} + o.DeepCopyInto(cpy) + return cpy +} + +func (o *InvestigationList) DeepCopyInto(dst *InvestigationList) { + resource.CopyObjectInto(dst, o) +} + // Interface compliance compile-time check var _ resource.ListObject = &InvestigationList{} + +// Copy methods for all subresource types + +// DeepCopy creates a full deep copy of Spec +func (s *InvestigationSpec) DeepCopy() *InvestigationSpec { + cpy := &InvestigationSpec{} + s.DeepCopyInto(cpy) + return cpy +} + +// DeepCopyInto deep copies Spec into another Spec object +func (s *InvestigationSpec) DeepCopyInto(dst *InvestigationSpec) { + resource.CopyObjectInto(dst, s) +} + +// DeepCopy creates a full deep copy of InvestigationStatus +func (s *InvestigationStatus) DeepCopy() *InvestigationStatus { + cpy := &InvestigationStatus{} + s.DeepCopyInto(cpy) + return cpy +} + +// DeepCopyInto deep copies InvestigationStatus into another InvestigationStatus object +func (s *InvestigationStatus) DeepCopyInto(dst *InvestigationStatus) { + resource.CopyObjectInto(dst, s) +} diff --git a/apps/investigations/pkg/apis/investigations/v0alpha1/investigation_spec_gen.go b/apps/investigations/pkg/apis/investigations/v0alpha1/investigation_spec_gen.go index 3bca90e4579..9ff1a1d4275 100644 --- a/apps/investigations/pkg/apis/investigations/v0alpha1/investigation_spec_gen.go +++ b/apps/investigations/pkg/apis/investigations/v0alpha1/investigation_spec_gen.go @@ -27,13 +27,14 @@ type InvestigationCollectable struct { Origin string `json:"origin"` Type string `json:"type"` // +listType=atomic - Queries []InvestigationQuery `json:"queries"` + Queries []string `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"` + FieldConfig string `json:"fieldConfig"` } // NewInvestigationCollectable creates a new InvestigationCollectable object. @@ -44,22 +45,6 @@ func NewInvestigationCollectable() *InvestigationCollectable { } } -// 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 { diff --git a/apps/investigations/pkg/apis/investigations/v0alpha1/investigationindex_object_gen.go b/apps/investigations/pkg/apis/investigations/v0alpha1/investigationindex_object_gen.go index cc3c33964ed..67493201f05 100644 --- a/apps/investigations/pkg/apis/investigations/v0alpha1/investigationindex_object_gen.go +++ b/apps/investigations/pkg/apis/investigations/v0alpha1/investigationindex_object_gen.go @@ -16,10 +16,13 @@ import ( // +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"` + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata" yaml:"metadata"` + + // Spec is the spec of the InvestigationIndex + Spec InvestigationIndexSpec `json:"spec" yaml:"spec"` + + Status InvestigationIndexStatus `json:"status" yaml:"status"` } func (o *InvestigationIndex) GetSpec() any { @@ -37,14 +40,14 @@ func (o *InvestigationIndex) SetSpec(spec any) error { func (o *InvestigationIndex) GetSubresources() map[string]any { return map[string]any{ - "status": o.InvestigationIndexStatus, + "status": o.Status, } } func (o *InvestigationIndex) GetSubresource(name string) (any, bool) { switch name { case "status": - return o.InvestigationIndexStatus, true + return o.Status, true default: return nil, false } @@ -57,7 +60,7 @@ func (o *InvestigationIndex) SetSubresource(name string, value any) error { if !ok { return fmt.Errorf("cannot set status type %#v, not of type InvestigationIndexStatus", value) } - o.InvestigationIndexStatus = cast + o.Status = cast return nil default: return fmt.Errorf("subresource '%s' does not exist", name) @@ -219,6 +222,20 @@ func (o *InvestigationIndex) DeepCopyObject() runtime.Object { return o.Copy() } +func (o *InvestigationIndex) DeepCopy() *InvestigationIndex { + cpy := &InvestigationIndex{} + o.DeepCopyInto(cpy) + return cpy +} + +func (o *InvestigationIndex) DeepCopyInto(dst *InvestigationIndex) { + dst.TypeMeta.APIVersion = o.TypeMeta.APIVersion + dst.TypeMeta.Kind = o.TypeMeta.Kind + o.ObjectMeta.DeepCopyInto(&dst.ObjectMeta) + o.Spec.DeepCopyInto(&dst.Spec) + o.Status.DeepCopyInto(&dst.Status) +} + // Interface compliance compile-time check var _ resource.Object = &InvestigationIndex{} @@ -262,5 +279,41 @@ func (o *InvestigationIndexList) SetItems(items []resource.Object) { } } +func (o *InvestigationIndexList) DeepCopy() *InvestigationIndexList { + cpy := &InvestigationIndexList{} + o.DeepCopyInto(cpy) + return cpy +} + +func (o *InvestigationIndexList) DeepCopyInto(dst *InvestigationIndexList) { + resource.CopyObjectInto(dst, o) +} + // Interface compliance compile-time check var _ resource.ListObject = &InvestigationIndexList{} + +// Copy methods for all subresource types + +// DeepCopy creates a full deep copy of Spec +func (s *InvestigationIndexSpec) DeepCopy() *InvestigationIndexSpec { + cpy := &InvestigationIndexSpec{} + s.DeepCopyInto(cpy) + return cpy +} + +// DeepCopyInto deep copies Spec into another Spec object +func (s *InvestigationIndexSpec) DeepCopyInto(dst *InvestigationIndexSpec) { + resource.CopyObjectInto(dst, s) +} + +// DeepCopy creates a full deep copy of InvestigationIndexStatus +func (s *InvestigationIndexStatus) DeepCopy() *InvestigationIndexStatus { + cpy := &InvestigationIndexStatus{} + s.DeepCopyInto(cpy) + return cpy +} + +// DeepCopyInto deep copies InvestigationIndexStatus into another InvestigationIndexStatus object +func (s *InvestigationIndexStatus) DeepCopyInto(dst *InvestigationIndexStatus) { + resource.CopyObjectInto(dst, s) +} diff --git a/apps/investigations/pkg/apis/investigations/v0alpha1/zz_openapi_gen.go b/apps/investigations/pkg/apis/investigations/v0alpha1/zz_openapi_gen.go index 36648cfcd11..4a095da63fc 100644 --- a/apps/investigations/pkg/apis/investigations/v0alpha1/zz_openapi_gen.go +++ b/apps/investigations/pkg/apis/investigations/v0alpha1/zz_openapi_gen.go @@ -26,7 +26,6 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/grafana/grafana/apps/investigations/pkg/apis/investigations/v0alpha1.InvestigationIndexstatusOperatorState": schema_pkg_apis_investigations_v0alpha1_InvestigationIndexstatusOperatorState(ref), "github.com/grafana/grafana/apps/investigations/pkg/apis/investigations/v0alpha1.InvestigationList": schema_pkg_apis_investigations_v0alpha1_InvestigationList(ref), "github.com/grafana/grafana/apps/investigations/pkg/apis/investigations/v0alpha1.InvestigationPerson": schema_pkg_apis_investigations_v0alpha1_InvestigationPerson(ref), - "github.com/grafana/grafana/apps/investigations/pkg/apis/investigations/v0alpha1.InvestigationQuery": schema_pkg_apis_investigations_v0alpha1_InvestigationQuery(ref), "github.com/grafana/grafana/apps/investigations/pkg/apis/investigations/v0alpha1.InvestigationSpec": schema_pkg_apis_investigations_v0alpha1_InvestigationSpec(ref), "github.com/grafana/grafana/apps/investigations/pkg/apis/investigations/v0alpha1.InvestigationStatus": schema_pkg_apis_investigations_v0alpha1_InvestigationStatus(ref), "github.com/grafana/grafana/apps/investigations/pkg/apis/investigations/v0alpha1.InvestigationTimeRange": schema_pkg_apis_investigations_v0alpha1_InvestigationTimeRange(ref), @@ -64,8 +63,9 @@ func schema_pkg_apis_investigations_v0alpha1_Investigation(ref common.ReferenceC }, "spec": { SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/grafana/grafana/apps/investigations/pkg/apis/investigations/v0alpha1.InvestigationSpec"), + Description: "Spec is the spec of the Investigation", + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/apps/investigations/pkg/apis/investigations/v0alpha1.InvestigationSpec"), }, }, "status": { @@ -136,8 +136,9 @@ func schema_pkg_apis_investigations_v0alpha1_InvestigationCollectable(ref common Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/grafana/grafana/apps/investigations/pkg/apis/investigations/v0alpha1.InvestigationQuery"), + Default: "", + Type: []string{"string"}, + Format: "", }, }, }, @@ -182,12 +183,19 @@ func schema_pkg_apis_investigations_v0alpha1_InvestigationCollectable(ref common Format: "", }, }, + "fieldConfig": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, }, - Required: []string{"id", "createdAt", "title", "origin", "type", "queries", "timeRange", "datasource", "url", "note", "noteUpdatedAt"}, + Required: []string{"id", "createdAt", "title", "origin", "type", "queries", "timeRange", "datasource", "url", "note", "noteUpdatedAt", "fieldConfig"}, }, }, Dependencies: []string{ - "github.com/grafana/grafana/apps/investigations/pkg/apis/investigations/v0alpha1.InvestigationDatasourceRef", "github.com/grafana/grafana/apps/investigations/pkg/apis/investigations/v0alpha1.InvestigationQuery", "github.com/grafana/grafana/apps/investigations/pkg/apis/investigations/v0alpha1.InvestigationTimeRange"}, + "github.com/grafana/grafana/apps/investigations/pkg/apis/investigations/v0alpha1.InvestigationDatasourceRef", "github.com/grafana/grafana/apps/investigations/pkg/apis/investigations/v0alpha1.InvestigationTimeRange"}, } } @@ -240,8 +248,9 @@ func schema_pkg_apis_investigations_v0alpha1_InvestigationIndex(ref common.Refer }, "spec": { SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/grafana/grafana/apps/investigations/pkg/apis/investigations/v0alpha1.InvestigationIndexSpec"), + Description: "Spec is the spec of the InvestigationIndex", + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/apps/investigations/pkg/apis/investigations/v0alpha1.InvestigationIndexSpec"), }, }, "status": { @@ -731,62 +740,6 @@ func schema_pkg_apis_investigations_v0alpha1_InvestigationPerson(ref common.Refe } } -func schema_pkg_apis_investigations_v0alpha1_InvestigationQuery(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "Query represents a data query", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "refId": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "queryType": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "editorMode": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "supportingQueryType": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "legendFormat": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "expr": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"refId", "queryType", "editorMode", "supportingQueryType", "legendFormat", "expr"}, - }, - }, - } -} - func schema_pkg_apis_investigations_v0alpha1_InvestigationSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/apps/investigations/pkg/apis/investigations_manifest.go b/apps/investigations/pkg/apis/investigations_manifest.go index eed596424bc..be270ae598f 100644 --- a/apps/investigations/pkg/apis/investigations_manifest.go +++ b/apps/investigations/pkg/apis/investigations_manifest.go @@ -12,10 +12,10 @@ import ( ) 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}}`) + 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"},"fieldConfig":{"type":"string"},"id":{"type":"string"},"logoPath":{"type":"string"},"note":{"type":"string"},"noteUpdatedAt":{"type":"string"},"origin":{"type":"string"},"queries":{"items":{"type":"string"},"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","fieldConfig"],"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"}}`) 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}}`) + 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"}}`) versionSchemaInvestigationIndexv0alpha1 app.VersionSchema _ = json.Unmarshal(rawSchemaInvestigationIndexv0alpha1, &versionSchemaInvestigationIndexv0alpha1) ) diff --git a/apps/investigations/plugin/src/generated/investigation/v0alpha1/investigation_object_gen.ts b/apps/investigations/plugin/src/generated/investigation/v0alpha1/investigation_object_gen.ts index b355ebaca05..3c7cf0874f8 100644 --- a/apps/investigations/plugin/src/generated/investigation/v0alpha1/investigation_object_gen.ts +++ b/apps/investigations/plugin/src/generated/investigation/v0alpha1/investigation_object_gen.ts @@ -5,45 +5,45 @@ 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; - annotations?: Record; - ownerReferences?: OwnerReference[]; - finalizers?: string[]; - managedFields?: ManagedFieldsEntry[]; + name: string; + namespace: string; + generateName?: string; + selfLink?: string; + uid?: string; + resourceVersion?: string; + generation?: number; + creationTimestamp?: string; + deletionTimestamp?: string; + deletionGracePeriodSeconds?: number; + labels?: Record; + annotations?: Record; + ownerReferences?: OwnerReference[]; + finalizers?: string[]; + managedFields?: ManagedFieldsEntry[]; } export interface OwnerReference { - apiVersion: string; - kind: string; - name: string; - uid: string; - controller?: boolean; - blockOwnerDeletion?: boolean; + 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; + 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; + kind: string; + apiVersion: string; + metadata: Metadata; + spec: Spec; + status: Status; } diff --git a/apps/investigations/plugin/src/generated/investigation/v0alpha1/types.spec.gen.ts b/apps/investigations/plugin/src/generated/investigation/v0alpha1/types.spec.gen.ts index c2a128284bc..c46622cd502 100644 --- a/apps/investigations/plugin/src/generated/investigation/v0alpha1/types.spec.gen.ts +++ b/apps/investigations/plugin/src/generated/investigation/v0alpha1/types.spec.gen.ts @@ -24,13 +24,14 @@ export interface Collectable { origin: string; type: string; // +listType=atomic - queries: Query[]; + queries: string[]; timeRange: TimeRange; datasource: DatasourceRef; url: string; logoPath?: string; note: string; noteUpdatedAt: string; + fieldConfig: string; } export const defaultCollectable = (): Collectable => ({ @@ -45,25 +46,7 @@ export const defaultCollectable = (): Collectable => ({ 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: "", + fieldConfig: "", }); // TimeRange represents a time range with both absolute and relative values diff --git a/apps/investigations/plugin/src/generated/investigationindex/v0alpha1/investigationindex_object_gen.ts b/apps/investigations/plugin/src/generated/investigationindex/v0alpha1/investigationindex_object_gen.ts index 399b25f3878..7d88430d451 100644 --- a/apps/investigations/plugin/src/generated/investigationindex/v0alpha1/investigationindex_object_gen.ts +++ b/apps/investigations/plugin/src/generated/investigationindex/v0alpha1/investigationindex_object_gen.ts @@ -5,45 +5,45 @@ 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; - annotations?: Record; - ownerReferences?: OwnerReference[]; - finalizers?: string[]; - managedFields?: ManagedFieldsEntry[]; + name: string; + namespace: string; + generateName?: string; + selfLink?: string; + uid?: string; + resourceVersion?: string; + generation?: number; + creationTimestamp?: string; + deletionTimestamp?: string; + deletionGracePeriodSeconds?: number; + labels?: Record; + annotations?: Record; + ownerReferences?: OwnerReference[]; + finalizers?: string[]; + managedFields?: ManagedFieldsEntry[]; } export interface OwnerReference { - apiVersion: string; - kind: string; - name: string; - uid: string; - controller?: boolean; - blockOwnerDeletion?: boolean; + 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; + 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; + kind: string; + apiVersion: string; + metadata: Metadata; + spec: Spec; + status: Status; } diff --git a/pkg/tests/apis/openapi_snapshots/investigations.grafana.app-v0alpha1.json b/pkg/tests/apis/openapi_snapshots/investigations.grafana.app-v0alpha1.json index 3d89c5ac205..c768321d510 100644 --- a/pkg/tests/apis/openapi_snapshots/investigations.grafana.app-v0alpha1.json +++ b/pkg/tests/apis/openapi_snapshots/investigations.grafana.app-v0alpha1.json @@ -1723,6 +1723,7 @@ ] }, "spec": { + "description": "Spec is the spec of the Investigation", "default": {}, "allOf": [ { @@ -1766,7 +1767,8 @@ "datasource", "url", "note", - "noteUpdatedAt" + "noteUpdatedAt", + "fieldConfig" ], "properties": { "createdAt": { @@ -1781,6 +1783,10 @@ } ] }, + "fieldConfig": { + "type": "string", + "default": "" + }, "id": { "type": "string", "default": "" @@ -1803,12 +1809,8 @@ "queries": { "type": "array", "items": { - "default": {}, - "allOf": [ - { - "$ref": "#/components/schemas/com.github.grafana.grafana.apps.investigations.pkg.apis.investigations.v0alpha1.InvestigationQuery" - } - ] + "type": "string", + "default": "" }, "x-kubernetes-list-type": "atomic" }, @@ -1872,6 +1874,7 @@ ] }, "spec": { + "description": "Spec is the spec of the InvestigationIndex", "default": {}, "allOf": [ { @@ -2253,44 +2256,6 @@ } } }, - "com.github.grafana.grafana.apps.investigations.pkg.apis.investigations.v0alpha1.InvestigationQuery": { - "description": "Query represents a data query", - "type": "object", - "required": [ - "refId", - "queryType", - "editorMode", - "supportingQueryType", - "legendFormat", - "expr" - ], - "properties": { - "editorMode": { - "type": "string", - "default": "" - }, - "expr": { - "type": "string", - "default": "" - }, - "legendFormat": { - "type": "string", - "default": "" - }, - "queryType": { - "type": "string", - "default": "" - }, - "refId": { - "type": "string", - "default": "" - }, - "supportingQueryType": { - "type": "string", - "default": "" - } - } - }, "com.github.grafana.grafana.apps.investigations.pkg.apis.investigations.v0alpha1.InvestigationSpec": { "description": "spec is the schema of our resource", "type": "object",