mirror of https://github.com/grafana/grafana
K8s/Folders: Use v1beta1 and app-sdk based spec (#103975)
parent
acfd998fa6
commit
0283c98e30
@ -0,0 +1,29 @@ |
||||
APP_SDK_VERSION := v0.35.1
|
||||
APP_SDK_DIR := $(shell go env GOPATH)/bin/app-sdk-$(APP_SDK_VERSION)
|
||||
APP_SDK_BIN := $(APP_SDK_DIR)/grafana-app-sdk
|
||||
|
||||
.PHONY: install-app-sdk |
||||
install-app-sdk: $(APP_SDK_BIN) ## Install the Grafana App SDK
|
||||
|
||||
$(APP_SDK_BIN): |
||||
@echo "Installing Grafana App SDK version $(APP_SDK_VERSION)"
|
||||
@mkdir -p $(APP_SDK_DIR)
|
||||
# The only way to install specific versions of binaries using `go install`
|
||||
# is by setting GOBIN to the directory you want to install the binary to.
|
||||
GOBIN=$(APP_SDK_DIR) go install github.com/grafana/grafana-app-sdk/cmd/grafana-app-sdk@$(APP_SDK_VERSION)
|
||||
@touch $@
|
||||
|
||||
.PHONY: update-app-sdk |
||||
update-app-sdk: ## Update the Grafana App SDK dependency in go.mod
|
||||
go get github.com/grafana/grafana-app-sdk@$(APP_SDK_VERSION)
|
||||
go mod tidy
|
||||
|
||||
.PHONY: generate |
||||
generate: install-app-sdk update-app-sdk ## Run Grafana App SDK code generation
|
||||
@$(APP_SDK_BIN) generate \
|
||||
--source=./kinds/ \
|
||||
--gogenpath=./pkg/apis \
|
||||
--grouping=group \
|
||||
--defencoding=none \
|
||||
--genoperatorstate=false \
|
||||
--noschemasinmanifest
|
@ -1,36 +1,57 @@ |
||||
module github.com/grafana/grafana/pkg/apis/folder |
||||
module github.com/grafana/grafana/apps/folder |
||||
|
||||
go 1.24.2 |
||||
|
||||
require ( |
||||
github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250401081501-6af5fbf3fff0 |
||||
github.com/grafana/grafana-app-sdk v0.35.1 |
||||
github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250414114055-2b279efe15bf |
||||
k8s.io/apimachinery v0.32.3 |
||||
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff |
||||
) |
||||
|
||||
require ( |
||||
github.com/beorn7/perks v1.0.1 // indirect |
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect |
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect |
||||
github.com/emicklei/go-restful/v3 v3.11.0 // indirect |
||||
github.com/fxamacker/cbor/v2 v2.7.0 // indirect |
||||
github.com/getkin/kin-openapi v0.131.0 // indirect |
||||
github.com/go-logr/logr v1.4.2 // indirect |
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect |
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect |
||||
github.com/go-openapi/swag v0.23.0 // indirect |
||||
github.com/gogo/protobuf v1.3.2 // indirect |
||||
github.com/google/gnostic-models v0.6.9 // indirect |
||||
github.com/google/go-cmp v0.7.0 // indirect |
||||
github.com/google/gofuzz v1.2.0 // indirect |
||||
github.com/grafana/grafana-app-sdk/logging v0.35.1 // indirect |
||||
github.com/josharian/intern v1.0.0 // indirect |
||||
github.com/json-iterator/go v1.1.12 // indirect |
||||
github.com/klauspost/compress v1.18.0 // indirect |
||||
github.com/mailru/easyjson v0.7.7 // indirect |
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect |
||||
github.com/modern-go/reflect2 v1.0.2 // indirect |
||||
github.com/rogpeppe/go-internal v1.14.1 // indirect |
||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect |
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect |
||||
github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 // indirect |
||||
github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 // indirect |
||||
github.com/perimeterx/marshmallow v1.1.5 // indirect |
||||
github.com/prometheus/client_golang v1.21.1 // indirect |
||||
github.com/prometheus/client_model v0.6.1 // indirect |
||||
github.com/prometheus/common v0.63.0 // indirect |
||||
github.com/prometheus/procfs v0.15.1 // indirect |
||||
github.com/x448/float16 v0.8.4 // indirect |
||||
go.opentelemetry.io/otel v1.35.0 // indirect |
||||
go.opentelemetry.io/otel/trace v1.35.0 // indirect |
||||
golang.org/x/net v0.39.0 // indirect |
||||
golang.org/x/oauth2 v0.29.0 // indirect |
||||
golang.org/x/sys v0.32.0 // indirect |
||||
golang.org/x/term v0.31.0 // indirect |
||||
golang.org/x/text v0.24.0 // indirect |
||||
golang.org/x/time v0.11.0 // indirect |
||||
google.golang.org/protobuf v1.36.6 // indirect |
||||
gopkg.in/inf.v0 v0.9.1 // indirect |
||||
gopkg.in/yaml.v3 v3.0.1 // indirect |
||||
k8s.io/client-go v0.32.3 // indirect |
||||
k8s.io/klog/v2 v2.130.1 // indirect |
||||
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect |
||||
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect |
@ -0,0 +1,4 @@ |
||||
module: "github.com/grafana/grafana/apps/folder/kinds" |
||||
language: { |
||||
version: "v0.9.0" |
||||
} |
@ -0,0 +1,27 @@ |
||||
package folder |
||||
|
||||
folder: { |
||||
kind: "Folder" |
||||
pluralName: "Folders" |
||||
current: "v1beta1" |
||||
codegen: { |
||||
ts: { |
||||
enabled: false // Not sure if it should be enabled or not, currently it is. |
||||
} |
||||
go: { |
||||
enabled: true |
||||
} |
||||
} |
||||
|
||||
versions: { |
||||
"v1beta1": { |
||||
schema: { |
||||
spec: { |
||||
title: string |
||||
description?: string |
||||
} |
||||
status: {} // nothing |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,9 @@ |
||||
package folder |
||||
|
||||
manifest: { |
||||
appName: "folder" |
||||
groupOverride: "folder.grafana.app" |
||||
kinds: [ |
||||
folder, |
||||
] |
||||
} |
@ -0,0 +1,18 @@ |
||||
package v1beta1 |
||||
|
||||
import "k8s.io/apimachinery/pkg/runtime/schema" |
||||
|
||||
const ( |
||||
// Group is the API group used by all kinds in this package
|
||||
Group = "folder.grafana.app" |
||||
// Version is the API version used by all kinds in this package
|
||||
Version = "v1beta1" |
||||
) |
||||
|
||||
var ( |
||||
// GroupVersion is a schema.GroupVersion consisting of the Group and Version constants for this package
|
||||
GroupVersion = schema.GroupVersion{ |
||||
Group: Group, |
||||
Version: Version, |
||||
} |
||||
) |
@ -0,0 +1,5 @@ |
||||
// +k8s:openapi-gen=true
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
// +groupName=folder.grafana.app
|
||||
|
||||
package v1beta1 |
@ -0,0 +1,28 @@ |
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v1beta1 |
||||
|
||||
import ( |
||||
"encoding/json" |
||||
"io" |
||||
|
||||
"github.com/grafana/grafana-app-sdk/resource" |
||||
) |
||||
|
||||
// FolderJSONCodec is an implementation of resource.Codec for kubernetes JSON encoding
|
||||
type FolderJSONCodec struct{} |
||||
|
||||
// Read reads JSON-encoded bytes from `reader` and unmarshals them into `into`
|
||||
func (*FolderJSONCodec) 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 (*FolderJSONCodec) Write(writer io.Writer, from resource.Object) error { |
||||
return json.NewEncoder(writer).Encode(from) |
||||
} |
||||
|
||||
// Interface compliance checks
|
||||
var _ resource.Codec = &FolderJSONCodec{} |
@ -0,0 +1,28 @@ |
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
package v1beta1 |
||||
|
||||
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 FolderMetadata 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"` |
||||
} |
||||
|
||||
// NewFolderMetadata creates a new FolderMetadata object.
|
||||
func NewFolderMetadata() *FolderMetadata { |
||||
return &FolderMetadata{} |
||||
} |
@ -0,0 +1,319 @@ |
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v1beta1 |
||||
|
||||
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 Folder struct { |
||||
metav1.TypeMeta `json:",inline" yaml:",inline"` |
||||
metav1.ObjectMeta `json:"metadata" yaml:"metadata"` |
||||
|
||||
// Spec is the spec of the Folder
|
||||
Spec FolderSpec `json:"spec" yaml:"spec"` |
||||
|
||||
Status FolderStatus `json:"status" yaml:"status"` |
||||
} |
||||
|
||||
func (o *Folder) GetSpec() any { |
||||
return o.Spec |
||||
} |
||||
|
||||
func (o *Folder) SetSpec(spec any) error { |
||||
cast, ok := spec.(FolderSpec) |
||||
if !ok { |
||||
return fmt.Errorf("cannot set spec type %#v, not of type Spec", spec) |
||||
} |
||||
o.Spec = cast |
||||
return nil |
||||
} |
||||
|
||||
func (o *Folder) GetSubresources() map[string]any { |
||||
return map[string]any{ |
||||
"status": o.Status, |
||||
} |
||||
} |
||||
|
||||
func (o *Folder) GetSubresource(name string) (any, bool) { |
||||
switch name { |
||||
case "status": |
||||
return o.Status, true |
||||
default: |
||||
return nil, false |
||||
} |
||||
} |
||||
|
||||
func (o *Folder) SetSubresource(name string, value any) error { |
||||
switch name { |
||||
case "status": |
||||
cast, ok := value.(FolderStatus) |
||||
if !ok { |
||||
return fmt.Errorf("cannot set status type %#v, not of type FolderStatus", value) |
||||
} |
||||
o.Status = cast |
||||
return nil |
||||
default: |
||||
return fmt.Errorf("subresource '%s' does not exist", name) |
||||
} |
||||
} |
||||
|
||||
func (o *Folder) 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 *Folder) 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 *Folder) 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 *Folder) 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 *Folder) GetCreatedBy() string { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
return o.ObjectMeta.Annotations["grafana.com/createdBy"] |
||||
} |
||||
|
||||
func (o *Folder) SetCreatedBy(createdBy string) { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
o.ObjectMeta.Annotations["grafana.com/createdBy"] = createdBy |
||||
} |
||||
|
||||
func (o *Folder) 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 *Folder) 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 *Folder) GetUpdatedBy() string { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
return o.ObjectMeta.Annotations["grafana.com/updatedBy"] |
||||
} |
||||
|
||||
func (o *Folder) SetUpdatedBy(updatedBy string) { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
o.ObjectMeta.Annotations["grafana.com/updatedBy"] = updatedBy |
||||
} |
||||
|
||||
func (o *Folder) Copy() resource.Object { |
||||
return resource.CopyObject(o) |
||||
} |
||||
|
||||
func (o *Folder) DeepCopyObject() runtime.Object { |
||||
return o.Copy() |
||||
} |
||||
|
||||
func (o *Folder) DeepCopy() *Folder { |
||||
cpy := &Folder{} |
||||
o.DeepCopyInto(cpy) |
||||
return cpy |
||||
} |
||||
|
||||
func (o *Folder) DeepCopyInto(dst *Folder) { |
||||
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 = &Folder{} |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type FolderList struct { |
||||
metav1.TypeMeta `json:",inline" yaml:",inline"` |
||||
metav1.ListMeta `json:"metadata" yaml:"metadata"` |
||||
Items []Folder `json:"items" yaml:"items"` |
||||
} |
||||
|
||||
func (o *FolderList) DeepCopyObject() runtime.Object { |
||||
return o.Copy() |
||||
} |
||||
|
||||
func (o *FolderList) Copy() resource.ListObject { |
||||
cpy := &FolderList{ |
||||
TypeMeta: o.TypeMeta, |
||||
Items: make([]Folder, len(o.Items)), |
||||
} |
||||
o.ListMeta.DeepCopyInto(&cpy.ListMeta) |
||||
for i := 0; i < len(o.Items); i++ { |
||||
if item, ok := o.Items[i].Copy().(*Folder); ok { |
||||
cpy.Items[i] = *item |
||||
} |
||||
} |
||||
return cpy |
||||
} |
||||
|
||||
func (o *FolderList) 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 *FolderList) SetItems(items []resource.Object) { |
||||
o.Items = make([]Folder, len(items)) |
||||
for i := 0; i < len(items); i++ { |
||||
o.Items[i] = *items[i].(*Folder) |
||||
} |
||||
} |
||||
|
||||
func (o *FolderList) DeepCopy() *FolderList { |
||||
cpy := &FolderList{} |
||||
o.DeepCopyInto(cpy) |
||||
return cpy |
||||
} |
||||
|
||||
func (o *FolderList) DeepCopyInto(dst *FolderList) { |
||||
resource.CopyObjectInto(dst, o) |
||||
} |
||||
|
||||
// Interface compliance compile-time check
|
||||
var _ resource.ListObject = &FolderList{} |
||||
|
||||
// Copy methods for all subresource types
|
||||
|
||||
// DeepCopy creates a full deep copy of Spec
|
||||
func (s *FolderSpec) DeepCopy() *FolderSpec { |
||||
cpy := &FolderSpec{} |
||||
s.DeepCopyInto(cpy) |
||||
return cpy |
||||
} |
||||
|
||||
// DeepCopyInto deep copies Spec into another Spec object
|
||||
func (s *FolderSpec) DeepCopyInto(dst *FolderSpec) { |
||||
resource.CopyObjectInto(dst, s) |
||||
} |
||||
|
||||
// DeepCopy creates a full deep copy of FolderStatus
|
||||
func (s *FolderStatus) DeepCopy() *FolderStatus { |
||||
cpy := &FolderStatus{} |
||||
s.DeepCopyInto(cpy) |
||||
return cpy |
||||
} |
||||
|
||||
// DeepCopyInto deep copies FolderStatus into another FolderStatus object
|
||||
func (s *FolderStatus) DeepCopyInto(dst *FolderStatus) { |
||||
resource.CopyObjectInto(dst, s) |
||||
} |
@ -0,0 +1,34 @@ |
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v1beta1 |
||||
|
||||
import ( |
||||
"github.com/grafana/grafana-app-sdk/resource" |
||||
) |
||||
|
||||
// schema is unexported to prevent accidental overwrites
|
||||
var ( |
||||
schemaFolder = resource.NewSimpleSchema("folder.grafana.app", "v1beta1", &Folder{}, &FolderList{}, resource.WithKind("Folder"), |
||||
resource.WithPlural("folders"), resource.WithScope(resource.NamespacedScope)) |
||||
kindFolder = resource.Kind{ |
||||
Schema: schemaFolder, |
||||
Codecs: map[resource.KindEncoding]resource.Codec{ |
||||
resource.KindEncodingJSON: &FolderJSONCodec{}, |
||||
}, |
||||
} |
||||
) |
||||
|
||||
// Kind returns a resource.Kind for this Schema with a JSON codec
|
||||
func FolderKind() resource.Kind { |
||||
return kindFolder |
||||
} |
||||
|
||||
// Schema returns a resource.SimpleSchema representation of Folder
|
||||
func FolderSchema() *resource.SimpleSchema { |
||||
return schemaFolder |
||||
} |
||||
|
||||
// Interface compliance checks
|
||||
var _ resource.Schema = kindFolder |
@ -0,0 +1,14 @@ |
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
package v1beta1 |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type FolderSpec struct { |
||||
Title string `json:"title"` |
||||
Description *string `json:"description,omitempty"` |
||||
} |
||||
|
||||
// NewFolderSpec creates a new FolderSpec object.
|
||||
func NewFolderSpec() *FolderSpec { |
||||
return &FolderSpec{} |
||||
} |
@ -0,0 +1,3 @@ |
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
package v1beta1 |
@ -0,0 +1,98 @@ |
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package v1beta1 |
||||
|
||||
import ( |
||||
runtime "k8s.io/apimachinery/pkg/runtime" |
||||
) |
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DescendantCounts) DeepCopyInto(out *DescendantCounts) { |
||||
*out = *in |
||||
out.TypeMeta = in.TypeMeta |
||||
if in.Counts != nil { |
||||
in, out := &in.Counts, &out.Counts |
||||
*out = make([]ResourceStats, len(*in)) |
||||
copy(*out, *in) |
||||
} |
||||
return |
||||
} |
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DescendantCounts.
|
||||
func (in *DescendantCounts) DeepCopy() *DescendantCounts { |
||||
if in == nil { |
||||
return nil |
||||
} |
||||
out := new(DescendantCounts) |
||||
in.DeepCopyInto(out) |
||||
return out |
||||
} |
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *DescendantCounts) DeepCopyObject() runtime.Object { |
||||
if c := in.DeepCopy(); c != nil { |
||||
return c |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FolderAccessInfo) DeepCopyInto(out *FolderAccessInfo) { |
||||
*out = *in |
||||
out.TypeMeta = in.TypeMeta |
||||
return |
||||
} |
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FolderAccessInfo.
|
||||
func (in *FolderAccessInfo) DeepCopy() *FolderAccessInfo { |
||||
if in == nil { |
||||
return nil |
||||
} |
||||
out := new(FolderAccessInfo) |
||||
in.DeepCopyInto(out) |
||||
return out |
||||
} |
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *FolderAccessInfo) DeepCopyObject() runtime.Object { |
||||
if c := in.DeepCopy(); c != nil { |
||||
return c |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FolderInfoList) DeepCopyInto(out *FolderInfoList) { |
||||
*out = *in |
||||
out.TypeMeta = in.TypeMeta |
||||
in.ListMeta.DeepCopyInto(&out.ListMeta) |
||||
if in.Items != nil { |
||||
in, out := &in.Items, &out.Items |
||||
*out = make([]FolderInfo, len(*in)) |
||||
copy(*out, *in) |
||||
} |
||||
return |
||||
} |
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FolderInfoList.
|
||||
func (in *FolderInfoList) DeepCopy() *FolderInfoList { |
||||
if in == nil { |
||||
return nil |
||||
} |
||||
out := new(FolderInfoList) |
||||
in.DeepCopyInto(out) |
||||
return out |
||||
} |
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *FolderInfoList) DeepCopyObject() runtime.Object { |
||||
if c := in.DeepCopy(); c != nil { |
||||
return c |
||||
} |
||||
return nil |
||||
} |
@ -0,0 +1,3 @@ |
||||
API rule violation: list_type_missing,github.com/grafana/grafana/apps/folder/pkg/apis/folder/v1beta1,DescendantCounts,Counts |
||||
API rule violation: list_type_missing,github.com/grafana/grafana/apps/folder/pkg/apis/folder/v1beta1,FolderInfoList,Items |
||||
API rule violation: list_type_missing,github.com/grafana/grafana/apps/folder/pkg/apis/folder/v1beta1,FolderMetadata,Finalizers |
@ -0,0 +1,43 @@ |
||||
//
|
||||
// This file is generated by grafana-app-sdk
|
||||
// DO NOT EDIT
|
||||
//
|
||||
|
||||
package apis |
||||
|
||||
import ( |
||||
"encoding/json" |
||||
|
||||
"github.com/grafana/grafana-app-sdk/app" |
||||
) |
||||
|
||||
var appManifestData = app.ManifestData{ |
||||
AppName: "folder", |
||||
Group: "folder.grafana.app", |
||||
Kinds: []app.ManifestKind{ |
||||
{ |
||||
Kind: "Folder", |
||||
Scope: "Namespaced", |
||||
Conversion: false, |
||||
Versions: []app.ManifestKindVersion{ |
||||
{ |
||||
Name: "v1beta1", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
} |
||||
|
||||
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("folder") |
||||
} |
@ -1,6 +0,0 @@ |
||||
// +k8s:deepcopy-gen=package
|
||||
// +k8s:openapi-gen=true
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
// +groupName=folder.grafana.app
|
||||
|
||||
package v1 // import "github.com/grafana/grafana/pkg/apis/folder/v1"
|
@ -1,206 +0,0 @@ |
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package v1 |
||||
|
||||
import ( |
||||
runtime "k8s.io/apimachinery/pkg/runtime" |
||||
) |
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DescendantCounts) DeepCopyInto(out *DescendantCounts) { |
||||
*out = *in |
||||
out.TypeMeta = in.TypeMeta |
||||
if in.Counts != nil { |
||||
in, out := &in.Counts, &out.Counts |
||||
*out = make([]ResourceStats, len(*in)) |
||||
copy(*out, *in) |
||||
} |
||||
return |
||||
} |
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DescendantCounts.
|
||||
func (in *DescendantCounts) DeepCopy() *DescendantCounts { |
||||
if in == nil { |
||||
return nil |
||||
} |
||||
out := new(DescendantCounts) |
||||
in.DeepCopyInto(out) |
||||
return out |
||||
} |
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *DescendantCounts) DeepCopyObject() runtime.Object { |
||||
if c := in.DeepCopy(); c != nil { |
||||
return c |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Folder) DeepCopyInto(out *Folder) { |
||||
*out = *in |
||||
out.TypeMeta = in.TypeMeta |
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) |
||||
out.Spec = in.Spec |
||||
return |
||||
} |
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Folder.
|
||||
func (in *Folder) DeepCopy() *Folder { |
||||
if in == nil { |
||||
return nil |
||||
} |
||||
out := new(Folder) |
||||
in.DeepCopyInto(out) |
||||
return out |
||||
} |
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Folder) DeepCopyObject() runtime.Object { |
||||
if c := in.DeepCopy(); c != nil { |
||||
return c |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FolderAccessInfo) DeepCopyInto(out *FolderAccessInfo) { |
||||
*out = *in |
||||
out.TypeMeta = in.TypeMeta |
||||
return |
||||
} |
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FolderAccessInfo.
|
||||
func (in *FolderAccessInfo) DeepCopy() *FolderAccessInfo { |
||||
if in == nil { |
||||
return nil |
||||
} |
||||
out := new(FolderAccessInfo) |
||||
in.DeepCopyInto(out) |
||||
return out |
||||
} |
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *FolderAccessInfo) DeepCopyObject() runtime.Object { |
||||
if c := in.DeepCopy(); c != nil { |
||||
return c |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FolderInfo) DeepCopyInto(out *FolderInfo) { |
||||
*out = *in |
||||
return |
||||
} |
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FolderInfo.
|
||||
func (in *FolderInfo) DeepCopy() *FolderInfo { |
||||
if in == nil { |
||||
return nil |
||||
} |
||||
out := new(FolderInfo) |
||||
in.DeepCopyInto(out) |
||||
return out |
||||
} |
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FolderInfoList) DeepCopyInto(out *FolderInfoList) { |
||||
*out = *in |
||||
out.TypeMeta = in.TypeMeta |
||||
in.ListMeta.DeepCopyInto(&out.ListMeta) |
||||
if in.Items != nil { |
||||
in, out := &in.Items, &out.Items |
||||
*out = make([]FolderInfo, len(*in)) |
||||
copy(*out, *in) |
||||
} |
||||
return |
||||
} |
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FolderInfoList.
|
||||
func (in *FolderInfoList) DeepCopy() *FolderInfoList { |
||||
if in == nil { |
||||
return nil |
||||
} |
||||
out := new(FolderInfoList) |
||||
in.DeepCopyInto(out) |
||||
return out |
||||
} |
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *FolderInfoList) DeepCopyObject() runtime.Object { |
||||
if c := in.DeepCopy(); c != nil { |
||||
return c |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FolderList) DeepCopyInto(out *FolderList) { |
||||
*out = *in |
||||
out.TypeMeta = in.TypeMeta |
||||
in.ListMeta.DeepCopyInto(&out.ListMeta) |
||||
if in.Items != nil { |
||||
in, out := &in.Items, &out.Items |
||||
*out = make([]Folder, len(*in)) |
||||
for i := range *in { |
||||
(*in)[i].DeepCopyInto(&(*out)[i]) |
||||
} |
||||
} |
||||
return |
||||
} |
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FolderList.
|
||||
func (in *FolderList) DeepCopy() *FolderList { |
||||
if in == nil { |
||||
return nil |
||||
} |
||||
out := new(FolderList) |
||||
in.DeepCopyInto(out) |
||||
return out |
||||
} |
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *FolderList) DeepCopyObject() runtime.Object { |
||||
if c := in.DeepCopy(); c != nil { |
||||
return c |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ResourceStats) DeepCopyInto(out *ResourceStats) { |
||||
*out = *in |
||||
return |
||||
} |
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceStats.
|
||||
func (in *ResourceStats) DeepCopy() *ResourceStats { |
||||
if in == nil { |
||||
return nil |
||||
} |
||||
out := new(ResourceStats) |
||||
in.DeepCopyInto(out) |
||||
return out |
||||
} |
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Spec) DeepCopyInto(out *Spec) { |
||||
*out = *in |
||||
return |
||||
} |
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Spec.
|
||||
func (in *Spec) DeepCopy() *Spec { |
||||
if in == nil { |
||||
return nil |
||||
} |
||||
out := new(Spec) |
||||
in.DeepCopyInto(out) |
||||
return out |
||||
} |
@ -1,2 +0,0 @@ |
||||
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/folder/v1,DescendantCounts,Counts |
||||
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/folder/v1,FolderInfoList,Items |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue