types

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const PluginProxyRoutePath = "/proxy/plugins/"

PluginProxyRoutePath the route prefix to request the plugin backend server.

Variables

View Source
var PluginTypes = []Type{
	PageApp,
	Definition,
}

PluginTypes plugin type definition

Functions

This section is empty.

Types

type AuthType

type AuthType string

AuthType The authentication type of the backend server

var (
	// Basic Authentication is a method to provide a username and password when making a request.
	Basic AuthType = "basic"
)

type BackendType

type BackendType string

BackendType the backend server type

var (
	// KubeAPI Proxy the Kubernetes API.
	// this plugin need to define the permission of Kubernetes RBAC.
	// When installing the plugin, Vela will create a Role and use this role to request the Kubernetes API.
	KubeAPI BackendType = "kube-api"
	// KubeService Discover the backend by the Kubernetes service.
	KubeService BackendType = "kube-service"
	// StaticServer Discover the backend by the plugin setting
	StaticServer BackendType = "static-server"
)

type BasicAuth

type BasicAuth struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

BasicAuth username

type BuildInfo

type BuildInfo struct {
	Time   int64  `json:"time,omitempty"`
	Repo   string `json:"repo,omitempty"`
	Branch string `json:"branch,omitempty"`
	Hash   string `json:"hash,omitempty"`
}

BuildInfo the plugin build info

type Class

type Class string

Class -

const (
	// Core plugin, the plugins belong to this class will be installed default.
	Core Class = "core"
	// External plugin, installed from the community registry.
	External Class = "external"
)
type Header struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Header describes an HTTP header that is forwarded with the proxied request for a plugin route

type Includes

type Includes struct {
	Name         string      `json:"name"`
	Label        string      `json:"label"`
	To           string      `json:"to"`
	Type         string      `json:"type"`
	Icon         string      `json:"icon"`
	Workspace    Workspace   `json:"workspace"`
	Permission   *Permission `json:"permission,omitempty"`
	RelatedRoute []string    `json:"relatedRoute"`
	Catalog      string      `json:"catalog,omitempty"`
}

Includes means the menus that this plugin include.

type Info

type Info struct {
	Author      InfoLink      `json:"author"`
	Description string        `json:"description"`
	Links       []InfoLink    `json:"links"`
	Logos       Logos         `json:"logos"`
	Build       BuildInfo     `json:"build"`
	Screenshots []Screenshots `json:"screenshots"`
	Version     string        `json:"version"`
	Updated     string        `json:"updated"`
}

Info the info model

type InfoLink struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

InfoLink the link model

type JSONData

type JSONData struct {
	ID   string `json:"id"`
	Type Type   `json:"type"`
	// there are four sub types in the definition plugin type, includes: component, trait, policy ,and workflow-step.
	SubType  string      `json:"subType"`
	Name     string      `json:"name"`
	Info     Info        `json:"info"`
	Includes []*Includes `json:"includes"`
	Category string      `json:"category"`
	// Backend If the plugin has a backend component.
	Backend     bool              `json:"backend"`
	Proxy       bool              `json:"proxy"`
	BackendType BackendType       `json:"backendType"`
	AuthType    AuthType          `json:"authType,omitempty"`
	AuthSecret  *KubernetesSecret `json:"authSecret,omitempty"`
	// For the kube auth type, define the max scope permission for this plugin.
	KubePermissions []rbacv1.PolicyRule `json:"kubePermissions,omitempty"`
	// For the KubeService backend type
	BackendService *KubernetesService `json:"backendService"`
	// Routes define the route to proxy the backend server.
	Routes      []*Route     `json:"routes,omitempty"`
	Requirement *Requirement `json:"requirement,omitempty"`
}

JSONData represents the plugin's plugin.json

type JWTTokenAuth

type JWTTokenAuth struct {
	URL    string            `json:"url"`
	Scopes []string          `json:"scopes"`
	Params map[string]string `json:"params"`
}

JWTTokenAuth struct is both for normal Token Auth and JWT Token Auth with an uploaded JWT file.

type KubernetesSecret

type KubernetesSecret struct {
	Name string `json:"name"`
	// If namespace is not specified, find the service from the vela system namespace
	Namespace string `json:"namespace"`
}

KubernetesSecret define one kubernetes secret

type KubernetesService

type KubernetesService struct {
	Name string `json:"name"`
	// If namespace is not specified, find the service from the vela system namespace
	Namespace string `json:"namespace"`
	// If port is not specified, find the first port from the service
	Port int32 `json:"port"`
}

KubernetesService define one kubernetes service

type Logos

type Logos struct {
	Small string `json:"small"`
	Large string `json:"large"`
}

Logos the log model

type Permission

type Permission struct {
	Resource string `json:"resource"`
	Action   string `json:"action"`
}

Permission RBAC permission policy

type Plugin

type Plugin struct {
	JSONData
	PluginDir     string
	Class         Class
	DefaultNavURL string
	// SystemJS fields
	Module  string
	BaseURL string
}

Plugin VelaUX plugin model

func (*Plugin) IsCorePlugin

func (p *Plugin) IsCorePlugin() bool

IsCorePlugin checking the plugin whether is the core plugin

func (*Plugin) IsExternalPlugin

func (p *Plugin) IsExternalPlugin() bool

IsExternalPlugin checking the plugin whether is the external plugin

func (*Plugin) IsPageApp

func (p *Plugin) IsPageApp() bool

IsPageApp checking the plugin whether is the page app plugin

func (*Plugin) PluginID

func (p *Plugin) PluginID() string

PluginID return the plugin ID

func (*Plugin) StaticRoute

func (p *Plugin) StaticRoute() *StaticRoute

StaticRoute generate the plugin static file route

type PluginSource

type PluginSource struct {
	Class Class
	Paths []string
}

PluginSource the plugin source.

type Requirement

type Requirement struct {
	VelaUXVersion string `json:"velauxVersion"`
}

Requirement the plugin requirement

type Route

type Route struct {
	// Route conditions.
	// Path format like: /nodes/:nodeName
	Path   string `json:"path"`
	Method string `json:"method"`

	// Permission checking
	ResourceMap map[string]string `json:"resourceMap,omitempty"`
	Permission  *Permission       `json:"permission,omitempty"`

	// Proxy parameters
	ProxyHeaders []Header `json:"headers,omitempty"`
}

Route describes a plugin route that is defined in the plugin.json file for a plugin.

type Screenshots

type Screenshots struct {
	Name string `json:"name"`
	Path string `json:"path"`
}

Screenshots the screenshot model

type StaticRoute

type StaticRoute struct {
	PluginID  string
	Directory string
}

StaticRoute -

type Type

type Type string

Type the plugin type

const (
	// PageApp means plugin provide a independent page. The route maybe like `/plugins/{pluginID}`
	PageApp Type = "page-app"
	// Definition means the plugin provides a UI component for the component,trait, workflow-step, and policy definitions.
	Definition Type = "definition"
)

func (Type) IsValid

func (pt Type) IsValid() bool

IsValid checking the plugin type

type Workspace

type Workspace struct {
	Name string `json:"name"`
}

Workspace the workspace menu

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL