mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-19 12:36:34 +00:00
* feat: Enhance status and health policy CUE generation with field grouping, column alignment, `_isHealth` pattern, and annotation-based health disable. Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * feat: introduce defkit package for a structured Go API to define KubeVela component and trait templates with outputs, patches, and helpers. Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * refactor: Consolidate two `append` calls into one for health expression parts. Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> --------- Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
37 lines
1.3 KiB
Go
37 lines
1.3 KiB
Go
/*
|
|
Copyright 2025 The KubeVela Authors.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package defkit
|
|
|
|
// HelperDefinition represents a CUE helper type definition like #HealthProbe.
|
|
type HelperDefinition struct {
|
|
name string // e.g., "HealthProbe" (without the #)
|
|
schema string // Raw CUE schema (deprecated: prefer param)
|
|
param Param // Param-based schema definition (preferred)
|
|
}
|
|
|
|
// HasParam returns true if this helper definition uses a Param.
|
|
func (h HelperDefinition) HasParam() bool { return h.param != nil }
|
|
|
|
// GetParam returns the Param for this helper definition.
|
|
func (h HelperDefinition) GetParam() Param { return h.param }
|
|
|
|
// GetSchema returns the raw CUE schema.
|
|
func (h HelperDefinition) GetSchema() string { return h.schema }
|
|
|
|
// GetName returns the helper definition name.
|
|
func (h HelperDefinition) GetName() string { return h.name }
|