library

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package library is a package which exposes the commands externally to the compiled binaries.

Index

Constants

This section is empty.

Variables

View Source
var PYGMY_VERSION = ""

PYGMY_VERSION is the equivalent to the version pygmy is being associated to. This variable is exclusively used when packaging a formal release.

Functions

func Clean

func Clean(c Config)

Clean will forcibly kill and remove all of pygmy's containers in the daemon

func Down

func Down(c Config)

Down will bring pygmy down safely

func Export

func Export(c Config, output string)

Export will export validated configuration to a given path, or it will export by default to $HOME/.pygmy.yml

func GetServicesSorted

func GetServicesSorted(c *Config) []string

GetServicesSorted will return a list of services as plain text. due to some weirdness the ssh agent must be the first value.

func ImportDefaults

func ImportDefaults(c *Config, service string, importer model.Service) bool

ImportDefaults is an exported function which allows third-party applications to provide their own *Service and integrate it with their application so that Pygmy is more extendable via API. It's here so that we have one common import functionality that respects the users' decision to import config defaults in a centralized way.

func NetworkConnect

func NetworkConnect(network string, containerName string) error

NetworkConnect is part of a centralised abstraction of the Docker API and will connect a created container to a docker network with a specified name.

func NetworkCreate

func NetworkCreate(network types.NetworkResource) error

NetworkCreate is part of a centralised abstraction of the Docker API and will create a Docker network with a specified configuration.

func NetworkStatus

func NetworkStatus(network string) (bool, error)

NetworkStatus will check the state of a Docker network to test if it has been created, and will return false if the network can not be found.

func PrintStatusHumanReadable added in v0.12.0

func PrintStatusHumanReadable(c Config)

func PrintStatusJSON added in v0.12.0

func PrintStatusJSON(c Config)

func Pull

func Pull(c Config)

Pull is an alias function for Update. It is here for the sake of user experience.

func Restart

func Restart(c Config)

Restart will stop and start Pygmy in its entirety.

func Setup

func Setup(c *Config)

Setup holds the core of configuration management with Pygmy. It will merge in all the configurations and provide defaults.

func SshKeyAdd

func SshKeyAdd(c Config, key string) error

SshKeyAdd will add a given key to the ssh agent.

func Status

func Status(c Config)

Status will show the state of all the things Pygmy manages.

func Stop added in v0.10.0

func Stop(c Config)

Stop will bring pygmy down safely

func Up

func Up(c Config)

Up will bring Pygmy up.

func Update

func Update(c Config)

Update will update the the images for all configured services.

func Version

func Version(c Config)

Version describes which version of Pygmy is running.

Types

type CompatibilityCheck

type CompatibilityCheck struct {
	State   bool   `yaml:"value"`
	Message string `yaml:"string"`
}

CompatibilityCheck is a struct of fields associated to reporting of a result state.

func DryRun

func DryRun(c *Config) []CompatibilityCheck

DryRun will check for. It is here to check for port compatibility before Pygmy attempts to start any containers and provide the user with a report.

type Config

type Config struct {
	// Keys are the paths to the Keys which should be added.
	Keys []Key `yaml:"keys"`

	// Domain is the default domain suffix to use.
	Domain string `yaml:"domain"`

	// Services is a []model.Service for an index of all Services.
	Services map[string]model.Service `yaml:"services"`

	SortedServices []string

	// Networks is for network configuration
	Networks map[string]types.NetworkResource `yaml:"networks"`

	// NoDefaults will prevent default configuration items.
	Defaults bool

	// JSONFormat indicates the `status` command should print to stdout in JSON format.
	JSONFormat bool

	// JSONStatus contains JSON status content.
	JSONStatus StatusJSON

	// Resolvers is for all resolvers
	Resolvers []resolv.Resolv `yaml:"resolvers"`

	// Volumes will ensure names volumes are created
	Volumes map[string]volume.Volume
}

Config is a struct of configurable options which can be passed to package library to configure logic for continued abstraction.

type Key

type Key struct {
	Path string `yaml:"path"`
}

Key is a struct with SSH key details.

type StatusJSON added in v0.12.0

type StatusJSON struct {
	PortAvailability []string                    `json:"port_availability"`
	Services         map[string]StatusJSONStatus `json:"service_status"`
	Networks         []string                    `json:"networks"`
	Resolvers        []string                    `json:"resolvers"`
	Volumes          []string                    `json:"volumes"`
	SSHMessages      []string                    `json:"ssh_messages"`
	URLValidations   []string                    `json:"url_validations"`
}

type StatusJSONStatus added in v0.12.0

type StatusJSONStatus struct {
	Container string `json:"container"`
	ImageRef  string `json:"image"`
	State     bool   `json:"running"`
}

Jump to

Keyboard shortcuts

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