Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateConsoleDocument(title string, schema *openapi3.Schema) (string, error)
- func GetBaseResourceKinds(cueStr string, pd *packages.PackageDiscover, ...) (string, error)
- func GetCapabilitiesFromCluster(ctx context.Context, namespace string, c common.Args, selector labels.Selector) ([]types.Capability, error)
- func GetCapabilityByComponentDefinitionObject(componentDef v1beta1.ComponentDefinition, referenceName string) (*types.Capability, error)
- func GetCapabilityByName(ctx context.Context, c common.Args, capabilityName string, ns string, ...) (*types.Capability, error)
- func GetCapabilityByPolicyDefinitionObject(def v1beta1.PolicyDefinition, pd *packages.PackageDiscover) (*types.Capability, error)
- func GetCapabilityByTraitDefinitionObject(traitDef v1beta1.TraitDefinition) (*types.Capability, error)
- func GetCapabilityByWorkflowStepDefinitionObject(wfStepDef v1beta1.WorkflowStepDefinition, pd *packages.PackageDiscover) (*types.Capability, error)
- func GetCapabilityFromDefinitionRevision(ctx context.Context, c common.Args, pd *packages.PackageDiscover, ...) (*types.Capability, error)
- func GetComponentsFromCluster(ctx context.Context, namespace string, c common.Args, selector labels.Selector) ([]types.Capability, []error, error)
- func GetComponentsFromClusterWithValidateOption(ctx context.Context, namespace string, c common.Args, selector labels.Selector, ...) ([]types.Capability, []error, error)
- func GetDescription(annotation map[string]string) string
- func GetExample(annotation map[string]string) string
- func GetNamespacedCapabilitiesFromCluster(ctx context.Context, namespace string, c common.Args, selector labels.Selector) ([]types.Capability, error)
- func GetPolicies(ctx context.Context, namespace string, c common.Args) ([]types.Capability, []error, error)
- func GetTraitsFromCluster(ctx context.Context, namespace string, c common.Args, selector labels.Selector) ([]types.Capability, []error, error)
- func GetTraitsFromClusterWithValidateOption(ctx context.Context, namespace string, c common.Args, selector labels.Selector, ...) ([]types.Capability, []error, error)
- func GetWorkflowSteps(ctx context.Context, namespace string, c common.Args) ([]types.Capability, []error, error)
- func HandleDefinition(name, crdName string, annotation, labels map[string]string, ...) (types.Capability, error)
- func HandleTemplate(in *runtime.RawExtension, schematic *commontypes.Schematic, name string, ...) (types.Capability, error)
- func LoadAllInstalledCapability(userNamespace string, c common.Args) ([]types.Capability, error)
- func LoadCapabilityByName(name string, userNamespace string, c common.Args) (types.Capability, error)
- func LoadI18nData(path string)
- func LoadInstalledCapabilityWithType(userNamespace string, c common.Args, capT types.CapType) ([]types.Capability, error)
- func ParseCapabilityFromUnstructured(mapper discoverymapper.DiscoveryMapper, pd *packages.PackageDiscover, ...) (types.Capability, error)
- func ParseLocalFile(localFilePath string, c common.Args) (*types.Capability, error)
- func ParseLocalFiles(localFilePath string, c common.Args) ([]*types.Capability, error)
- func WalkParameterSchema(parameters *openapi3.Schema, name string, depth int)
- type BoolType
- type CommonReference
- type CommonSchema
- type ConsoleReference
- func (ref *ConsoleReference) GenerateCUETemplateProperties(capability *types.Capability, pd *packages.PackageDiscover) (string, []ConsoleReference, error)
- func (ref *ConsoleReference) GenerateTerraformCapabilityProperties(capability types.Capability) ([]ConsoleReference, error)
- func (ref *ConsoleReference) Show(ctx context.Context, c common.Args, ioStreams cmdutil.IOStreams, ...) error
- type FromCluster
- type FromLocal
- type I18n
- type Int64Type
- type Language
- type MarkdownReference
- func (ref *MarkdownReference) CreateMarkdown(ctx context.Context, caps []types.Capability, baseRefPath string, catalog bool, ...) error
- func (ref *MarkdownReference) GenerateMarkdownForCap(ctx context.Context, c types.Capability, pd *packages.PackageDiscover, ...) (string, error)
- func (ref *MarkdownReference) GenerateReferenceDocs(ctx context.Context, c common.Args, baseRefPath string) error
- func (ref *MarkdownReference) GenerateTerraformCapabilityPropertiesAndOutputs(capability types.Capability) (string, error)
- type ParseReference
- type Reference
- type ReferenceParameter
- type ReferenceParameterTable
- type StringType
Constants ¶
const ( // Markdown marks the format name of docs Markdown = "markdown" // Console marks the format name of docs Console = "console" )
const ( // Specification marks the title of parameter in reference docs Specification = "Specification" // Description marks the title of description in reference docs Description = "Description" // Examples marks the title of example in reference doc Examples = "Examples" // Base is the title of base in reference doc Base = "Underlying Kubernetes Resources" )
const AllComponentTypes = "*"
AllComponentTypes means trait can be applied to all component types
const DescriptionUndefined = "description not defined"
DescriptionUndefined indicates the description is not defined
Variables ¶
var ( // En is english, the default language En = I18n{/* contains filtered or unexported fields */} // Zh is Chinese Zh = I18n{/* contains filtered or unexported fields */} )
var BaseOpenAPIV3Template = `` /* 198-byte string literal not displayed */
BaseOpenAPIV3Template is Standard OpenAPIV3 Template
var DefinitionDocDescription = map[string]string{}
DefinitionDocDescription stores the description for capabilities
var DefinitionDocParameters = map[string]string{}
DefinitionDocParameters stores the parameters for capabilities, it will override the generated one
var DefinitionDocSamples = map[string]string{}
DefinitionDocSamples stores the configuration yaml sample for capabilities
Functions ¶
func GenerateConsoleDocument ¶ added in v1.6.0
GenerateConsoleDocument generate the document shown on the console.
func GetBaseResourceKinds ¶ added in v1.6.0
func GetBaseResourceKinds(cueStr string, pd *packages.PackageDiscover, dm discoverymapper.DiscoveryMapper) (string, error)
GetBaseResourceKinds helps get resource.group string of components' base resource
func GetCapabilitiesFromCluster ¶
func GetCapabilitiesFromCluster(ctx context.Context, namespace string, c common.Args, selector labels.Selector) ([]types.Capability, error)
GetCapabilitiesFromCluster will get capability from K8s cluster
func GetCapabilityByComponentDefinitionObject ¶
func GetCapabilityByComponentDefinitionObject(componentDef v1beta1.ComponentDefinition, referenceName string) (*types.Capability, error)
GetCapabilityByComponentDefinitionObject gets capability by ComponentDefinition object
func GetCapabilityByName ¶
func GetCapabilityByName(ctx context.Context, c common.Args, capabilityName string, ns string, pd *packages.PackageDiscover) (*types.Capability, error)
GetCapabilityByName gets capability by definition name
func GetCapabilityByPolicyDefinitionObject ¶
func GetCapabilityByPolicyDefinitionObject(def v1beta1.PolicyDefinition, pd *packages.PackageDiscover) (*types.Capability, error)
GetCapabilityByPolicyDefinitionObject gets capability by PolicyDefinition object
func GetCapabilityByTraitDefinitionObject ¶
func GetCapabilityByTraitDefinitionObject(traitDef v1beta1.TraitDefinition) (*types.Capability, error)
GetCapabilityByTraitDefinitionObject gets capability by TraitDefinition object
func GetCapabilityByWorkflowStepDefinitionObject ¶
func GetCapabilityByWorkflowStepDefinitionObject(wfStepDef v1beta1.WorkflowStepDefinition, pd *packages.PackageDiscover) (*types.Capability, error)
GetCapabilityByWorkflowStepDefinitionObject gets capability by WorkflowStepDefinition object
func GetCapabilityFromDefinitionRevision ¶
func GetCapabilityFromDefinitionRevision(ctx context.Context, c common.Args, pd *packages.PackageDiscover, ns, defName string, r int64) (*types.Capability, error)
GetCapabilityFromDefinitionRevision gets capabilities from the underlying Definition in DefinitionRevisions
func GetComponentsFromCluster ¶
func GetComponentsFromCluster(ctx context.Context, namespace string, c common.Args, selector labels.Selector) ([]types.Capability, []error, error)
GetComponentsFromCluster will get capability from K8s cluster
func GetComponentsFromClusterWithValidateOption ¶
func GetComponentsFromClusterWithValidateOption(ctx context.Context, namespace string, c common.Args, selector labels.Selector, validateFlag bool) ([]types.Capability, []error, error)
GetComponentsFromClusterWithValidateOption will get capability from K8s cluster with an option whether to valid Components
func GetDescription ¶
GetDescription get description from annotation
func GetExample ¶
GetExample get example markdown from annotation specified url
func GetNamespacedCapabilitiesFromCluster ¶
func GetNamespacedCapabilitiesFromCluster(ctx context.Context, namespace string, c common.Args, selector labels.Selector) ([]types.Capability, error)
GetNamespacedCapabilitiesFromCluster will get capability from K8s cluster in the specified namespace and default namespace If the definition could be found from `namespace`, try to find in namespace `types.DefaultKubeVelaNS`
func GetPolicies ¶
func GetPolicies(ctx context.Context, namespace string, c common.Args) ([]types.Capability, []error, error)
GetPolicies will get Policy from K8s cluster
func GetTraitsFromCluster ¶
func GetTraitsFromCluster(ctx context.Context, namespace string, c common.Args, selector labels.Selector) ([]types.Capability, []error, error)
GetTraitsFromCluster will get capability from K8s cluster
func GetTraitsFromClusterWithValidateOption ¶
func GetTraitsFromClusterWithValidateOption(ctx context.Context, namespace string, c common.Args, selector labels.Selector, validateFlag bool) ([]types.Capability, []error, error)
GetTraitsFromClusterWithValidateOption will get capability from K8s cluster with an option whether to valid Traits
func GetWorkflowSteps ¶
func GetWorkflowSteps(ctx context.Context, namespace string, c common.Args) ([]types.Capability, []error, error)
GetWorkflowSteps will get WorkflowStepDefinition list
func HandleDefinition ¶
func HandleDefinition(name, crdName string, annotation, labels map[string]string, extension *runtime.RawExtension, tp types.CapType, applyTo []string, schematic *commontypes.Schematic, pd *packages.PackageDiscover) (types.Capability, error)
HandleDefinition will handle definition to capability
func HandleTemplate ¶
func HandleTemplate(in *runtime.RawExtension, schematic *commontypes.Schematic, name string, pd *packages.PackageDiscover) (types.Capability, error)
HandleTemplate will handle definition template to capability
func LoadAllInstalledCapability ¶
LoadAllInstalledCapability will list all capability
func LoadCapabilityByName ¶
func LoadCapabilityByName(name string, userNamespace string, c common.Args) (types.Capability, error)
LoadCapabilityByName will load capability from local by name
func LoadInstalledCapabilityWithType ¶
func LoadInstalledCapabilityWithType(userNamespace string, c common.Args, capT types.CapType) ([]types.Capability, error)
LoadInstalledCapabilityWithType will load cap list by type
func ParseCapabilityFromUnstructured ¶
func ParseCapabilityFromUnstructured(mapper discoverymapper.DiscoveryMapper, pd *packages.PackageDiscover, obj unstructured.Unstructured) (types.Capability, error)
ParseCapabilityFromUnstructured will convert Unstructured to Capability
func ParseLocalFile ¶
ParseLocalFile parse the local file and get name, configuration from local ComponentDefinition file
func ParseLocalFiles ¶
ParseLocalFiles parse the local files in directory and get name, configuration from local ComponentDefinition file
Types ¶
type CommonReference ¶
type CommonReference struct { Name string Parameters []ReferenceParameter Depth int }
CommonReference contains parameters info of HelmCategory and KubuCategory type capability at present
type CommonSchema ¶
CommonSchema is a struct contains *openapi3.Schema style parameter
type ConsoleReference ¶
type ConsoleReference struct { ParseReference TableName string `json:"tableName"` TableObject *tablewriter.Table `json:"tableObject"` }
ConsoleReference is the struct for capability information in console
func (*ConsoleReference) GenerateCUETemplateProperties ¶
func (ref *ConsoleReference) GenerateCUETemplateProperties(capability *types.Capability, pd *packages.PackageDiscover) (string, []ConsoleReference, error)
GenerateCUETemplateProperties get all properties of a capability
func (*ConsoleReference) GenerateTerraformCapabilityProperties ¶
func (ref *ConsoleReference) GenerateTerraformCapabilityProperties(capability types.Capability) ([]ConsoleReference, error)
GenerateTerraformCapabilityProperties generates Capability properties for Terraform ComponentDefinition in Cli console
type FromCluster ¶
type FromCluster struct { Namespace string `json:"namespace"` Rev int64 `json:"revision"` PD *packages.PackageDiscover }
FromCluster is the struct for input Namespace
type FromLocal ¶
type FromLocal struct {
Path string `json:"path"`
}
FromLocal is the struct for input Definition Path
type I18n ¶
type I18n struct {
// contains filtered or unexported fields
}
I18n will automatically get translated data
type MarkdownReference ¶
type MarkdownReference struct { Filter func(types.Capability) bool AllInOne bool ForceExample bool CustomDocHeader string DiscoveryMapper discoverymapper.DiscoveryMapper ParseReference }
MarkdownReference is the struct for capability information in
func (*MarkdownReference) CreateMarkdown ¶
func (ref *MarkdownReference) CreateMarkdown(ctx context.Context, caps []types.Capability, baseRefPath string, catalog bool, pd *packages.PackageDiscover) error
CreateMarkdown creates markdown based on capabilities
func (*MarkdownReference) GenerateMarkdownForCap ¶
func (ref *MarkdownReference) GenerateMarkdownForCap(ctx context.Context, c types.Capability, pd *packages.PackageDiscover, containSuffix bool) (string, error)
GenerateMarkdownForCap will generate markdown for one capability
func (*MarkdownReference) GenerateReferenceDocs ¶
func (ref *MarkdownReference) GenerateReferenceDocs(ctx context.Context, c common.Args, baseRefPath string) error
GenerateReferenceDocs generates reference docs
func (*MarkdownReference) GenerateTerraformCapabilityPropertiesAndOutputs ¶
func (ref *MarkdownReference) GenerateTerraformCapabilityPropertiesAndOutputs(capability types.Capability) (string, error)
GenerateTerraformCapabilityPropertiesAndOutputs generates Capability properties and outputs for Terraform ComponentDefinition
type ParseReference ¶
type ParseReference struct { Client client.Client I18N *I18n `json:"i18n"` Remote *FromCluster `json:"remote"` Local *FromLocal `json:"local"` DefinitionName string `json:"definitionName"` DisplayFormat string }
ParseReference is used to include the common function `parseParameter`
func (*ParseReference) GenerateHelmAndKubeProperties ¶
func (ref *ParseReference) GenerateHelmAndKubeProperties(ctx context.Context, capability *types.Capability) ([]CommonReference, []ConsoleReference, error)
GenerateHelmAndKubeProperties get all properties of a Helm/Kube Category type capability
type Reference ¶
type Reference interface {
// contains filtered or unexported methods
}
Reference is the struct for capability information
type ReferenceParameter ¶
type ReferenceParameter struct { types.Parameter `json:",inline,omitempty"` // PrintableType is same to `parameter.Type` which could be printable PrintableType string `json:"printableType"` }
ReferenceParameter is the parameter section of CUE template
type ReferenceParameterTable ¶
type ReferenceParameterTable struct { Name string Parameters []ReferenceParameter Depth *int }
ReferenceParameterTable stores the information of a bunch of ReferenceParameter in a table style