tui

package module
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package tui provides a BubbleTea powered tui for Deploystack. All rendering should happen within this package.

Index

Constants

This section is empty.

Variables

View Source
var ErrorCustomNotValidPhoneNumber = fmt.Errorf("not a valid phone number")

ErrorCustomNotValidPhoneNumber is the error you get when you fail phone number validation.

Functions

func Fatal

func Fatal(err error)

Fatal stops processing of Deploystack and halts the calling process. All with an eye towards not processing in the shell script of things go wrong.

func GetMock

func GetMock(delay int) mock

GetMock returns a mock gcloud.Client from github.com/GoogleCloudPlatform/deploystack/gcloud

func PreCheck added in v1.5.0

func PreCheck(reports []config.Report) string

PreCheck handles presenting a choice to a user amongst multiple stacks

func Run

func Run(s *config.Stack, useMock bool)

Run takes a deploystack configuration and walks someone through all of the input needed to run the eventual terraform

Types

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

Queue represents the flow of the application from screen to screen, or a the developer level tea.Model to tea.Model. It allows for progression and even going back through the queue all to manage the population of a deploystack setting and tfvars file

func NewQueue

func NewQueue(s *config.Stack, client UIClient) Queue

NewQueue creates a new queue. You should need only one per app

func (*Queue) Get

func (q *Queue) Get(key string) interface{}

Get returns a previously stored value from the Queue cache

func (*Queue) InitializeUI

func (q *Queue) InitializeUI()

InitializeUI spins up everything we need to have a working queue in the hosting application

func (*Queue) Model

func (q *Queue) Model(key string) QueueModel

Model retrieves a give model by key from the queue

func (*Queue) ProcessConfig

func (q *Queue) ProcessConfig() error

ProcessConfig does the work of turning a DeployStack config file to a set of tui screens. It's separate from Initialize in case we want to be able to populate setting and variables with other information before running the genreation of those screens

func (*Queue) Save

func (q *Queue) Save(key string, val interface{})

Save stores a value in a simple cache for communicating between operations in the same process

func (*Queue) Start

func (q *Queue) Start() QueueModel

Start returns the first model to the hosting application so that it can be run through tea.NewProgram

type QueueModel

type QueueModel interface {
	tea.Model
	// contains filtered or unexported methods
}

QueueModel is an extented version of tea.Model modified to work with the queue system

type UIClient

type UIClient interface {
	ProjectIDGet() (string, error)
	ProjectList() ([]gcloud.ProjectWithBilling, error)
	ProjectParentGet(project string) (*cloudresourcemanager.ResourceId, error)
	ProjectCreate(project, parent, parentType string) error
	ProjectNumberGet(id string) (string, error)
	ProjectIDSet(id string) error
	RegionList(project, product string) ([]string, error)
	ZoneList(project, region string) ([]string, error)
	DomainIsAvailable(project, domain string) (*domainspb.RegisterParameters, error)
	DomainIsVerified(project, domain string) (bool, error)
	DomainRegister(project string, domaininfo *domainspb.RegisterParameters, contact gcloud.ContactData) error
	ImageLatestGet(project, imageproject, imagefamily string) (string, error)
	MachineTypeList(project, zone string) (*compute.MachineTypeList, error)
	MachineTypeFamilyList(imgs *compute.MachineTypeList) gcloud.LabeledValues
	MachineTypeListByFamily(imgs *compute.MachineTypeList, family string) gcloud.LabeledValues
	ImageList(project, imageproject string) (*compute.ImageList, error)
	ImageTypeListByFamily(imgs *compute.ImageList, project, family string) gcloud.LabeledValues
	ImageFamilyList(imgs *compute.ImageList) gcloud.LabeledValues
	BillingAccountList() ([]*cloudbilling.BillingAccount, error)
	BillingAccountAttach(project, account string) error
}

UIClient interface encapsulates all of the calls to gcloud that one needs to make the TUI work

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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