configs

package
v0.0.0-...-aeaf823 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CTL   WsRequestType = "ctl"
	UI    WsRequestType = "ui"
	Alert WsRequestType = "alert"

	// UI components
	Authcomplete WsComponentType = "authcomplete"
	SetConfig    WsComponentType = "setConfig"
	Initialize   WsComponentType = "initialize"
	Keepalive    WsComponentType = "keepalive"
	Auth         WsComponentType = "auth"
	Log          WsComponentType = "log"
	Task         WsComponentType = "task"

	// task subcomponents
	TaskStart  WsSubComponentType = "taskStart"
	TaskUpdate WsSubComponentType = "taskUpdate"
	TaskRemove WsSubComponentType = "taskRemove"
	TaskEnd    WsSubComponentType = "taskEnd"

	// CTL components
	Baremetal WsComponentType = "baremetal"
	Cluster   WsComponentType = "cluster"
	CTLConfig WsComponentType = "config"
	Document  WsComponentType = "document"
	History   WsComponentType = "history"
	Image     WsComponentType = "image"
	Phase     WsComponentType = "phase"
	Secret    WsComponentType = "secret"

	// actions direct or phase
	DirectAction string = "direct"
	PhaseAction  string = "phase"

	// auth subcomponets
	Approved     WsSubComponentType = "approved"
	Authenticate WsSubComponentType = "authenticate"
	Denied       WsSubComponentType = "denied"
	Refresh      WsSubComponentType = "refresh"
	Validate     WsSubComponentType = "validate"

	// ctl subcomponets
	// ctl baremetal subcomponets
	EjectMedia   WsSubComponentType = "ejectmedia"
	PowerOff     WsSubComponentType = "poweroff"
	PowerOn      WsSubComponentType = "poweron"
	PowerStatus  WsSubComponentType = "powerstatus"
	Reboot       WsSubComponentType = "reboot"
	RemoteDirect WsSubComponentType = "remotedirect"

	// ctl cluster subcomponets
	Move   WsSubComponentType = "move"
	Status WsSubComponentType = "status"

	// ctl config subcomponets
	SetAirshipConfig     WsSubComponentType = "setAirshipConfig"
	GetAirshipConfigPath WsSubComponentType = "getAirshipConfigPath"
	GetContexts          WsSubComponentType = "getContexts"
	GetCurrentContext    WsSubComponentType = "getCurrentContext"
	GetEncryptionConfigs WsSubComponentType = "getEncryptionConfigs"
	GetManagementConfigs WsSubComponentType = "getManagementConfigs"
	GetManifests         WsSubComponentType = "getManifests"
	SetContext           WsSubComponentType = "setContext"
	SetEncryptionConfig  WsSubComponentType = "setEncryptionConfig"
	SetManagementConfig  WsSubComponentType = "setManagementConfig"
	SetManifest          WsSubComponentType = "setManifest"
	UseContext           WsSubComponentType = "useContext"
	GetConfig            WsSubComponentType = "getConfig"

	// ctl document subcomponents
	Plugin WsSubComponentType = "plugin"
	Pull   WsSubComponentType = "pull"

	// ctl image subcomponents
	Build WsSubComponentType = "build"

	// ctl phase subcomponents
	Plan WsSubComponentType = "plan"
	// we may not need to implement phase render since that's
	// what's already being shown in the document-viewer
	Render        WsSubComponentType = "render"
	Run           WsSubComponentType = "run"
	ValidatePhase WsSubComponentType = "validatePhase"

	// ctl secret subcomponents
	Generate WsSubComponentType = "generate"

	// ctl common components
	Init                   WsSubComponentType = "init"
	GetDefaults            WsSubComponentType = "getDefaults"
	YamlWrite              WsSubComponentType = "yamlWrite"
	GetYaml                WsSubComponentType = "getYaml"
	GetRendered            WsSubComponentType = "getRendered"
	GetPhaseTree           WsSubComponentType = "getPhaseTree"
	GetPhaseSourceFiles    WsSubComponentType = "getPhaseSourceFiles"
	GetDocumentsBySelector WsSubComponentType = "getDocumentsBySelector"
	GetPhase               WsSubComponentType = "getPhase"
	GetExecutorDoc         WsSubComponentType = "getExecutorDoc"
	GetPhaseDetails        WsSubComponentType = "getPhaseDetails"
)

