Scopes: (Chore) Fix ScopeDashboard by adding spec (#84675)

pull/84678/head
Kyle Brandt 1 year ago committed by GitHub
parent 63e8753aa0
commit 818c94f067
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      pkg/apis/scope/v0alpha1/types.go
  2. 27
      pkg/apis/scope/v0alpha1/zz_generated.deepcopy.go
  3. 59
      pkg/apis/scope/v0alpha1/zz_generated.openapi.go
  4. 6
      pkg/apis/scope/v0alpha1/zz_generated.openapi_violation_exceptions.list

@ -39,8 +39,12 @@ type ScopeDashboard struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
DashboardUID []string `json:"dashboardUid"`
ScopeUID string `json:"scopeUid"`
Spec ScopeDashboardSpec `json:"spec,omitempty"`
}
type ScopeDashboardSpec struct {
DashboardUIDs []string `json:"dashboardUids"`
ScopeUID string `json:"scopeUid"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

@ -43,11 +43,7 @@ func (in *ScopeDashboard) DeepCopyInto(out *ScopeDashboard) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
if in.DashboardUID != nil {
in, out := &in.DashboardUID, &out.DashboardUID
*out = make([]string, len(*in))
copy(*out, *in)
}
in.Spec.DeepCopyInto(&out.Spec)
return
}
@ -102,6 +98,27 @@ func (in *ScopeDashboardList) DeepCopyObject() runtime.Object {
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ScopeDashboardSpec) DeepCopyInto(out *ScopeDashboardSpec) {
*out = *in
if in.DashboardUIDs != nil {
in, out := &in.DashboardUIDs, &out.DashboardUIDs
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScopeDashboardSpec.
func (in *ScopeDashboardSpec) DeepCopy() *ScopeDashboardSpec {
if in == nil {
return nil
}
out := new(ScopeDashboardSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ScopeFilter) DeepCopyInto(out *ScopeFilter) {
*out = *in

@ -19,6 +19,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
"github.com/grafana/grafana/pkg/apis/scope/v0alpha1.Scope": schema_pkg_apis_scope_v0alpha1_Scope(ref),
"github.com/grafana/grafana/pkg/apis/scope/v0alpha1.ScopeDashboard": schema_pkg_apis_scope_v0alpha1_ScopeDashboard(ref),
"github.com/grafana/grafana/pkg/apis/scope/v0alpha1.ScopeDashboardList": schema_pkg_apis_scope_v0alpha1_ScopeDashboardList(ref),
"github.com/grafana/grafana/pkg/apis/scope/v0alpha1.ScopeDashboardSpec": schema_pkg_apis_scope_v0alpha1_ScopeDashboardSpec(ref),
"github.com/grafana/grafana/pkg/apis/scope/v0alpha1.ScopeFilter": schema_pkg_apis_scope_v0alpha1_ScopeFilter(ref),
"github.com/grafana/grafana/pkg/apis/scope/v0alpha1.ScopeList": schema_pkg_apis_scope_v0alpha1_ScopeList(ref),
"github.com/grafana/grafana/pkg/apis/scope/v0alpha1.ScopeSpec": schema_pkg_apis_scope_v0alpha1_ScopeSpec(ref),
@ -91,33 +92,17 @@ func schema_pkg_apis_scope_v0alpha1_ScopeDashboard(ref common.ReferenceCallback)
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
},
},
"dashboardUid": {
SchemaProps: spec.SchemaProps{
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
},
},
},
"scopeUid": {
"spec": {
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
Default: map[string]interface{}{},
Ref: ref("github.com/grafana/grafana/pkg/apis/scope/v0alpha1.ScopeDashboardSpec"),
},
},
},
Required: []string{"dashboardUid", "scopeUid"},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
"github.com/grafana/grafana/pkg/apis/scope/v0alpha1.ScopeDashboardSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
}
}
@ -168,6 +153,40 @@ func schema_pkg_apis_scope_v0alpha1_ScopeDashboardList(ref common.ReferenceCallb
}
}
func schema_pkg_apis_scope_v0alpha1_ScopeDashboardSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"dashboardUids": {
SchemaProps: spec.SchemaProps{
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
},
},
},
"scopeUid": {
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
},
Required: []string{"dashboardUids", "scopeUid"},
},
},
}
}
func schema_pkg_apis_scope_v0alpha1_ScopeFilter(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{

@ -1,4 +1,4 @@
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/scope/v0alpha1,ScopeDashboard,DashboardUID
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/scope/v0alpha1,ScopeDashboardSpec,DashboardUIDs
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/scope/v0alpha1,ScopeSpec,Filters
API rule violation: names_match,github.com/grafana/grafana/pkg/apis/scope/v0alpha1,ScopeDashboard,DashboardUID
API rule violation: names_match,github.com/grafana/grafana/pkg/apis/scope/v0alpha1,ScopeDashboard,ScopeUID
API rule violation: names_match,github.com/grafana/grafana/pkg/apis/scope/v0alpha1,ScopeDashboardSpec,DashboardUIDs
API rule violation: names_match,github.com/grafana/grafana/pkg/apis/scope/v0alpha1,ScopeDashboardSpec,ScopeUID

Loading…
Cancel
Save