daemontypes

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const StepNameApply = "terraform.apply"
View Source
const StepNameConfig = "render.config"
View Source
const StepNameConfirm = "render.confirm"

StepNameConfirm means that config is confirmed and assets are being rendered

View Source
const StepNameHelmIntro = "helm.intro"
View Source
const StepNameHelmValues = "helm.values"
View Source
const StepNameKustomize = "kustomize"
View Source
const StepNameMessage = "message"
View Source
const StepNamePlan = "terraform.plan"
View Source
const StepNameReport = "terraform.report"
View Source
const StepNameStream = "stream"

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Sort        int32         `json:"sort,omitempty"`
	ButtonType  string        `json:"buttonType,omitempty"`
	Text        string        `json:"text,omitempty"`
	LoadingText string        `json:"loadingText,omitempty"`
	OnClick     ActionRequest `json:"onclick,omitempty"`
}

type ActionRequest

type ActionRequest struct {
	URI    string `json:"uri"`
	Method string `json:"method"`
	Body   string `json:"body"`
}

type Config

type Config struct {
}

type Daemon

type Daemon interface {
	StatusReceiver

	EnsureStarted(context.Context, *api.Release) chan error
	PushRenderStep(context.Context, Render)
	PushHelmIntroStep(context.Context, HelmIntro, []Action)
	PushHelmValuesStep(context.Context, HelmValues, []Action)
	PushKustomizeStep(context.Context, Kustomize)
	AllStepsDone(context.Context)
	CleanPreviousStep()
	MessageConfirmedChan() chan string
	ConfigSavedChan() chan interface{}
	TerraformConfirmedChan() chan bool
	KustomizeSavedChan() chan interface{}
	GetCurrentConfig() map[string]interface{}
	AwaitShutdown() error
}

Daemon is a sort of UI interface. Some implementations start an API to power the on-prem web console. A headless implementation logs progress to stdout.

A daemon is manipulated by lifecycle step handlers to present the correct UI to the user and collect necessary information

type HelmIntro

type HelmIntro struct {
}

type HelmValues

type HelmValues struct {
	Values        string `json:"values"`
	DefaultValues string `json:"defaultValues"`
}

type Kustomize

type Kustomize struct {
	BasePath string        `json:"basePath,omitempty"`
	Tree     filetree.Node `json:"tree,omitempty"`
}

type KustomizeIntro

type KustomizeIntro struct {
}

type Message

type Message struct {
	Contents    string `json:"contents"`
	TrustedHTML bool   `json:"trusted_html"`
	Level       string `json:"level,omitempty"`
}

type Progress

type Progress struct {
	Source string `json:"source"`
	Type   string `json:"type"`  // string, json, etc
	Level  string `json:"level"` // string, json, etc
	Detail string `json:"detail,omitempty"`
}

func JSONProgress

func JSONProgress(source string, detail interface{}) Progress

func MessageProgress

func MessageProgress(source string, msg Message) Progress

func StringProgress

func StringProgress(source, detail string) Progress

func (Progress) String

func (p Progress) String() string

type ProgressMap

type ProgressMap struct {
	Map sync.Map
}

the empty value is initialized and ready to use

func (*ProgressMap) Delete

func (p *ProgressMap) Delete(stepID string)

func (*ProgressMap) Load

func (p *ProgressMap) Load(stepID string) (Progress, bool)

func (*ProgressMap) Store

func (p *ProgressMap) Store(stepID string, progress Progress)

type Render

type Render struct{}

type StatusReceiver

type StatusReceiver interface {
	SetProgress(Progress)
	ClearProgress()
	PushStreamStep(context.Context, <-chan Message)
	SetStepName(context.Context, string)
	PushMessageStep(context.Context, Message, []Action)
}

type Step

type Step struct {
	Source         api.Step        `json:"-"`
	Message        *Message        `json:"message,omitempty"`
	Render         *Render         `json:"render,omitempty"`
	HelmIntro      *HelmIntro      `json:"helmIntro,omitempty"`
	HelmValues     *HelmValues     `json:"helmValues,omitempty"`
	Kustomize      *Kustomize      `json:"kustomize,omitempty"`
	KustomizeIntro *KustomizeIntro `json:"kustomizeIntro,omitempty"`
	Config         *Config         `json:"config,omitempty"`
}

the api abstraction for objects written in the YAML is starting to leak a little, so duplicating some stuff here

func NewStep

func NewStep(apiStep api.Step) Step

hack hack hack, I don't even know what to call this one

type StepResponse

type StepResponse struct {
	CurrentStep Step      `json:"currentStep"`
	Phase       string    `json:"phase"`
	Actions     []Action  `json:"actions,omitempty"`
	Progress    *Progress `json:"progress,omitempty"`
}

Jump to

Keyboard shortcuts

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