-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathtestkind_schema_gen.go
More file actions
57 lines (49 loc) · 1.61 KB
/
testkind_schema_gen.go
File metadata and controls
57 lines (49 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// Code generated by grafana-app-sdk. DO NOT EDIT.
//
package v1alpha1
import (
"errors"
"github.com/grafana/grafana-app-sdk/resource"
)
// schema is unexported to prevent accidental overwrites
var (
schemaTestKind = resource.NewSimpleSchema("example.ext.grafana.com", "v1alpha1", NewTestKind(), &TestKindList{}, resource.WithKind("TestKind"),
resource.WithPlural("testkinds"), resource.WithScope(resource.NamespacedScope), resource.WithSelectableFields([]resource.SelectableField{resource.SelectableField{
FieldSelector: ".spec.testField",
FieldValueFunc: func(o resource.Object) (string, error) {
cast, ok := o.(*TestKind)
if !ok {
return "", errors.New("provided object must be of type *TestKind")
}
return cast.Spec.TestField, nil
},
},
}), resource.WithTableColumns([]resource.TableColumn{{
Name: "Test Field", Type: "string", JSONPath: ".spec.testField",
ValueFunc: func(o resource.Object) (any, error) {
cast, ok := o.(*TestKind)
if !ok {
return nil, errors.New("provided object must be of type *TestKind")
}
return cast.Spec.TestField, nil
},
},
}))
kindTestKind = resource.Kind{
Schema: schemaTestKind,
Codecs: map[resource.KindEncoding]resource.Codec{
resource.KindEncodingJSON: &TestKindJSONCodec{},
},
}
)
// Kind returns a resource.Kind for this Schema with a JSON codec
func TestKindKind() resource.Kind {
return kindTestKind
}
// Schema returns a resource.SimpleSchema representation of TestKind
func TestKindSchema() *resource.SimpleSchema {
return schemaTestKind
}
// Interface compliance checks
var _ resource.Schema = kindTestKind