cli

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PickLatestMajorVersion added in v0.2.0

func PickLatestMajorVersion(versions api.LeafVersionsResult, leaf string, _ string) (string, error)

func PickLatestMinorVersion added in v0.2.0

func PickLatestMinorVersion(versions api.LeafVersionsResult, leaf string, major string) (string, error)

Types

type APIClient added in v0.0.9

type APIClient interface {
	GetDebugConnectionInfo(debugKey string) (api.DebugConnectionInfo, error)
	InitiateRun(api.InitiateRunConfig) (*api.InitiateRunResult, error)
	ObtainAuthCode(api.ObtainAuthCodeConfig) (*api.ObtainAuthCodeResult, error)
	AcquireToken(tokenUrl string) (*api.AcquireTokenResult, error)
	Lint(api.LintConfig) (*api.LintResult, error)
	Whoami() (*api.WhoamiResult, error)
	SetSecretsInVault(api.SetSecretsInVaultConfig) (*api.SetSecretsInVaultResult, error)
	GetLeafVersions() (*api.LeafVersionsResult, error)
}

type Config

type Config struct {
	APIClient APIClient
	SSHClient SSHClient
}

func (Config) Validate

func (c Config) Validate() error

type DebugTaskConfig added in v0.0.9

type DebugTaskConfig struct {
	DebugKey string
}

func (DebugTaskConfig) Validate added in v0.0.9

func (c DebugTaskConfig) Validate() error

type InitiateRunConfig

type InitiateRunConfig struct {
	InitParameters map[string]string
	Json           bool
	MintDirectory  string
	MintFilePath   string
	NoCache        bool
	TargetedTasks  []string
	Title          string
}

func (InitiateRunConfig) Validate

func (c InitiateRunConfig) Validate() error

type LintConfig added in v1.1.0

type LintConfig struct {
	MintDirectory string
	MintFilePaths []string
	Output        io.Writer
	OutputFormat  LintOutputFormat
}

func NewLintConfig added in v1.1.0

func NewLintConfig(filePaths []string, mintDir string, output io.Writer, formatString string) (LintConfig, error)

func (LintConfig) Validate added in v1.1.0

func (c LintConfig) Validate() error

type LintOutputFormat added in v1.1.0

type LintOutputFormat int
const (
	LintOutputNone LintOutputFormat = iota
	LintOutputOneLine
	LintOutputMultiLine
)

type LoginConfig added in v0.0.9

type LoginConfig struct {
	DeviceName         string
	AccessTokenBackend accesstoken.Backend
	Stdout             io.Writer
	OpenUrl            func(url string) error
}

func (LoginConfig) Validate added in v0.0.9

func (c LoginConfig) Validate() error

type SSHClient added in v0.0.9

type SSHClient interface {
	Close() error
	Connect(addr string, cfg ssh.ClientConfig) error
	InteractiveSession() error
}

type Service

type Service struct {
	Config
}

Service holds the main business logic of the CLI.

func NewService

func NewService(cfg Config) (Service, error)

func (Service) DebugTask added in v0.0.9

func (s Service) DebugTask(cfg DebugTaskConfig) error

DebugRunConfig will connect to a running task over SSH. Key exchange is facilitated over the Cloud API.

func (Service) InitiateRun

func (s Service) InitiateRun(cfg InitiateRunConfig) (*api.InitiateRunResult, error)

InitiateRun will connect to the Cloud API and start a new run in Mint.

func (Service) Lint added in v1.1.0

func (s Service) Lint(cfg LintConfig) (*api.LintResult, error)

func (Service) Login added in v0.0.9

func (s Service) Login(cfg LoginConfig) error

InitiateRun will connect to the Cloud API and start a new run in Mint.

func (Service) SetSecretsInVault added in v0.0.12

func (s Service) SetSecretsInVault(cfg SetSecretsInVaultConfig) error

func (Service) UpdateLeaves added in v0.2.0

func (s Service) UpdateLeaves(cfg UpdateLeavesConfig) error

func (Service) Whoami added in v0.0.10

func (s Service) Whoami(cfg WhoamiConfig) error

type SetSecretsInVaultConfig added in v0.0.12

type SetSecretsInVaultConfig struct {
	Secrets []string
	Vault   string
	File    string
	Stdout  io.Writer
}

func (SetSecretsInVaultConfig) Validate added in v0.0.12

func (c SetSecretsInVaultConfig) Validate() error

type UpdateLeavesConfig added in v0.2.0

type UpdateLeavesConfig struct {
	DefaultDir               string
	Files                    []string
	ReplacementVersionPicker func(versions api.LeafVersionsResult, leaf string, major string) (string, error)
	Stdout                   io.Writer
	Stderr                   io.Writer
}

func (UpdateLeavesConfig) Validate added in v0.2.0

func (c UpdateLeavesConfig) Validate() error

type WhoamiConfig added in v0.0.10

type WhoamiConfig struct {
	Json   bool
	Stdout io.Writer
}

func (WhoamiConfig) Validate added in v0.0.10

func (c WhoamiConfig) Validate() error

Jump to

Keyboard shortcuts

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