state

package
v0.0.0-...-2f32780 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arg

type Arg struct {
	File  *File    `json:"file,omitempty" yaml:"file,omitempty"`
	Exec  *File    `json:"exec,omitempty" yaml:"exec,omitempty"`
	Value *string  `json:"value,omitempty" yaml:"value,omitempty"`
	Envs  []string `json:"envs,omitempty" yaml:"envs,omitempty"`
}

func (*Arg) DeepCopy

func (a *Arg) DeepCopy() *Arg

DeepCopy creates a deep copy of Arg.

type Args

type Args []*Arg

func (Args) Parse

func (a Args) Parse() ([]string, error)

type Data

type Data struct {
	File File `json:"file,omitempty" yaml:"file,omitempty"`
	Args Args `json:"args,omitempty" yaml:"args,omitempty"`
	// contains filtered or unexported fields
}

func (*Data) Content

func (d *Data) Content() (string, error)

func (*Data) DeepCopy

func (d *Data) DeepCopy() *Data

DeepCopy creates a deep copy of Data.

func (*Data) SetLabels

func (d *Data) SetLabels(labels []string)

type DockerRunner

type DockerRunner struct {
	Dockerfile *Data    `json:"dockerfile,omitempty" yaml:"dockerfile,omitempty"`
	Labels     []string `json:"labels,omitempty" yaml:"labels,omitempty"`
	Quantity   int      `json:"quantity,omitempty" yaml:"quantity,omitempty"`
}

func (*DockerRunner) DeepCopy

func (dr *DockerRunner) DeepCopy() *DockerRunner

DeepCopy creates a deep copy of DockerRunner.

type Environments

type Environments struct {
	HCloud map[string]*HCloudServerCreateOpts `json:"hcloud,omitempty" yaml:"hcloud,omitempty"`
}

func (*Environments) DeepCopy

func (e *Environments) DeepCopy() *Environments

DeepCopy creates a deep copy of Environments.

type File

type File string

type File string

func (File) Content

func (f File) Content() (string, error)

func (File) DeepCopy

func (f File) DeepCopy() File

DeepCopy creates a deep copy of File.

func (File) Output

func (f File) Output(envs []string) ([]byte, error)

func (File) Path

func (f File) Path() string

type Github

type Github struct {
	Token        string  `json:"token,omitempty" yaml:"token,omitempty"` // Not saved to config
	Organization string  `json:"organization,omitempty" yaml:"organization,omitempty"`
	Repository   *string `json:"repository,omitempty" yaml:"repository,omitempty"`
}

func (*Github) DeepCopy

func (g *Github) DeepCopy() *Github

DeepCopy creates a deep copy of Github.

func (*Github) SCMPlatform

func (g *Github) SCMPlatform() *SCMPlatform

type Gitlab

type Gitlab struct {
	Token        string  `json:"token,omitempty" yaml:"token,omitempty"` // Not saved to config
	Organization string  `json:"organization,omitempty" yaml:"organization,omitempty"`
	Repository   *string `json:"repository,omitempty" yaml:"repository,omitempty"`
}

func (*Gitlab) DeepCopy

func (g *Gitlab) DeepCopy() *Gitlab

DeepCopy creates a deep copy of Gitlab.

func (*Gitlab) SCMPlatform

func (g *Gitlab) SCMPlatform() *SCMPlatform

type GoTemplate

type GoTemplate struct {
	*Runner
	scm.Provider
	Args []string
}

type GoTemplateOptions

type GoTemplateOptions struct {
	Runner      *Runner
	SCMPlatform *SCMPlatform
}

type HCloud

type HCloud struct {
	Token string `json:"token,omitempty" yaml:"token,omitempty"` // Not saved to config
}

func (*HCloud) DeepCopy

func (h *HCloud) DeepCopy() *HCloud

DeepCopy creates a deep copy of HCloud.

type HCloudServerCreateOpts

type HCloudServerCreateOpts struct {
	Setup *SCMPlatform `json:"setup,omitempty" yaml:"setup,omitempty"`
	// should not be provided by the config file
	Name             string   `json:"-"`
	Type             string   `json:"type"`
	Image            string   `json:"image"`
	SSHKeys          []string `json:"ssh_keys,omitempty" yaml:"ssh_keys,omitempty"`
	Location         *string  `json:"location,omitempty" yaml:"location,omitempty"`
	Datacenter       *string  `json:"datacenter,omitempty" yaml:"datacenter,omitempty"`
	UserData         *Data    `json:"user_data"`
	StartAfterCreate bool     `json:"start_after_create,omitempty" yaml:"start_after_create,omitempty"`
	Labels           []string `json:"labels,omitempty" yaml:"labels,omitempty"`
	Automount        bool     `json:"automount,omitempty" yaml:"automount,omitempty"`
	Volumes          []string `json:"volumes,omitempty" yaml:"volumes,omitempty"`
	Networks         []string `json:"networks,omitempty" yaml:"networks,omitempty"`
	Firewalls        []string `json:"firewalls,omitempty" yaml:"firewalls,omitempty"`
	PlacementGroup   *string  `json:"placement_group,omitempty" yaml:"placement_group,omitempty"`
}

func (*HCloudServerCreateOpts) Args

