env

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDetailsVM

func GetDetailsVM(insts []Instance, project string, zone string) []gce.Instance

GetDetailsEnv will get details about virtual machines for show command.

Types

type Config

type Config struct {
	Name   string       `json:"name"`
	Label  string       `json:"label"`
	All    bool         `json:"all"`
	Data   Environments `json:"data"`
	File   string
	Host   string
	Dry    bool
	Format string
}

Config stores options from parsed flags.

func (*Config) Down

func (c *Config) Down() (string, error)

Down will shutdown one or all environments based on provided config..

func (*Config) DownAll

func (c *Config) DownAll() (string, error)

DownAll will shutdown all environments.

func (*Config) DownSingle

func (c *Config) DownSingle() (string, error)

DownSingle will shutdown an environment.

func (*Config) GetConfig

func (c *Config) GetConfig(b []byte) error

GetConfig will get configuration from JSON.

func (*Config) GetData

func (c *Config) GetData() ([]byte, error)

GetData return the environment data.

func (*Config) ParseEnvironmentFile

func (c *Config) ParseEnvironmentFile() error

ParseEnvironmentFile will parse an environment file for environments.

func (*Config) ParseFlags

func (c *Config) ParseFlags(args []string) error

ParseFlags will parse flags for options.

func (*Config) Show

func (c *Config) Show() (string, error)

Show returns the information about the environment(s).

func (*Config) ShowAll

func (c *Config) ShowAll() (string, error)

ShowAll returns the information about all environments.

func (*Config) ShowSingle

func (c *Config) ShowSingle() (string, error)

ShowSingle returns the information about an environment.

func (*Config) Up

func (c *Config) Up() (string, error)

Up will turn up one or all environments based on provided config..

func (*Config) UpAll

func (c *Config) UpAll() (string, error)

UpAll will turn up all environments.

func (*Config) UpSingle

func (c *Config) UpSingle() (string, error)

UpSingle will turn up an environment.

type EnvScript

type EnvScript struct {
	Down []string `yaml:"down"`
	SSH  SSH      `yaml:"ssh"`
	Up   []string `yaml:"up"`
}

EnvScript stores shell commands.

type Environment

type Environment struct {
	Group []Group `yaml:"group"`
	Label string  `yaml:"label"`
	Name  string  `yaml:"name"`
}

Environment stores details of an environment.

func (*Environment) CheckLabel

func (env *Environment) CheckLabel(label string) bool

CheckLabel will check if a specific environment is labeled with provided labels.

func (*Environment) State

func (env *Environment) State(state string)

State manages the state of an environment.

type Environments

type Environments struct {
	Envs []Environment `yaml:"environment"`
	Vars Variable      `yaml:"variable"`
}

Environments stores environment details, and variables.

func NewEnvironments

func NewEnvironments(data string) (*Environments, error)

NewEnvironments returns an Environment struct.

func (*Environments) GetEnvironment

func (e *Environments) GetEnvironment(name string, label string) (Environment, error)

GetEnvironment return an Environment struct from the list of environments.

type Group

type Group struct {
	Name     string   `yaml:"name"`
	Project  string   `yaml:"project"`
	Resource Resource `yaml:"resource"`
	Zone     string   `yaml:"zone"`
}

Group stores details of a group.

type Instance

type Instance struct {
	Name   string    `yaml:"name"`
	Record Record    `yaml:"record"`
	Script EnvScript `yaml:"script"`
}

Instance stores details of an instance in Virtual Machine resource.

type Record

type Record struct {
	Domain     string   `yaml:"domain"`
	ExternalIP bool     `yaml:"external_ip"`
	IP         []string `yaml:"ip"`
	Type       string   `yaml:"type"`
	Zone       string   `yaml:"zone"`
}

Record stores details to create a DNS record.

type Resource

type Resource struct {
	VM VM `yaml:"vm"`
}

Resource stores declared resources in a group.

type SSH

type SSH struct {
	Key  string `yaml:"key"`
	Port string `yaml:"port"`
	User string `yaml:"user"`
}

SSH stores configuration for SSH connection.

type ShowEnvironment

type ShowEnvironment struct {
	Name  string      `json:"name"`
	Label string      `json:"label"`
	Group []ShowGroup `json:"group"`
}

ShowEnvironment stores environment information for show command.

func (*ShowEnvironment) GetDetailsEnv

func (se *ShowEnvironment) GetDetailsEnv(e Environment)

GetDetailsEnv will get details about the environment for show command.

func (*ShowEnvironment) GetDetailsGroup

func (se *ShowEnvironment) GetDetailsGroup(groups []Group)

GetDetailsEnv will get details about the group for show command.

type ShowGroup

type ShowGroup struct {
	Name     string       `json:"name"`
	Project  string       `json:"project"`
	Zone     string       `json:"zone"`
	Resource ShowResource `json:"resource"`
}

ShowEnvironment stores group information for show command.

type ShowResource

type ShowResource struct {
	VM []gce.Instance `json:"vm"`
}

ShowEnvironment stores resource information for show command.

type VM

type VM struct {
	Instance []Instance `yaml:"instance"`
	Script   EnvScript  `yaml:"script"`
}

VM stores details about Virtual Machine resource.

type Variable

type Variable map[string]interface{}

Variable stores variables declared in environment file.

Jump to

Keyboard shortcuts

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