constants related to specific request/component/subcomponent types for WsRequests

Variables

View Source
var (
	UIConfig     Config
	UIConfigFile string
)

variables related to UI config

Functions

func SetUIConfig

func SetUIConfig() error

SetUIConfig sets the UIConfig object with values obtained from airshipui.json, located at 'filename' TODO: add watcher to the json file to reload conf on change (maybe not needed)

Types

type AuthMethod

type AuthMethod struct {
	Type  string   `json:"type,omitempty"`
	Value []string `json:"values,omitempty"`
	URL   string   `json:"url,omitempty"`
}

AuthMethod structure to hold authentication parameters

type Authentication

type Authentication struct {
	ID       string `json:"id,omitempty"`
	Password string `json:"password,omitempty"`
}

Authentication structure to hold authentication parameters

type Config

type Config struct {
	WebService        *WebService       `json:"webservice,omitempty"`
	AuthMethod        *AuthMethod       `json:"authMethod,omitempty"`
	Dashboards        []Dashboard       `json:"dashboards,omitempty"`
	Users             map[string]string `json:"users,omitempty"`
	AirshipConfigPath *string           `json:"airshipConfigPath,omitempty"`
}

Config basic structure to hold configuration params for Airship UI

func (*Config) Persist

func (c *Config) Persist() error

Persist saves the current UIConfig to the airshipui.json config file

type Dashboard

type Dashboard struct {
	Name      string `json:"name,omitempty"`
	BaseURL   string `json:"baseURL,omitempty"`
	Path      string `json:"path,omitempty"`
	IsProxied bool   `json:"isProxied,omitempty"`
}

Dashboard structure

type WebService

type WebService struct {
	Host       string `json:"host,omitempty"`
	Port       int    `json:"port,omitempty"`
	PublicKey  string `json:"publicKey,omitempty"`
	PrivateKey string `json:"privateKey,omitempty"`
}

WebService describes the things we need to know to start the web container

type WsComponentType

type WsComponentType string

WsComponentType is used to set the specific component types allowable for WsRequests

type WsMessage

type WsMessage struct {
	// base components of a message
	SessionID    string             `json:"sessionID,omitempty"`
	Type         WsRequestType      `json:"type,omitempty"`
	Component    WsComponentType    `json:"component,omitempty"`
	SubComponent WsSubComponentType `json:"subComponent,omitempty"`
	Timestamp    int64              `json:"timestamp,omitempty"`

	// additional conditional components that may or may not be involved in the request / response
	IsAuthenticated bool        `json:"isAuthenticated,omitempty"`
	Data            interface{} `json:"data,omitempty"`
	YAML            string      `json:"yaml,omitempty"`
	Name            string      `json:"name,omitempty"`
	Details         string      `json:"details,omitempty"`
	ID              string      `json:"id,omitempty"`
	Error           *string     `json:"error,omitempty"`
	Message         *string     `json:"message,omitempty"`
	Token           *string     `json:"token,omitempty"`
	RefreshToken    *string     `json:"refreshToken,omitempty"`

	// used by baremetal CTL requests
	ActionType *string   `json:"actionType,omitempty"` // signifies if it's a phase or direct action
	Target     *string   `json:"target,omitempty"`     // singular target (usually in a response)
	Targets    *[]string `json:"targets,omitempty"`    // multiple targets (usually in a request)

	// used for auth
	Authentication *Authentication `json:"authentication,omitempty"`

	// information related to the init of the UI
	Dashboards     []Dashboard            `json:"dashboards,omitempty"`
	AuthMethod     *AuthMethod            `json:"authMethod,omitempty"`
	ContextOptions *config.ContextOptions `json:"contextOptions,omitempty"`
}

WsMessage is a request / return structure used for websockets

type WsRequestType

type WsRequestType string

WsRequestType is used to set the specific types allowable for WsRequests

type WsSubComponentType

type WsSubComponentType string

WsSubComponentType is used to set the specific subcomponent types allowable for WsRequests

Jump to

Keyboard shortcuts

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