func (s *HCloudServerCreateOpts) Args() ([]string, *bytes.Buffer, error)

func (*HCloudServerCreateOpts) DeepCopy

DeepCopy creates a deep copy of HCloudServerCreateOpts.

type Hetzner

type Hetzner struct {
	Token string `json:"token,omitempty" yaml:"token,omitempty"` // Not saved to config
}

func (*Hetzner) DeepCopy

func (h *Hetzner) DeepCopy() *Hetzner

DeepCopy creates a deep copy of Hetzner.

type Logs

type Logs struct {
	Path    *string `json:"path,omitempty" yaml:"path,omitempty"`
	Level   *string `json:"level,omitempty" yaml:"level,omitempty"`
	Verbose bool    `json:"verbose,omitempty" yaml:"verbose,omitempty"`
}

func (*Logs) AddFlags

func (l *Logs) AddFlags(flags *pflag.FlagSet)

func (*Logs) Logger

func (l *Logs) Logger() (*slog.Logger, func() error)

func (*Logs) Raw

func (l *Logs) Raw(name string) (*streams.IO, error)

type Runner

type Runner struct {
	// will be filled with the name of the runner from map
	Name *string `json:"-" yaml:"-"`

	Host     *string `json:"host,omitempty" yaml:"host,omitempty"`
	HCloud   *string `json:"hcloud,omitempty" yaml:"hcloud,omitempty"`
	User     string  `json:"user,omitempty" yaml:"user,omitempty"`
	Auth     string  `json:"auth,omitempty" yaml:"auth,omitempty"`
	Password *string `json:"password,omitempty" yaml:"password,omitempty"` // Not saved to config

	Setup  *RunnerSetup             `json:"setup,omitempty" yaml:"setup,omitempty"`
	Docker map[string]*DockerRunner `json:"docker,omitempty" yaml:"docker,omitempty"`
	Pre    *string                  `json:"pre,omitempty" yaml:"pre,omitempty"`
	Post   *string                  `json:"post,omitempty" yaml:"post,omitempty"`
}

func (*Runner) DeepCopy

func (r *Runner) DeepCopy() *Runner

DeepCopy creates a deep copy of Runner.

func (*Runner) ScrubSecrets

func (r *Runner) ScrubSecrets() interface{}

type RunnerSetup

type RunnerSetup struct {
	SCMPlatform `json:",inline" yaml:",inline"`

	User          string   `json:"user"`
	Packages      []string `json:"packages,omitempty" yaml:"packages,omitempty"`
	RunnerWorkDir string   `json:"runner_work_dir,omitempty" yaml:"runner_work_dir,omitempty"`
	Installimage  *Data    `json:"installimage,omitempty" yaml:"installimage,omitempty"`
}

func (*RunnerSetup) DeepCopy

func (rs *RunnerSetup) DeepCopy() *RunnerSetup

DeepCopy creates a deep copy of RunnerSetup.

type Runr

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

func NewState

func NewState(cmd *cobra.Command) (*cobra.Command, *Runr)

func (*Runr) IO

func (runr *Runr) IO() *streams.IO

func (*Runr) Logger

func (runr *Runr) Logger() *slog.Logger

func (*Runr) Marshal

func (l *Runr) Marshal() error

func (*Runr) Path

func (l *Runr) Path() string

func (*Runr) State

func (l *Runr) State(file ...bool) *State

type SCMPlatform

type SCMPlatform struct {
	Platform     string  `json:"platform,omitempty" yaml:"platform,omitempty"`
	Organization string  `json:"organization,omitempty" yaml:"organization,omitempty"`
	Repository   *string `json:"repository,omitempty" yaml:"repository,omitempty"`
	Token        string  `json:"token,omitempty" yaml:"token,omitempty"` // Not saved to config
}

func (*SCMPlatform) DeepCopy

func (s *SCMPlatform) DeepCopy() *SCMPlatform

DeepCopy creates a deep copy of SCMPlatform.

func (*SCMPlatform) NewProvider

func (s *SCMPlatform) NewProvider(ctx context.Context, logger *slog.Logger) (scm.Provider, error)

type State

type State struct {
	Logs         *Logs              `json:"logs,omitempty" yaml:"logs,omitempty"`
	Runners      map[string]*Runner `json:"runners,omitempty" yaml:"runners,omitempty"`
	Environments *Environments      `json:"environments,omitempty" yaml:"environments,omitempty"`

	Github  *Github  `json:"github,omitempty" yaml:"github,omitempty"`
	Gitlab  *Gitlab  `json:"gitlab,omitempty" yaml:"gitlab,omitempty"`
	HCloud  *HCloud  `json:"hcloud,omitempty" yaml:"hcloud,omitempty"`
	Hetzner *Hetzner `json:"hetzner,omitempty" yaml:"hetzner,omitempty"`
}

func (*State) DeepCopy

func (s *State) DeepCopy() *State

DeepCopy creates a deep copy of State.

func (*State) ExpandRunner

func (state *State) ExpandRunner(name string) (*Runner, error)

ExpandRunner returns a runner configuration by name It will complete and expand the configuration

func (*State) ExpandRunners

func (state *State) ExpandRunners() ([]*Runner, error)

Jump to

Keyboard shortcuts

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