Documentation
¶
Index ¶
- Constants
- Variables
- func GetAirshipConfigPath(request configs.WsMessage) configs.WsMessage
- func GetContexts(request configs.WsMessage) configs.WsMessage
- func GetCurrentContext(request configs.WsMessage) configs.WsMessage
- func GetEncryptionConfigs(request configs.WsMessage) configs.WsMessage
- func GetManagementConfigs(request configs.WsMessage) configs.WsMessage
- func GetManifests(request configs.WsMessage) configs.WsMessage
- func HandleBaremetalRequest(user *string, request configs.WsMessage) configs.WsMessage
- func HandleClusterRequest(user *string, request configs.WsMessage) configs.WsMessage
- func HandleConfigRequest(user *string, request configs.WsMessage) configs.WsMessage
- func HandleDocumentRequest(user *string, request configs.WsMessage) configs.WsMessage
- func HandleHistoryRequest(user *string, request configs.WsMessage) configs.WsMessage
- func HandleImageRequest(user *string, request configs.WsMessage) configs.WsMessage
- func HandlePhaseRequest(user *string, request configs.WsMessage) configs.WsMessage
- func HandleSecretRequest(user *string, request configs.WsMessage) configs.WsMessage
- func Init()
- func InitAirshipConfig(request configs.WsMessage) configs.WsMessage
- func NewUIEventProcessor(sessionID string, task *task.Task) events.EventProcessor
- func SetAirshipConfig(request configs.WsMessage) configs.WsMessage
- func SetContext(request configs.WsMessage) configs.WsMessage
- func SetEncryptionConfig(request configs.WsMessage) configs.WsMessage
- func SetManagementConfig(request configs.WsMessage) configs.WsMessage
- func SetManifest(request configs.WsMessage) configs.WsMessage
- func UseContext(request configs.WsMessage) configs.WsMessage
- type Client
- func (c *Client) GetExecutorDoc(id string) (string, string, error)
- func (c *Client) GetPhase(id string) (string, string, string, error)
- func (client *Client) GetPhaseSourceFiles(id ifc.ID) ([]KustomNode, error)
- func (client *Client) GetPhaseTree() ([]KustomNode, error)
- func (c *Client) RunPhase(request configs.WsMessage) error
- func (c *Client) ValidatePhase(id, sessionID string) (bool, error)
- type Context
- type EncryptionConfig
- type GVK
- type KustomNode
- type LogInterceptor
- type ManagementConfig
- type Manifest
- type SelectorParams
- type UIEventProcessor
Constants ¶
const (
// AirshipConfigNotFoundErr generic error for missing airship config file
AirshipConfigNotFoundErr = "No airship config file found."
)
Variables ¶
var CTLFunctionMap = map[configs.WsComponentType]func(*string, configs.WsMessage) configs.WsMessage{ configs.Baremetal: HandleBaremetalRequest, configs.Cluster: HandleClusterRequest, configs.CTLConfig: HandleConfigRequest, configs.Document: HandleDocumentRequest, configs.History: HandleHistoryRequest, configs.Image: HandleImageRequest, configs.Phase: HandlePhaseRequest, configs.Secret: HandleSecretRequest, }
CTLFunctionMap is a function map for the CTL functions that is referenced in the webservice
var ConfigFunctionMap = map[configs.WsSubComponentType]func(configs.WsMessage) configs.WsMessage{ configs.SetAirshipConfig: SetAirshipConfig, configs.GetAirshipConfigPath: GetAirshipConfigPath, configs.GetCurrentContext: GetCurrentContext, configs.GetContexts: GetContexts, configs.GetEncryptionConfigs: GetEncryptionConfigs, configs.GetManagementConfigs: GetManagementConfigs, configs.GetManifests: GetManifests, configs.Init: InitAirshipConfig, configs.SetContext: SetContext, configs.SetEncryptionConfig: SetEncryptionConfig, configs.SetManagementConfig: SetManagementConfig, configs.SetManifest: SetManifest, configs.UseContext: UseContext, }
ConfigFunctionMap is being used to call the appropriate function based on the SubComponentType, since the linter seems to think there are too many cases for a switch / case
Functions ¶
func GetAirshipConfigPath ¶
GetAirshipConfigPath returns value stored in AirshipConfigPath
func GetContexts ¶
GetContexts returns a slice of wrapper Context structs so we know the name of each for display in the UI
func GetCurrentContext ¶
GetCurrentContext returns the name of the currently configured context
func GetEncryptionConfigs ¶
GetEncryptionConfigs returns a slice of wrapper EncryptionConfig structs so we know the name of each for display in the UI
func GetManagementConfigs ¶
GetManagementConfigs function to retrieve all management configs
func GetManifests ¶
GetManifests returns a slice of wrapper Manifest structs so we know the name of each for display in the UI
func HandleBaremetalRequest ¶
HandleBaremetalRequest will flop between requests so we don't have to have them all mapped as function calls This will wait for the sub component to complete before responding. The assumption is this is an async request
func HandleClusterRequest ¶
HandleClusterRequest will flop between requests so we don't have to have them all mapped as function calls This will wait for the sub component to complete before responding. The assumption is this is an async request
func HandleConfigRequest ¶
HandleConfigRequest will find the appropriate subcomponent function in the function map and wait for it to complete before returning the response message
func HandleDocumentRequest ¶
HandleDocumentRequest will flop between requests so we don't have to have them all mapped as function calls
func HandleHistoryRequest ¶
HandleHistoryRequest will flop between requests so we don't have to have them all mapped as function calls This will wait for the sub component to complete before responding. The assumption is this is an async request
func HandleImageRequest ¶
HandleImageRequest will flop between requests so we don't have to have them all mapped as function calls This will wait for the sub component to complete before responding. The assumption is this is an async request
func HandlePhaseRequest ¶
HandlePhaseRequest will flop between requests so we don't have to have them all mapped as function calls This will wait for the sub component to complete before responding. The assumption is this is an async request
func HandleSecretRequest ¶
HandleSecretRequest will flop between requests so we don't have to have them all mapped as function calls This will wait for the sub component to complete before responding. The assumption is this is an async request
func Init ¶
func Init()
Init allows for the circular reference to the webservice package to be broken and allow for the sending of arbitrary messages from any package to the websocket
func InitAirshipConfig ¶
InitAirshipConfig wrapper function for CTL's CreateConfig using the specified path TODO(mfuller): we'll need to persist this info in airshipui.json so that we can set AirshipConfigPath at app launch
func NewUIEventProcessor ¶
func NewUIEventProcessor(sessionID string, task *task.Task) events.EventProcessor
NewUIEventProcessor returns instance of UIEventProcessor for current session ID
func SetAirshipConfig ¶
SetAirshipConfig sets the AirshipConfigPath to the value specified by UI client
func SetContext ¶
SetContext wrapper function for CTL's RunSetContext, using a UI client
func SetEncryptionConfig ¶
SetEncryptionConfig wrapper function for CTL's RunSetEncryptionConfig, using a UI client
func SetManagementConfig ¶
SetManagementConfig sets the specified management configuration with values received from the frontend client TODO(mfuller): there's currently no setter for this in the CTL config pkg so we'll set the values manually and then persist the config
func SetManifest ¶
SetManifest wrapper function for CTL's RunSetManifest, using a UI client
Types ¶
type Client ¶
type Client struct { Config *config.Config Debug bool // this is a placeholder until I figure out how / where to set this in airshipctl }
Client provides a library of functions that enable external programs (e.g. Airship UI) to perform airshipctl functionality in exactly the same manner as the CLI.
func NewClient ¶
NewClient initializes the airshipctl client for external usage with the logging overridden.
func NewDefaultClient ¶
NewDefaultClient initializes the airshipctl client for external usage with default logging.
func (*Client) GetExecutorDoc ¶
GetExecutorDoc returns the title and YAML of the executor document for the specified phase
func (*Client) GetPhase ¶
GetPhase returns the name, description, and doc bundle for specified phase
func (*Client) GetPhaseSourceFiles ¶
func (client *Client) GetPhaseSourceFiles(id ifc.ID) ([]KustomNode, error)
GetPhaseSourceFiles returns a slice of KustomNodes representing all of the directories that will be traversed when kustomize builds the document bundle. The tree hierarchy is: kustomize "type" (like function) -> directory name -> file name
func (*Client) GetPhaseTree ¶
func (client *Client) GetPhaseTree() ([]KustomNode, error)
GetPhaseTree builds the initial structure of the phase tree consisting of phase Groups and Phases. Individual phase source files or rendered documents will be lazy loaded as needed
type EncryptionConfig ¶
type EncryptionConfig struct { Name string `json:"name"` ctlconfig.EncryptionConfig }
EncryptionConfig wrapper struct for CTL's EncryptionConfiguration that includes a name
type GVK ¶
type GVK struct { Group string `json:"group"` Version string `json:"version"` Kind string `json:"kind"` }
GVK small structure to hold group, version, kind for building a Selector
type KustomNode ¶
type KustomNode struct { ID string `json:"id"` PhaseID ifc.ID `json:"phaseId"` Name string `json:"name"` IsPhaseNode bool `json:"isPhaseNode"` HasError bool `json:"hasError"` HasDocuments bool `json:"hasDocuments"` Children []KustomNode `json:"children"` }
KustomNode structure to represent the kustomization tree for a given phase bundle to be consumed by the UI frontend
func GetDocumentsBySelector ¶
func GetDocumentsBySelector(id string, data string) ([]KustomNode, error)
GetDocumentsBySelector returns a slice of KustomNodes representing all phase documents returned by applying the provided Selector
type LogInterceptor ¶
type LogInterceptor struct {
// contains filtered or unexported fields
}
LogInterceptor is just a struct to hold a pointer to the remote channel
func NewLogInterceptor ¶
func NewLogInterceptor(request configs.WsMessage) *LogInterceptor
NewLogInterceptor will construct a channel writer for use with the logger
type ManagementConfig ¶
type ManagementConfig struct { Name string `json:"Name"` ctlconfig.ManagementConfiguration }
ManagementConfig wrapper struct for CTL's ManagementConfiguration that includes a name
type SelectorParams ¶
type SelectorParams struct { Name string `json:"name,omitempty"` Namespace string `json:"namespace,omitempty"` GVK GVK `json:"gvk,omitempty"` Kind string `json:"kind,omitempty"` Label string `json:"label,omitempty"` Annotation string `json:"annotation,omitempty"` }
SelectorParams structure to hold data for constructing a document Selector
type UIEventProcessor ¶
type UIEventProcessor struct {
// contains filtered or unexported fields
}
UIEventProcessor basic structure to hold eventsChan, session ID, and errors
func (*UIEventProcessor) Close ¶
func (p *UIEventProcessor) Close()
Close implements EventProcessor interface