ctl

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: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AirshipConfigNotFoundErr generic error for missing airship config file
	AirshipConfigNotFoundErr = "No airship config file found."
)

Variables

CTLFunctionMap is a function map for the CTL functions that is referenced in the webservice

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

func GetAirshipConfigPath(request configs.WsMessage) configs.WsMessage

GetAirshipConfigPath returns value stored in AirshipConfigPath

func GetContexts

func GetContexts(request configs.WsMessage) configs.WsMessage

GetContexts returns a slice of wrapper Context structs so we know the name of each for display in the UI

func GetCurrentContext

func GetCurrentContext(request configs.WsMessage) configs.WsMessage

GetCurrentContext returns the name of the currently configured context

func GetEncryptionConfigs

func GetEncryptionConfigs(request configs.WsMessage) configs.WsMessage

GetEncryptionConfigs returns a slice of wrapper EncryptionConfig structs so we know the name of each for display in the UI

func GetManagementConfigs

func GetManagementConfigs(request configs.WsMessage) configs.WsMessage

GetManagementConfigs function to retrieve all management configs

func GetManifests

func GetManifests(request configs.WsMessage) configs.WsMessage

GetManifests returns a slice of wrapper Manifest structs so we know the name of each for display in the UI

func HandleBaremetalRequest

func HandleBaremetalRequest(user *string, request configs.WsMessage) configs.WsMessage

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

func HandleClusterRequest(user *string, request configs.WsMessage) configs.WsMessage

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

func HandleConfigRequest(user *string, request configs.WsMessage) configs.WsMessage

HandleConfigRequest will find the appropriate subcomponent function in the function map and wait for it to complete before returning the response message

func HandleDocumentRequest

func HandleDocumentRequest(user *string, request configs.WsMessage) configs.WsMessage

HandleDocumentRequest will flop between requests so we don't have to have them all mapped as function calls

func HandleHistoryRequest

func HandleHistoryRequest(user *string, request configs.WsMessage) configs.WsMessage

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

func HandleImageRequest(user *string, request configs.WsMessage) configs.WsMessage

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

func HandlePhaseRequest(user *string, request configs.WsMessage) configs.WsMessage

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

func HandleSecretRequest(user *string, request configs.WsMessage) configs.WsMessage

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

func InitAirshipConfig(request configs.WsMessage) configs.WsMessage

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

func SetAirshipConfig(request configs.WsMessage) configs.WsMessage

SetAirshipConfig sets the AirshipConfigPath to the value specified by UI client

func SetContext

func SetContext(request configs.WsMessage) configs.WsMessage

SetContext wrapper function for CTL's RunSetContext, using a UI client

func SetEncryptionConfig

func SetEncryptionConfig(request configs.WsMessage) configs.WsMessage

SetEncryptionConfig wrapper function for CTL's RunSetEncryptionConfig, using a UI client

func SetManagementConfig

func SetManagementConfig(request configs.WsMessage) configs.WsMessage

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

func SetManifest(request configs.WsMessage) configs.WsMessage

SetManifest wrapper function for CTL's RunSetManifest, using a UI client

func UseContext

func UseContext(request configs.WsMessage) configs.WsMessage

UseContext wrapper function for CTL's RunUseConfig, 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

func NewClient(airshipConfigPath *string, request configs.WsMessage) (*Client, error)

NewClient initializes the airshipctl client for external usage with the logging overridden.

func NewDefaultClient

func NewDefaultClient(airshipConfigPath *string) (*Client, error)

NewDefaultClient initializes the airshipctl client for external usage with default logging.

func (*Client) GetExecutorDoc

func (c *Client) GetExecutorDoc(id string) (string, string, error)

GetExecutorDoc returns the title and YAML of the executor document for the specified phase

func (*Client) GetPhase

func (c *Client) GetPhase(id string) (string, string, string, error)

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

func (*Client) RunPhase

func (c *Client) RunPhase(request configs.WsMessage) error

RunPhase runs the selected phase

func (*Client) ValidatePhase

func (c *Client) ValidatePhase(id, sessionID string) (bool, error)

ValidatePhase validates the specified phase (ifc.Phase.Validate isn't implemented yet, so this function currently always returns "valid")

type Context

type Context struct {
	Name string `json:"name"`
	ctlconfig.Context
}

Context wrapper struct to include context name with CTL's Context

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

func (*LogInterceptor) Write

func (cw *LogInterceptor) Write(data []byte) (n int, err error)

Write satisfies the implementation of io.Writer. The intention is to hijack the log output for a progress bar on the UI

type ManagementConfig

type ManagementConfig struct {
	Name string `json:"Name"`
	ctlconfig.ManagementConfiguration
}

ManagementConfig wrapper struct for CTL's ManagementConfiguration that includes a name

type Manifest

type Manifest struct {
	Name     string              `json:"name"`
	Manifest *ctlconfig.Manifest `json:"manifest"`
}

Manifest wraps CTL's Manifest to include the manifest 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

func (*UIEventProcessor) Process

func (p *UIEventProcessor) Process(ch <-chan events.Event) error

Process implements EventProcessor interface

Jump to

Keyboard shortcuts

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