Apps: Add Example App to ./apps (#112069)

* [API Server] Add Example App for reference use.

* Remove Printlns.

* Upgrade app-sdk to v0.46.0, update apps to handle breaking changes.

* Only start the reconciler for the example app if the v1alpha1 API version is enabled.

* Some comment doc updates.

* Run make update-workspace

* Set codeowner for /apps/example

* Run make gofmt and make update-workspace

* Run prettier on apps/example/README.md

* Add COPY apps/example to Dockerfile

* Add an authorizer to the example app.

* Fix import ordering.

* Update apps/example/kinds/manifest.cue

Co-authored-by: Owen Diehl <ow.diehl@gmail.com>

* Run make update-workspace

* Re-run make gen-go for enterprise import updates

* Run make update-workspace

---------

Co-authored-by: Owen Diehl <ow.diehl@gmail.com>
This commit is contained in:
Austin Pond
2025-10-27 12:01:10 -04:00
committed by GitHub
co-authored by Owen Diehl
parent d25f5199c7
commit bf65c43783
71 changed files with 3744 additions and 4 deletions
@@ -0,0 +1,18 @@
package v0alpha1
import "k8s.io/apimachinery/pkg/runtime/schema"
const (
// APIGroup is the API group used by all kinds in this package
APIGroup = "example.grafana.app"
// APIVersion is the API version used by all kinds in this package
APIVersion = "v0alpha1"
)
var (
// GroupVersion is a schema.GroupVersion consisting of the Group and Version constants for this package
GroupVersion = schema.GroupVersion{
Group: APIGroup,
Version: APIVersion,
}
)
@@ -0,0 +1,99 @@
package v0alpha1
import (
"context"
"github.com/grafana/grafana-app-sdk/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type ExampleClient struct {
client *resource.TypedClient[*Example, *ExampleList]
}
func NewExampleClient(client resource.Client) *ExampleClient {
return &ExampleClient{
client: resource.NewTypedClient[*Example, *ExampleList](client, ExampleKind()),
}
}
func NewExampleClientFromGenerator(generator resource.ClientGenerator) (*ExampleClient, error) {
c, err := generator.ClientFor(ExampleKind())
if err != nil {
return nil, err
}
return NewExampleClient(c), nil
}
func (c *ExampleClient) Get(ctx context.Context, identifier resource.Identifier) (*Example, error) {
return c.client.Get(ctx, identifier)
}
func (c *ExampleClient) List(ctx context.Context, namespace string, opts resource.ListOptions) (*ExampleList, error) {
return c.client.List(ctx, namespace, opts)
}
func (c *ExampleClient) ListAll(ctx context.Context, namespace string, opts resource.ListOptions) (*ExampleList, error) {
resp, err := c.client.List(ctx, namespace, resource.ListOptions{
ResourceVersion: opts.ResourceVersion,
Limit: opts.Limit,
LabelFilters: opts.LabelFilters,
FieldSelectors: opts.FieldSelectors,
})
if err != nil {
return nil, err
}
for resp.GetContinue() != "" {
page, err := c.client.List(ctx, namespace, resource.ListOptions{
Continue: resp.GetContinue(),
ResourceVersion: opts.ResourceVersion,
Limit: opts.Limit,
LabelFilters: opts.LabelFilters,
FieldSelectors: opts.FieldSelectors,
})
if err != nil {
return nil, err
}
resp.SetContinue(page.GetContinue())
resp.SetResourceVersion(page.GetResourceVersion())
resp.SetItems(append(resp.GetItems(), page.GetItems()...))
}
return resp, nil
}
func (c *ExampleClient) Create(ctx context.Context, obj *Example, opts resource.CreateOptions) (*Example, error) {
// Make sure apiVersion and kind are set
obj.APIVersion = GroupVersion.Identifier()
obj.Kind = ExampleKind().Kind()
return c.client.Create(ctx, obj, opts)
}
func (c *ExampleClient) Update(ctx context.Context, obj *Example, opts resource.UpdateOptions) (*Example, error) {
return c.client.Update(ctx, obj, opts)
}
func (c *ExampleClient) Patch(ctx context.Context, identifier resource.Identifier, req resource.PatchRequest, opts resource.PatchOptions) (*Example, error) {
return c.client.Patch(ctx, identifier, req, opts)
}
func (c *ExampleClient) UpdateStatus(ctx context.Context, identifier resource.Identifier, newStatus ExampleStatus, opts resource.UpdateOptions) (*Example, error) {
return c.client.Update(ctx, &Example{
TypeMeta: metav1.TypeMeta{
Kind: ExampleKind().Kind(),
APIVersion: GroupVersion.Identifier(),
},
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: opts.ResourceVersion,
Namespace: identifier.Namespace,
Name: identifier.Name,
},
Status: newStatus,
}, resource.UpdateOptions{
Subresource: "status",
ResourceVersion: opts.ResourceVersion,
})
}
func (c *ExampleClient) Delete(ctx context.Context, identifier resource.Identifier, opts resource.DeleteOptions) error {
return c.client.Delete(ctx, identifier, opts)
}
@@ -0,0 +1,28 @@
//
// Code generated by grafana-app-sdk. DO NOT EDIT.
//
package v0alpha1
import (
"encoding/json"
"io"
"github.com/grafana/grafana-app-sdk/resource"
)
// ExampleJSONCodec is an implementation of resource.Codec for kubernetes JSON encoding
type ExampleJSONCodec struct{}
// Read reads JSON-encoded bytes from `reader` and unmarshals them into `into`
func (*ExampleJSONCodec) 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 (*ExampleJSONCodec) Write(writer io.Writer, from resource.Object) error {
return json.NewEncoder(writer).Encode(from)
}
// Interface compliance checks
var _ resource.Codec = &ExampleJSONCodec{}
@@ -0,0 +1,31 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
package v0alpha1
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 ExampleMetadata 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"`
}
// NewExampleMetadata creates a new ExampleMetadata object.
func NewExampleMetadata() *ExampleMetadata {
return &ExampleMetadata{
Finalizers: []string{},
Labels: map[string]string{},
}
}
@@ -0,0 +1,319 @@
//
// Code generated by grafana-app-sdk. DO NOT EDIT.
//
package v0alpha1
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 Example struct {
metav1.TypeMeta `json:",inline" yaml:",inline"`
metav1.ObjectMeta `json:"metadata" yaml:"metadata"`
// Spec is the spec of the Example
Spec ExampleSpec `json:"spec" yaml:"spec"`
Status ExampleStatus `json:"status" yaml:"status"`
}
func (o *Example) GetSpec() any {
return o.Spec
}
func (o *Example) SetSpec(spec any) error {
cast, ok := spec.(ExampleSpec)
if !ok {
return fmt.Errorf("cannot set spec type %#v, not of type Spec", spec)
}
o.Spec = cast
return nil
}
func (o *Example) GetSubresources() map[string]any {
return map[string]any{
"status": o.Status,
}
}
func (o *Example) GetSubresource(name string) (any, bool) {
switch name {
case "status":
return o.Status, true
default:
return nil, false
}
}
func (o *Example) SetSubresource(name string, value any) error {
switch name {
case "status":
cast, ok := value.(ExampleStatus)
if !ok {
return fmt.Errorf("cannot set status type %#v, not of type ExampleStatus", value)
}
o.Status = cast
return nil
default:
return fmt.Errorf("subresource '%s' does not exist", name)
}
}
func (o *Example) 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 *Example) 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 *Example) 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 *Example) 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 *Example) GetCreatedBy() string {
if o.ObjectMeta.Annotations == nil {
o.ObjectMeta.Annotations = make(map[string]string)
}
return o.ObjectMeta.Annotations["grafana.com/createdBy"]
}
func (o *Example) SetCreatedBy(createdBy string) {
if o.ObjectMeta.Annotations == nil {
o.ObjectMeta.Annotations = make(map[string]string)
}
o.ObjectMeta.Annotations["grafana.com/createdBy"] = createdBy
}
func (o *Example) 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 *Example) 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 *Example) GetUpdatedBy() string {
if o.ObjectMeta.Annotations == nil {
o.ObjectMeta.Annotations = make(map[string]string)
}
return o.ObjectMeta.Annotations["grafana.com/updatedBy"]
}
func (o *Example) SetUpdatedBy(updatedBy string) {
if o.ObjectMeta.Annotations == nil {
o.ObjectMeta.Annotations = make(map[string]string)
}
o.ObjectMeta.Annotations["grafana.com/updatedBy"] = updatedBy
}
func (o *Example) Copy() resource.Object {
return resource.CopyObject(o)
}
func (o *Example) DeepCopyObject() runtime.Object {
return o.Copy()
}
func (o *Example) DeepCopy() *Example {
cpy := &Example{}
o.DeepCopyInto(cpy)
return cpy
}
func (o *Example) DeepCopyInto(dst *Example) {
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 = &Example{}
// +k8s:openapi-gen=true
type ExampleList struct {
metav1.TypeMeta `json:",inline" yaml:",inline"`
metav1.ListMeta `json:"metadata" yaml:"metadata"`
Items []Example `json:"items" yaml:"items"`
}
func (o *ExampleList) DeepCopyObject() runtime.Object {
return o.Copy()
}
func (o *ExampleList) Copy() resource.ListObject {
cpy := &ExampleList{
TypeMeta: o.TypeMeta,
Items: make([]Example, len(o.Items)),
}
o.ListMeta.DeepCopyInto(&cpy.ListMeta)
for i := 0; i < len(o.Items); i++ {
if item, ok := o.Items[i].Copy().(*Example); ok {
cpy.Items[i] = *item
}
}
return cpy
}
func (o *ExampleList) 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 *ExampleList) SetItems(items []resource.Object) {
o.Items = make([]Example, len(items))
for i := 0; i < len(items); i++ {
o.Items[i] = *items[i].(*Example)
}
}
func (o *ExampleList) DeepCopy() *ExampleList {
cpy := &ExampleList{}
o.DeepCopyInto(cpy)
return cpy
}
func (o *ExampleList) DeepCopyInto(dst *ExampleList) {
resource.CopyObjectInto(dst, o)
}
// Interface compliance compile-time check
var _ resource.ListObject = &ExampleList{}
// Copy methods for all subresource types
// DeepCopy creates a full deep copy of Spec
func (s *ExampleSpec) DeepCopy() *ExampleSpec {
cpy := &ExampleSpec{}
s.DeepCopyInto(cpy)
return cpy
}
// DeepCopyInto deep copies Spec into another Spec object
func (s *ExampleSpec) DeepCopyInto(dst *ExampleSpec) {
resource.CopyObjectInto(dst, s)
}
// DeepCopy creates a full deep copy of ExampleStatus
func (s *ExampleStatus) DeepCopy() *ExampleStatus {
cpy := &ExampleStatus{}
s.DeepCopyInto(cpy)
return cpy
}
// DeepCopyInto deep copies ExampleStatus into another ExampleStatus object
func (s *ExampleStatus) DeepCopyInto(dst *ExampleStatus) {
resource.CopyObjectInto(dst, s)
}
@@ -0,0 +1,34 @@
//
// Code generated by grafana-app-sdk. DO NOT EDIT.
//
package v0alpha1
import (
"github.com/grafana/grafana-app-sdk/resource"
)
// schema is unexported to prevent accidental overwrites
var (
schemaExample = resource.NewSimpleSchema("example.grafana.app", "v0alpha1", &Example{}, &ExampleList{}, resource.WithKind("Example"),
resource.WithPlural("examples"), resource.WithScope(resource.NamespacedScope))
kindExample = resource.Kind{
Schema: schemaExample,
Codecs: map[resource.KindEncoding]resource.Codec{
resource.KindEncodingJSON: &ExampleJSONCodec{},
},
}
)
// Kind returns a resource.Kind for this Schema with a JSON codec
func ExampleKind() resource.Kind {
return kindExample
}
// Schema returns a resource.SimpleSchema representation of Example
func ExampleSchema() *resource.SimpleSchema {
return schemaExample
}
// Interface compliance checks
var _ resource.Schema = kindExample
@@ -0,0 +1,14 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
package v0alpha1
// Spec is the schema of our resource. The spec should include all the user-editable information for the kind.
// +k8s:openapi-gen=true
type ExampleSpec struct {
FirstField int64 `json:"firstField"`
}
// NewExampleSpec creates a new ExampleSpec object.
func NewExampleSpec() *ExampleSpec {
return &ExampleSpec{}
}
@@ -0,0 +1,45 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
package v0alpha1
// +k8s:openapi-gen=true
type ExamplestatusOperatorState struct {
// lastEvaluation is the ResourceVersion last evaluated
LastEvaluation string `json:"lastEvaluation"`
// state describes the state of the lastEvaluation.
// It is limited to three possible states for machine evaluation.
State ExampleStatusOperatorStateState `json:"state"`
// descriptiveState is an optional more descriptive state field which has no requirements on format
DescriptiveState *string `json:"descriptiveState,omitempty"`
// details contains any extra information that is operator-specific
Details map[string]interface{} `json:"details,omitempty"`
}
// NewExamplestatusOperatorState creates a new ExamplestatusOperatorState object.
func NewExamplestatusOperatorState() *ExamplestatusOperatorState {
return &ExamplestatusOperatorState{}
}
// +k8s:openapi-gen=true
type ExampleStatus struct {
LastObservedGeneration int64 `json:"lastObservedGeneration"`
// operatorStates is a map of operator ID to operator state evaluations.
// Any operator which consumes this kind SHOULD add its state evaluation information to this field.
OperatorStates map[string]ExamplestatusOperatorState `json:"operatorStates,omitempty"`
// additionalFields is reserved for future use
AdditionalFields map[string]interface{} `json:"additionalFields,omitempty"`
}
// NewExampleStatus creates a new ExampleStatus object.
func NewExampleStatus() *ExampleStatus {
return &ExampleStatus{}
}
// +k8s:openapi-gen=true
type ExampleStatusOperatorStateState string
const (
ExampleStatusOperatorStateStateSuccess ExampleStatusOperatorStateState = "success"
ExampleStatusOperatorStateStateInProgress ExampleStatusOperatorStateState = "in_progress"
ExampleStatusOperatorStateStateFailed ExampleStatusOperatorStateState = "failed"
)
@@ -0,0 +1,18 @@
package v1alpha1
import "k8s.io/apimachinery/pkg/runtime/schema"
const (
// APIGroup is the API group used by all kinds in this package
APIGroup = "example.grafana.app"
// APIVersion is the API version used by all kinds in this package
APIVersion = "v1alpha1"
)
var (
// GroupVersion is a schema.GroupVersion consisting of the Group and Version constants for this package
GroupVersion = schema.GroupVersion{
Group: APIGroup,
Version: APIVersion,
}
)
@@ -0,0 +1,144 @@
package v1alpha1
import (
"context"
"encoding/json"
"fmt"
"net/http"
"net/url"
"github.com/grafana/grafana-app-sdk/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type ExampleClient struct {
client *resource.TypedClient[*Example, *ExampleList]
}
func NewExampleClient(client resource.Client) *ExampleClient {
return &ExampleClient{
client: resource.NewTypedClient[*Example, *ExampleList](client, ExampleKind()),
}
}
func NewExampleClientFromGenerator(generator resource.ClientGenerator) (*ExampleClient, error) {
c, err := generator.ClientFor(ExampleKind())
if err != nil {
return nil, err
}
return NewExampleClient(c), nil
}
func (c *ExampleClient) Get(ctx context.Context, identifier resource.Identifier) (*Example, error) {
return c.client.Get(ctx, identifier)
}
func (c *ExampleClient) List(ctx context.Context, namespace string, opts resource.ListOptions) (*ExampleList, error) {
return c.client.List(ctx, namespace, opts)
}
func (c *ExampleClient) ListAll(ctx context.Context, namespace string, opts resource.ListOptions) (*ExampleList, error) {
resp, err := c.client.List(ctx, namespace, resource.ListOptions{
ResourceVersion: opts.ResourceVersion,
Limit: opts.Limit,
LabelFilters: opts.LabelFilters,
FieldSelectors: opts.FieldSelectors,
})
if err != nil {
return nil, err
}
for resp.GetContinue() != "" {
page, err := c.client.List(ctx, namespace, resource.ListOptions{
Continue: resp.GetContinue(),
ResourceVersion: opts.ResourceVersion,
Limit: opts.Limit,
LabelFilters: opts.LabelFilters,
FieldSelectors: opts.FieldSelectors,
})
if err != nil {
return nil, err
}
resp.SetContinue(page.GetContinue())
resp.SetResourceVersion(page.GetResourceVersion())
resp.SetItems(append(resp.GetItems(), page.GetItems()...))
}
return resp, nil
}
func (c *ExampleClient) Create(ctx context.Context, obj *Example, opts resource.CreateOptions) (*Example, error) {
// Make sure apiVersion and kind are set
obj.APIVersion = GroupVersion.Identifier()
obj.Kind = ExampleKind().Kind()
return c.client.Create(ctx, obj, opts)
}
func (c *ExampleClient) Update(ctx context.Context, obj *Example, opts resource.UpdateOptions) (*Example, error) {
return c.client.Update(ctx, obj, opts)
}
func (c *ExampleClient) Patch(ctx context.Context, identifier resource.Identifier, req resource.PatchRequest, opts resource.PatchOptions) (*Example, error) {
return c.client.Patch(ctx, identifier, req, opts)
}
func (c *ExampleClient) UpdateCustom(ctx context.Context, identifier resource.Identifier, newCustom ExampleCustom, opts resource.UpdateOptions) (*Example, error) {
return c.client.Update(ctx, &Example{
TypeMeta: metav1.TypeMeta{
Kind: ExampleKind().Kind(),
APIVersion: GroupVersion.Identifier(),
},
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: opts.ResourceVersion,
Namespace: identifier.Namespace,
Name: identifier.Name,
},
Custom: newCustom,
}, resource.UpdateOptions{
Subresource: "custom",
ResourceVersion: opts.ResourceVersion,
})
}
func (c *ExampleClient) UpdateStatus(ctx context.Context, identifier resource.Identifier, newStatus ExampleStatus, opts resource.UpdateOptions) (*Example, error) {
return c.client.Update(ctx, &Example{
TypeMeta: metav1.TypeMeta{
Kind: ExampleKind().Kind(),
APIVersion: GroupVersion.Identifier(),
},
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: opts.ResourceVersion,
Namespace: identifier.Namespace,
Name: identifier.Name,
},
Status: newStatus,
}, resource.UpdateOptions{
Subresource: "status",
ResourceVersion: opts.ResourceVersion,
})
}
func (c *ExampleClient) Delete(ctx context.Context, identifier resource.Identifier, opts resource.DeleteOptions) error {
return c.client.Delete(ctx, identifier, opts)
}
type GetFooRequest struct {
Params GetFooRequestParams
Headers http.Header
}
func (c *ExampleClient) GetFoo(ctx context.Context, identifier resource.Identifier, request GetFooRequest) (*GetFoo, error) {
params := url.Values{}
resp, err := c.client.SubresourceRequest(ctx, identifier, resource.CustomRouteRequestOptions{
Path: "foo",
Verb: "GET",
Query: params,
Headers: request.Headers,
})
if err != nil {
return nil, err
}
cast := GetFoo{}
err = json.Unmarshal(resp, &cast)
if err != nil {
return nil, fmt.Errorf("unable to unmarshal response bytes into GetFoo: %w", err)
}
return &cast, nil
}
@@ -0,0 +1,28 @@
//
// Code generated by grafana-app-sdk. DO NOT EDIT.
//
package v1alpha1
import (
"encoding/json"
"io"
"github.com/grafana/grafana-app-sdk/resource"
)
// ExampleJSONCodec is an implementation of resource.Codec for kubernetes JSON encoding
type ExampleJSONCodec struct{}
// Read reads JSON-encoded bytes from `reader` and unmarshals them into `into`
func (*ExampleJSONCodec) 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 (*ExampleJSONCodec) Write(writer io.Writer, from resource.Object) error {
return json.NewEncoder(writer).Encode(from)
}
// Interface compliance checks
var _ resource.Codec = &ExampleJSONCodec{}
@@ -0,0 +1,25 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
package v1alpha1
// Custom is a subresource that will be stored the same way status is stored,
// and requires using the /custom route to update.
// Its content is returned as part of a GET to the resource itself, just like with status.
// To route a subresource to an arbitrary handler, use the 'routes' field instead (see below).
// metadata if where kind- and schema-specific metadata goes. This is converted into typed annotations
// with getters and setters by the code generation.
//
// metadata: {
// kindSpecificField: string
// }
//
// +k8s:openapi-gen=true
type ExampleCustom struct {
MyField string `json:"myField"`
OtherField string `json:"otherField"`
}
// NewExampleCustom creates a new ExampleCustom object.
func NewExampleCustom() *ExampleCustom {
return &ExampleCustom{}
}
@@ -0,0 +1,12 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
package v1alpha1
type GetFooRequestBody struct {
Bar string `json:"bar"`
}
// NewGetFooRequestBody creates a new GetFooRequestBody object.
func NewGetFooRequestBody() *GetFooRequestBody {
return &GetFooRequestBody{}
}
@@ -0,0 +1,33 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
package v1alpha1
import (
"github.com/grafana/grafana-app-sdk/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type GetFooRequestParamsObject struct {
metav1.TypeMeta `json:",inline"`
GetFooRequestParams `json:",inline"`
}
func NewGetFooRequestParamsObject() *GetFooRequestParamsObject {
return &GetFooRequestParamsObject{}
}
func (o *GetFooRequestParamsObject) DeepCopyObject() runtime.Object {
dst := NewGetFooRequestParamsObject()
o.DeepCopyInto(dst)
return dst
}
func (o *GetFooRequestParamsObject) DeepCopyInto(dst *GetFooRequestParamsObject) {
dst.TypeMeta.APIVersion = o.TypeMeta.APIVersion
dst.TypeMeta.Kind = o.TypeMeta.Kind
dstGetFooRequestParams := GetFooRequestParams{}
_ = resource.CopyObjectInto(&dstGetFooRequestParams, &o.GetFooRequestParams)
}
var _ runtime.Object = NewGetFooRequestParamsObject()
@@ -0,0 +1,12 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
package v1alpha1
type GetFooRequestParams struct {
Message *string `json:"message,omitempty"`
}
// NewGetFooRequestParams creates a new GetFooRequestParams object.
func NewGetFooRequestParams() *GetFooRequestParams {
return &GetFooRequestParams{}
}
@@ -0,0 +1,14 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
package v1alpha1
// The response type for the GET /foo method. This will generate a go type, and will also be used for the OpenAPI definition for the route.
// +k8s:openapi-gen=true
type GetFooBody struct {
Message string `json:"message"`
}
// NewGetFooBody creates a new GetFooBody object.
func NewGetFooBody() *GetFooBody {
return &GetFooBody{}
}
@@ -0,0 +1,37 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
package v1alpha1
import (
"github.com/grafana/grafana-app-sdk/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// +k8s:openapi-gen=true
type GetFoo struct {
metav1.TypeMeta `json:",inline"`
GetFooBody `json:",inline"`
}
func NewGetFoo() *GetFoo {
return &GetFoo{}
}
func (t *GetFooBody) DeepCopyInto(dst *GetFooBody) {
_ = resource.CopyObjectInto(dst, t)
}
func (o *GetFoo) DeepCopyObject() runtime.Object {
dst := NewGetFoo()
o.DeepCopyInto(dst)
return dst
}
func (o *GetFoo) DeepCopyInto(dst *GetFoo) {
dst.TypeMeta.APIVersion = o.TypeMeta.APIVersion
dst.TypeMeta.Kind = o.TypeMeta.Kind
o.GetFooBody.DeepCopyInto(&dst.GetFooBody)
}
var _ runtime.Object = NewGetFoo()
@@ -0,0 +1,31 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
package v1alpha1
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 ExampleMetadata 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"`
}
// NewExampleMetadata creates a new ExampleMetadata object.
func NewExampleMetadata() *ExampleMetadata {
return &ExampleMetadata{
Finalizers: []string{},
Labels: map[string]string{},
}
}
@@ -0,0 +1,347 @@
//
// Code generated by grafana-app-sdk. DO NOT EDIT.
//
package v1alpha1
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 Example struct {
metav1.TypeMeta `json:",inline" yaml:",inline"`
metav1.ObjectMeta `json:"metadata" yaml:"metadata"`
// Spec is the spec of the Example
Spec ExampleSpec `json:"spec" yaml:"spec"`
Status ExampleStatus `json:"status" yaml:"status"`
Custom ExampleCustom `json:"custom" yaml:"custom"`
}
func (o *Example) GetSpec() any {
return o.Spec
}
func (o *Example) SetSpec(spec any) error {
cast, ok := spec.(ExampleSpec)
if !ok {
return fmt.Errorf("cannot set spec type %#v, not of type Spec", spec)
}
o.Spec = cast
return nil
}
func (o *Example) GetSubresources() map[string]any {
return map[string]any{
"status": o.Status,
"custom": o.Custom,
}
}
func (o *Example) GetSubresource(name string) (any, bool) {
switch name {
case "status":
return o.Status, true
case "custom":
return o.Custom, true
default:
return nil, false
}
}
func (o *Example) SetSubresource(name string, value any) error {
switch name {
case "status":
cast, ok := value.(ExampleStatus)
if !ok {
return fmt.Errorf("cannot set status type %#v, not of type ExampleStatus", value)
}
o.Status = cast
return nil
case "custom":
cast, ok := value.(ExampleCustom)
if !ok {
return fmt.Errorf("cannot set custom type %#v, not of type ExampleCustom", value)
}
o.Custom = cast
return nil
default:
return fmt.Errorf("subresource '%s' does not exist", name)
}
}
func (o *Example) 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 *Example) 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 *Example) 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 *Example) 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 *Example) GetCreatedBy() string {
if o.ObjectMeta.Annotations == nil {
o.ObjectMeta.Annotations = make(map[string]string)
}
return o.ObjectMeta.Annotations["grafana.com/createdBy"]
}
func (o *Example) SetCreatedBy(createdBy string) {
if o.ObjectMeta.Annotations == nil {
o.ObjectMeta.Annotations = make(map[string]string)
}
o.ObjectMeta.Annotations["grafana.com/createdBy"] = createdBy
}
func (o *Example) 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 *Example) 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 *Example) GetUpdatedBy() string {
if o.ObjectMeta.Annotations == nil {
o.ObjectMeta.Annotations = make(map[string]string)
}
return o.ObjectMeta.Annotations["grafana.com/updatedBy"]
}
func (o *Example) SetUpdatedBy(updatedBy string) {
if o.ObjectMeta.Annotations == nil {
o.ObjectMeta.Annotations = make(map[string]string)
}
o.ObjectMeta.Annotations["grafana.com/updatedBy"] = updatedBy
}
func (o *Example) Copy() resource.Object {
return resource.CopyObject(o)
}
func (o *Example) DeepCopyObject() runtime.Object {
return o.Copy()
}
func (o *Example) DeepCopy() *Example {
cpy := &Example{}
o.DeepCopyInto(cpy)
return cpy
}
func (o *Example) DeepCopyInto(dst *Example) {
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)
o.Custom.DeepCopyInto(&dst.Custom)
}
// Interface compliance compile-time check
var _ resource.Object = &Example{}
// +k8s:openapi-gen=true
type ExampleList struct {
metav1.TypeMeta `json:",inline" yaml:",inline"`
metav1.ListMeta `json:"metadata" yaml:"metadata"`
Items []Example `json:"items" yaml:"items"`
}
func (o *ExampleList) DeepCopyObject() runtime.Object {
return o.Copy()
}
func (o *ExampleList) Copy() resource.ListObject {
cpy := &ExampleList{
TypeMeta: o.TypeMeta,
Items: make([]Example, len(o.Items)),
}
o.ListMeta.DeepCopyInto(&cpy.ListMeta)
for i := 0; i < len(o.Items); i++ {
if item, ok := o.Items[i].Copy().(*Example); ok {
cpy.Items[i] = *item
}
}
return cpy
}
func (o *ExampleList) 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 *ExampleList) SetItems(items []resource.Object) {
o.Items = make([]Example, len(items))
for i := 0; i < len(items); i++ {
o.Items[i] = *items[i].(*Example)
}
}
func (o *ExampleList) DeepCopy() *ExampleList {
cpy := &ExampleList{}
o.DeepCopyInto(cpy)
return cpy
}
func (o *ExampleList) DeepCopyInto(dst *ExampleList) {
resource.CopyObjectInto(dst, o)
}
// Interface compliance compile-time check
var _ resource.ListObject = &ExampleList{}
// Copy methods for all subresource types
// DeepCopy creates a full deep copy of Spec
func (s *ExampleSpec) DeepCopy() *ExampleSpec {
cpy := &ExampleSpec{}
s.DeepCopyInto(cpy)
return cpy
}
// DeepCopyInto deep copies Spec into another Spec object
func (s *ExampleSpec) DeepCopyInto(dst *ExampleSpec) {
resource.CopyObjectInto(dst, s)
}
// DeepCopy creates a full deep copy of ExampleStatus
func (s *ExampleStatus) DeepCopy() *ExampleStatus {
cpy := &ExampleStatus{}
s.DeepCopyInto(cpy)
return cpy
}
// DeepCopyInto deep copies ExampleStatus into another ExampleStatus object
func (s *ExampleStatus) DeepCopyInto(dst *ExampleStatus) {
resource.CopyObjectInto(dst, s)
}
// DeepCopy creates a full deep copy of ExampleCustom
func (s *ExampleCustom) DeepCopy() *ExampleCustom {
cpy := &ExampleCustom{}
s.DeepCopyInto(cpy)
return cpy
}
// DeepCopyInto deep copies ExampleCustom into another ExampleCustom object
func (s *ExampleCustom) DeepCopyInto(dst *ExampleCustom) {
resource.CopyObjectInto(dst, s)
}
@@ -0,0 +1,34 @@
//
// Code generated by grafana-app-sdk. DO NOT EDIT.
//
package v1alpha1
import (
"github.com/grafana/grafana-app-sdk/resource"
)
// schema is unexported to prevent accidental overwrites
var (
schemaExample = resource.NewSimpleSchema("example.grafana.app", "v1alpha1", &Example{}, &ExampleList{}, resource.WithKind("Example"),
resource.WithPlural("examples"), resource.WithScope(resource.NamespacedScope))
kindExample = resource.Kind{
Schema: schemaExample,
Codecs: map[resource.KindEncoding]resource.Codec{
resource.KindEncodingJSON: &ExampleJSONCodec{},
},
}
)
// Kind returns a resource.Kind for this Schema with a JSON codec
func ExampleKind() resource.Kind {
return kindExample
}
// Schema returns a resource.SimpleSchema representation of Example
func ExampleSchema() *resource.SimpleSchema {
return schemaExample
}
// Interface compliance checks
var _ resource.Schema = kindExample
@@ -0,0 +1,34 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
package v1alpha1
// #DefinedType is a re-usable definition for us to use in our schema.
// Fields leading with # are definitions in CUE and won't be included in the generated types.
// +k8s:openapi-gen=true
type ExampleDefinedType struct {
// Info is information about this entry. This comment, like all comments
// on fields or definitions, will be copied into the generated types as well.
Info string `json:"info"`
// Next is an optional next element in the DefinedType, allowing for a self-referential
// linked-list like structure. The ? in the field makes this optional.
Next *ExampleDefinedType `json:"next,omitempty"`
}
// NewExampleDefinedType creates a new ExampleDefinedType object.
func NewExampleDefinedType() *ExampleDefinedType {
return &ExampleDefinedType{}
}
// Spec is the schema of our resource. The spec should include all the user-editable information for the kind.
// +k8s:openapi-gen=true
type ExampleSpec struct {
// Example fields
FirstField string `json:"firstField"`
SecondField int64 `json:"secondField"`
List *ExampleDefinedType `json:"list,omitempty"`
}
// NewExampleSpec creates a new ExampleSpec object.
func NewExampleSpec() *ExampleSpec {
return &ExampleSpec{}
}
@@ -0,0 +1,48 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
package v1alpha1
// +k8s:openapi-gen=true
type ExamplestatusOperatorState struct {
// lastEvaluation is the ResourceVersion last evaluated
LastEvaluation string `json:"lastEvaluation"`
// state describes the state of the lastEvaluation.
// It is limited to three possible states for machine evaluation.
State ExampleStatusOperatorStateState `json:"state"`
// descriptiveState is an optional more descriptive state field which has no requirements on format
DescriptiveState *string `json:"descriptiveState,omitempty"`
// details contains any extra information that is operator-specific
Details map[string]interface{} `json:"details,omitempty"`
}
// NewExamplestatusOperatorState creates a new ExamplestatusOperatorState object.
func NewExamplestatusOperatorState() *ExamplestatusOperatorState {
return &ExamplestatusOperatorState{}
}
// status is where state and status information which may be used or updated by the operator or back-end should be placed
// If you do not have any such information, you do not need to include this field,
// however, as mentioned above, certain fields will be added by the kind system regardless.
// +k8s:openapi-gen=true
type ExampleStatus struct {
LastObservedGeneration int64 `json:"lastObservedGeneration"`
// operatorStates is a map of operator ID to operator state evaluations.
// Any operator which consumes this kind SHOULD add its state evaluation information to this field.
OperatorStates map[string]ExamplestatusOperatorState `json:"operatorStates,omitempty"`
// additionalFields is reserved for future use
AdditionalFields map[string]interface{} `json:"additionalFields,omitempty"`
}
// NewExampleStatus creates a new ExampleStatus object.
func NewExampleStatus() *ExampleStatus {
return &ExampleStatus{}
}
// +k8s:openapi-gen=true
type ExampleStatusOperatorStateState string
const (
ExampleStatusOperatorStateStateSuccess ExampleStatusOperatorStateState = "success"
ExampleStatusOperatorStateStateInProgress ExampleStatusOperatorStateState = "in_progress"
ExampleStatusOperatorStateStateFailed ExampleStatusOperatorStateState = "failed"
)
@@ -0,0 +1,33 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
package v1alpha1
import (
"github.com/grafana/grafana-app-sdk/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type GetOtherRequestParamsObject struct {
metav1.TypeMeta `json:",inline"`
GetOtherRequestParams `json:",inline"`
}
func NewGetOtherRequestParamsObject() *GetOtherRequestParamsObject {
return &GetOtherRequestParamsObject{}
}
func (o *GetOtherRequestParamsObject) DeepCopyObject() runtime.Object {
dst := NewGetOtherRequestParamsObject()
o.DeepCopyInto(dst)
return dst
}
func (o *GetOtherRequestParamsObject) DeepCopyInto(dst *GetOtherRequestParamsObject) {
dst.TypeMeta.APIVersion = o.TypeMeta.APIVersion
dst.TypeMeta.Kind = o.TypeMeta.Kind
dstGetOtherRequestParams := GetOtherRequestParams{}
_ = resource.CopyObjectInto(&dstGetOtherRequestParams, &o.GetOtherRequestParams)
}
var _ runtime.Object = NewGetOtherRequestParamsObject()
@@ -0,0 +1,12 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
package v1alpha1
type GetOtherRequestParams struct {
Message *string `json:"message,omitempty"`
}
// NewGetOtherRequestParams creates a new GetOtherRequestParams object.
func NewGetOtherRequestParams() *GetOtherRequestParams {
return &GetOtherRequestParams{}
}
@@ -0,0 +1,13 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
package v1alpha1
// +k8s:openapi-gen=true
type GetOther struct {
Message string `json:"message"`
}
// NewGetOther creates a new GetOther object.
func NewGetOther() *GetOther {
return &GetOther{}
}
@@ -0,0 +1,33 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
package v1alpha1
import (
"github.com/grafana/grafana-app-sdk/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type GetSomethingRequestParamsObject struct {
metav1.TypeMeta `json:",inline"`
GetSomethingRequestParams `json:",inline"`
}
func NewGetSomethingRequestParamsObject() *GetSomethingRequestParamsObject {
return &GetSomethingRequestParamsObject{}
}
func (o *GetSomethingRequestParamsObject) DeepCopyObject() runtime.Object {
dst := NewGetSomethingRequestParamsObject()
o.DeepCopyInto(dst)
return dst
}
func (o *GetSomethingRequestParamsObject) DeepCopyInto(dst *GetSomethingRequestParamsObject) {
dst.TypeMeta.APIVersion = o.TypeMeta.APIVersion
dst.TypeMeta.Kind = o.TypeMeta.Kind
dstGetSomethingRequestParams := GetSomethingRequestParams{}
_ = resource.CopyObjectInto(&dstGetSomethingRequestParams, &o.GetSomethingRequestParams)
}
var _ runtime.Object = NewGetSomethingRequestParamsObject()
@@ -0,0 +1,12 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
package v1alpha1
type GetSomethingRequestParams struct {
Message *string `json:"message,omitempty"`
}
// NewGetSomethingRequestParams creates a new GetSomethingRequestParams object.
func NewGetSomethingRequestParams() *GetSomethingRequestParams {
return &GetSomethingRequestParams{}
}
@@ -0,0 +1,14 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
package v1alpha1
// +k8s:openapi-gen=true
type GetSomethingBody struct {
Namespace string `json:"namespace"`
Message string `json:"message"`
}
// NewGetSomethingBody creates a new GetSomethingBody object.
func NewGetSomethingBody() *GetSomethingBody {
return &GetSomethingBody{}
}
@@ -0,0 +1,37 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
package v1alpha1
import (
"github.com/grafana/grafana-app-sdk/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// +k8s:openapi-gen=true
type GetSomething struct {
metav1.TypeMeta `json:",inline"`
GetSomethingBody `json:",inline"`
}
func NewGetSomething() *GetSomething {
return &GetSomething{}
}
func (t *GetSomethingBody) DeepCopyInto(dst *GetSomethingBody) {
_ = resource.CopyObjectInto(dst, t)
}
func (o *GetSomething) DeepCopyObject() runtime.Object {
dst := NewGetSomething()
o.DeepCopyInto(dst)
return dst
}
func (o *GetSomething) DeepCopyInto(dst *GetSomething) {
dst.TypeMeta.APIVersion = o.TypeMeta.APIVersion
dst.TypeMeta.Kind = o.TypeMeta.Kind
o.GetSomethingBody.DeepCopyInto(&dst.GetSomethingBody)
}
var _ runtime.Object = NewGetSomething()