diff --git a/api/v1/appbinding.go b/api/v1/appbinding.go index 63b5c023..c84084d5 100644 --- a/api/v1/appbinding.go +++ b/api/v1/appbinding.go @@ -29,6 +29,15 @@ type GrafanaConfig struct { Dashboard DashboardSpec `json:"dashboard"` } +type PersesConfig struct { + URL string `json:"url"` + Service ServiceSpec `json:"service"` + BasicAuth BasicAuth `json:"basicAuth"` + BearerToken string `json:"bearerToken"` + TLS TLSConfig `json:"tls"` + Dashboard PersesDashboardSpec `json:"dashboard"` +} + type PrometheusConfig struct { URL string `json:"url"` Service ServiceSpec `json:"service"` @@ -51,6 +60,12 @@ type DashboardSpec struct { FolderID int `json:"folderID"` } +type PersesDashboardSpec struct { + ProjectName string `json:"projectName"` + FolderName string `json:"folderName"` + Datasource string `json:"datasource"` +} + type BasicAuth struct { Username string `json:"username"` Password string `json:"password"` @@ -78,6 +93,12 @@ type GrafanaContext struct { Datasource string `json:"datasource,omitempty"` } +type PersesContext struct { + ProjectName string `json:"projectName,omitempty"` + FolderName string `json:"folderName,omitempty"` + Datasource string `json:"datasource,omitempty"` +} + type Prometheus struct { AppBindingRef *kmapi.ObjectReference `json:"appBindingRef,omitempty"` *ConnectionSpec `json:",inline,omitempty"` diff --git a/api/v1/openapi_generated.go b/api/v1/openapi_generated.go index 6911db70..8890fd22 100644 --- a/api/v1/openapi_generated.go +++ b/api/v1/openapi_generated.go @@ -42,6 +42,9 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kmodules.xyz/monitoring-agent-api/api/v1.MonitoringPresets": schema_kmodulesxyz_monitoring_agent_api_api_v1_MonitoringPresets(ref), "kmodules.xyz/monitoring-agent-api/api/v1.MonitoringPresetsForm": schema_kmodulesxyz_monitoring_agent_api_api_v1_MonitoringPresetsForm(ref), "kmodules.xyz/monitoring-agent-api/api/v1.MonitoringPresetsSpec": schema_kmodulesxyz_monitoring_agent_api_api_v1_MonitoringPresetsSpec(ref), + "kmodules.xyz/monitoring-agent-api/api/v1.PersesConfig": schema_kmodulesxyz_monitoring_agent_api_api_v1_PersesConfig(ref), + "kmodules.xyz/monitoring-agent-api/api/v1.PersesContext": schema_kmodulesxyz_monitoring_agent_api_api_v1_PersesContext(ref), + "kmodules.xyz/monitoring-agent-api/api/v1.PersesDashboardSpec": schema_kmodulesxyz_monitoring_agent_api_api_v1_PersesDashboardSpec(ref), "kmodules.xyz/monitoring-agent-api/api/v1.Prometheus": schema_kmodulesxyz_monitoring_agent_api_api_v1_Prometheus(ref), "kmodules.xyz/monitoring-agent-api/api/v1.PrometheusConfig": schema_kmodulesxyz_monitoring_agent_api_api_v1_PrometheusConfig(ref), "kmodules.xyz/monitoring-agent-api/api/v1.PrometheusContext": schema_kmodulesxyz_monitoring_agent_api_api_v1_PrometheusContext(ref), @@ -462,6 +465,123 @@ func schema_kmodulesxyz_monitoring_agent_api_api_v1_MonitoringPresetsSpec(ref co } } +func schema_kmodulesxyz_monitoring_agent_api_api_v1_PersesConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "url": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "service": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/monitoring-agent-api/api/v1.ServiceSpec"), + }, + }, + "basicAuth": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/monitoring-agent-api/api/v1.BasicAuth"), + }, + }, + "bearerToken": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "tls": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/monitoring-agent-api/api/v1.TLSConfig"), + }, + }, + "dashboard": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/monitoring-agent-api/api/v1.PersesDashboardSpec"), + }, + }, + }, + Required: []string{"url", "service", "basicAuth", "bearerToken", "tls", "dashboard"}, + }, + }, + Dependencies: []string{ + "kmodules.xyz/monitoring-agent-api/api/v1.BasicAuth", "kmodules.xyz/monitoring-agent-api/api/v1.PersesDashboardSpec", "kmodules.xyz/monitoring-agent-api/api/v1.ServiceSpec", "kmodules.xyz/monitoring-agent-api/api/v1.TLSConfig"}, + } +} + +func schema_kmodulesxyz_monitoring_agent_api_api_v1_PersesContext(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "projectName": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "folderName": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "datasource": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_kmodulesxyz_monitoring_agent_api_api_v1_PersesDashboardSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "projectName": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "folderName": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "datasource": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"projectName", "folderName", "datasource"}, + }, + }, + } +} + func schema_kmodulesxyz_monitoring_agent_api_api_v1_Prometheus(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/api/v1/types.go b/api/v1/types.go index 532476f0..cfc6a5ee 100644 --- a/api/v1/types.go +++ b/api/v1/types.go @@ -30,6 +30,7 @@ const ( DefaultPrometheusKey = GroupName + "/is-default-prometheus" DefaultAlertmanagerKey = GroupName + "/is-default-alertmanager" DefaultGrafanaKey = GroupName + "/is-default-grafana" + DefaultPersesKey = GroupName + "/is-default-perses" PrometheusKey = GroupName + "/prometheus" PrometheusValueAuto = "auto" PrometheusValueFederated = "federated" diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index 2c7644e1..05f0bf78 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -275,6 +275,58 @@ func (in *MonitoringPresetsSpec) DeepCopy() *MonitoringPresetsSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PersesConfig) DeepCopyInto(out *PersesConfig) { + *out = *in + out.Service = in.Service + out.BasicAuth = in.BasicAuth + out.TLS = in.TLS + out.Dashboard = in.Dashboard + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PersesConfig. +func (in *PersesConfig) DeepCopy() *PersesConfig { + if in == nil { + return nil + } + out := new(PersesConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PersesContext) DeepCopyInto(out *PersesContext) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PersesContext. +func (in *PersesContext) DeepCopy() *PersesContext { + if in == nil { + return nil + } + out := new(PersesContext) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PersesDashboardSpec) DeepCopyInto(out *PersesDashboardSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PersesDashboardSpec. +func (in *PersesDashboardSpec) DeepCopy() *PersesDashboardSpec { + if in == nil { + return nil + } + out := new(PersesDashboardSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Prometheus) DeepCopyInto(out *Prometheus) { *out = *in