From 405f9858de1f8a4ad41b3ceff6676700e1086e34 Mon Sep 17 00:00:00 2001 From: Jakub Hadvig Date: Fri, 11 Oct 2019 17:04:28 +0200 Subject: [PATCH] Add ConsoleYAMLSample CRD type --- console/v1/register.go | 2 + console/v1/types_console_yaml_sample.go | 51 ++++++++++++ console/v1/zz_generated.deepcopy.go | 77 +++++++++++++++++++ .../v1/zz_generated.swagger_doc_generated.go | 29 +++++++ 4 files changed, 159 insertions(+) create mode 100644 console/v1/types_console_yaml_sample.go diff --git a/console/v1/register.go b/console/v1/register.go index 98363daa3ea..87e0c8ed761 100644 --- a/console/v1/register.go +++ b/console/v1/register.go @@ -39,6 +39,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &ConsoleNotificationList{}, &ConsoleExternalLogLink{}, &ConsoleExternalLogLinkList{}, + &ConsoleYAMLSample{}, + &ConsoleYAMLSampleList{}, ) metav1.AddToGroupVersion(scheme, GroupVersion) return nil diff --git a/console/v1/types_console_yaml_sample.go b/console/v1/types_console_yaml_sample.go new file mode 100644 index 00000000000..c352abb1741 --- /dev/null +++ b/console/v1/types_console_yaml_sample.go @@ -0,0 +1,51 @@ +package v1 + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ConsoleYAMLSample is an extension for customizing OpenShift web console YAML samples. +type ConsoleYAMLSample struct { + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + metav1.ObjectMeta `json:"metadata"` + Spec ConsoleYAMLSampleSpec `json:"spec"` +} + +// ConsoleYAMLSampleSpec is the desired YAML sample configuration. +// Samples will appear with their descriptions in a samples sidebar +// when creating a resources in the web console. +type ConsoleYAMLSampleSpec struct { + // targetResource contains apiVersion and kind of the resource + // YAML sample is representating. + TargetResource metav1.TypeMeta `json:",targetResource"` + // title of the YAML sample. + Title ConsoleYAMLSampleTitle `json:"title"` + // description of the YAML sample. + Description ConsoleYAMLSampleDescription `json:"description"` + // yaml is the YAML sample to display. + YAML ConsoleYAMLSampleYAML `json:"yaml"` +} + +// ConsoleYAMLSampleTitle of the YAML sample. +// +kubebuilder:validation:Pattern=^(.|\s)*\S(.|\s)*$ +type ConsoleYAMLSampleTitle string + +// ConsoleYAMLSampleDescription of the YAML sample. +// +kubebuilder:validation:Pattern=^(.|\s)*\S(.|\s)*$ +type ConsoleYAMLSampleDescription string + +// ConsoleYAMLSampleYAML is the YAML sample to display. +// +kubebuilder:validation:Pattern=^(.|\s)*\S(.|\s)*$ +type ConsoleYAMLSampleYAML string + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +type ConsoleYAMLSampleList struct { + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + metav1.ListMeta `json:"metadata"` + Items []ConsoleYAMLSample `json:"items"` +} diff --git a/console/v1/zz_generated.deepcopy.go b/console/v1/zz_generated.deepcopy.go index 964d6696e22..d1231420bf0 100644 --- a/console/v1/zz_generated.deepcopy.go +++ b/console/v1/zz_generated.deepcopy.go @@ -365,6 +365,83 @@ func (in *ConsoleNotificationSpec) DeepCopy() *ConsoleNotificationSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConsoleYAMLSample) DeepCopyInto(out *ConsoleYAMLSample) { + *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 ConsoleYAMLSample. +func (in *ConsoleYAMLSample) DeepCopy() *ConsoleYAMLSample { + if in == nil { + return nil + } + out := new(ConsoleYAMLSample) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ConsoleYAMLSample) 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 *ConsoleYAMLSampleList) DeepCopyInto(out *ConsoleYAMLSampleList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ConsoleYAMLSample, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConsoleYAMLSampleList. +func (in *ConsoleYAMLSampleList) DeepCopy() *ConsoleYAMLSampleList { + if in == nil { + return nil + } + out := new(ConsoleYAMLSampleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ConsoleYAMLSampleList) 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 *ConsoleYAMLSampleSpec) DeepCopyInto(out *ConsoleYAMLSampleSpec) { + *out = *in + out.TargetResource = in.TargetResource + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConsoleYAMLSampleSpec. +func (in *ConsoleYAMLSampleSpec) DeepCopy() *ConsoleYAMLSampleSpec { + if in == nil { + return nil + } + out := new(ConsoleYAMLSampleSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Link) DeepCopyInto(out *Link) { *out = *in diff --git a/console/v1/zz_generated.swagger_doc_generated.go b/console/v1/zz_generated.swagger_doc_generated.go index bfee91746b4..0ecf6165235 100644 --- a/console/v1/zz_generated.swagger_doc_generated.go +++ b/console/v1/zz_generated.swagger_doc_generated.go @@ -163,4 +163,33 @@ func (ConsoleNotificationSpec) SwaggerDoc() map[string]string { return map_ConsoleNotificationSpec } +var map_ConsoleYAMLSample = map[string]string{ + "": "ConsoleYAMLSample is an extension for customizing OpenShift web console YAML samples.", + "metadata": "Standard object's metadata.", +} + +func (ConsoleYAMLSample) SwaggerDoc() map[string]string { + return map_ConsoleYAMLSample +} + +var map_ConsoleYAMLSampleList = map[string]string{ + "metadata": "Standard object's metadata.", +} + +func (ConsoleYAMLSampleList) SwaggerDoc() map[string]string { + return map_ConsoleYAMLSampleList +} + +var map_ConsoleYAMLSampleSpec = map[string]string{ + "": "ConsoleYAMLSampleSpec is the desired YAML sample configuration. Samples will appear with their descriptions in a samples sidebar when creating a resources in the web console.", + "TargetResource": "targetResource contains apiVersion and kind of the resource YAML sample is representating.", + "title": "title of the YAML sample.", + "description": "description of the YAML sample.", + "yaml": "yaml is the YAML sample to display.", +} + +func (ConsoleYAMLSampleSpec) SwaggerDoc() map[string]string { + return map_ConsoleYAMLSampleSpec +} + // AUTO-GENERATED FUNCTIONS END HERE