types

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultOAMNS               = "vela-system"
	DefaultOAMReleaseName      = "kubevela"
	DefaultOAMRuntimeChartName = "vela-core"
	DefaultOAMVersion          = ">0.0.0-0"

	DefaultEnvName      = "default"
	DefaultAppNamespace = "default"
)
View Source
const (
	AnnAPIVersion  = "definition.oam.dev/apiVersion"
	AnnKind        = "definition.oam.dev/kind"
	AnnDescription = "definition.oam.dev/description"

	LabelPodSpecable = "workload.oam.dev/podspecable"
)
View Source
const (
	StatusDeployed = "Deployed"
	StatusStaging  = "Staging"
)
View Source
const (
	TagCommandType = "commandType"

	TypeStart   = "Getting Started"
	TypeApp     = "Applications"
	TypeTraits  = "Traits"
	TypeRelease = "Release"
	TypeOthers  = "Others"
	TypeSystem  = "System"
)

Variables

View Source
var CapabilityCmpOptions = []cmp.Option{
	cmp.Comparer(func(a, b Parameter) bool {
		if a.Name != b.Name || a.Short != b.Short || a.Required != b.Required ||
			a.Usage != b.Usage || a.Type != b.Type {
			return false
		}
		switch a.Type {
		case cue.IntKind:
			var va, vb int64
			switch vala := a.Default.(type) {
			case int64:
				va = vala
			case json.Number:
				va, _ = vala.Int64()
			case int:
				va = int64(vala)
			case float64:
				va = int64(vala)
			}
			switch valb := b.Default.(type) {
			case int64:
				vb = valb
			case json.Number:
				vb, _ = valb.Int64()
			case int:
				vb = int64(valb)
			case float64:
				vb = int64(valb)
			}
			return va == vb
		case cue.StringKind:
			return a.Default.(string) == b.Default.(string)
		case cue.BoolKind:
			return a.Default.(bool) == b.Default.(bool)
		case cue.NumberKind, cue.FloatKind:
			var va, vb float64
			switch vala := a.Default.(type) {
			case int64:
				va = float64(vala)
			case json.Number:
				va, _ = vala.Float64()
			case int:
				va = float64(vala)
			case float64:
				va = float64(vala)
			}
			switch valb := b.Default.(type) {
			case int64:
				vb = float64(valb)
			case json.Number:
				vb, _ = valb.Float64()
			case int:
				vb = float64(valb)
			case float64:
				vb = float64(valb)
			}
			return va == vb
		}
		return true
	})}

Functions

func EqualCapability added in v0.0.9

func EqualCapability(a, b Capability) bool

func SetFlagBy

func SetFlagBy(flags *pflag.FlagSet, v Parameter)

Types

type Args

type Args struct {
	Config *rest.Config
	Schema *runtime.Scheme
}

type CapType

type CapType string
const (
	TypeWorkload CapType = "workload"
	TypeTrait    CapType = "trait"
	TypeScope    CapType = "scope"
)

type Capability

type Capability struct {
	Name           string      `json:"name"`
	Type           CapType     `json:"type"`
	CueTemplate    string      `json:"template,omitempty"`
	CueTemplateURI string      `json:"templateURI,omitempty"`
	Parameters     []Parameter `json:"parameters,omitempty"`
	DefinitionPath string      `json:"definition"`
	CrdName        string      `json:"crdName,omitempty"`
	Center         string      `json:"center,omitempty"`
	Status         string      `json:"status,omitempty"`
	Description    string      `json:"description,omitempty"`

	//trait only
	AppliesTo []string `json:"appliesTo,omitempty"`

	// Plugin Source
	Source  *Source       `json:"source,omitempty"`
	Install *Installation `json:"install,omitempty"`
	CrdInfo *CrdInfo      `json:"crdInfo,omitempty"`
}

Capability defines the content of a capability

func ConvertTemplateJSON2Object

func ConvertTemplateJSON2Object(in *runtime.RawExtension) (Capability, error)

ConvertTemplateJSON2Object convert spec.extension to object

type Chart

type Chart struct {
	Repo      string `json:"repo"`
	URL       string `json:"url"`
	Name      string `json:"name"`
	Namespace string `json:"namespace,omitempty"`
	Version   string `json:"version"`
}

type CrdInfo

type CrdInfo struct {
	APIVersion string `json:"apiVersion"`
	Kind       string `json:"kind"`
}

type EnvMeta

type EnvMeta struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
	Email     string `json:"email,omitempty"`
	Domain    string `json:"domain,omitempty"`

	// Below are not arguments, should be auto-generated
	Issuer  string `json:"issuer"`
	Current string `json:"current,omitempty"`
}

type Installation

type Installation struct {
	Helm Chart `json:"helm"`
}

type Parameter

type Parameter struct {
	Name     string      `json:"name"`
	Short    string      `json:"short,omitempty"`
	Required bool        `json:"required,omitempty"`
	Default  interface{} `json:"default,omitempty"`
	Usage    string      `json:"usage,omitempty"`
	Type     cue.Kind    `json:"type,omitempty"`
	Alias    string      `json:"alias,omitempty"`
}

type Source

type Source struct {
	RepoName  string `json:"repoName"`
	ChartName string `json:"chartName,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