schema

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const CommandConfigKind string = "Command"

CommandConfigKind defines kind property value of for klio.yaml files.

Variables

This section is empty.

Functions

func LoadConfigFile

func LoadConfigFile(dataStruct interface{}, meta *Metadata, configFilePath string) error

LoadConfigFile reads, parses and validates specified configuration file.

func SaveConfigFile

func SaveConfigFile(data interface{}, configFilePath string) error

SaveConfigFile validates, serializes and saves configuration to a file.

func SaveDependenciesIndex

func SaveDependenciesIndex(config *DependenciesIndex) error

SaveDependenciesIndex saves a dependenceis index file.

func SaveProjectConfig

func SaveProjectConfig(config *ProjectConfig) error

SaveProjectConfig saves a project configuration file.

Types

type CommandConfig

type CommandConfig struct {
	// Meta stores metadata of the config file (such as a path).
	Meta Metadata `yaml:"-"`
	// APIVersion can be used to handle more than one config file format
	APIVersion string `yaml:"apiVersion,omitempty"`
	// Kind of the config file
	Kind string `yaml:"kind,omitempty" validate:"eq=Command"`
	// Name of the command.
	BinPath string `yaml:"binPath,omitempty" validate:"required,file"`
	// Description of the command used by core "klio" binary in order to show usage.
	Description string `yaml:"description,omitempty"`
}

CommandConfig describes structure of klio.yaml files.

func LoadCommandConfig

func LoadCommandConfig(filePath string) (*CommandConfig, error)

LoadCommandConfig reads a project configuration file.

type DependenciesIndex

type DependenciesIndex struct {
	Meta       Metadata                 `json:"-"`
	APIVersion string                   `json:"apiVersion,omitempty"`
	Kind       string                   `json:"kind,omitempty"`
	Entries    []DependenciesIndexEntry `json:"entries"`
}

func LoadDependenciesIndex

func LoadDependenciesIndex(filePath string) (*DependenciesIndex, error)

LoadDependenciesIndex reads a dependenceis index file.

type DependenciesIndexEntry

type DependenciesIndexEntry struct {
	Alias    string `json:"alias"`
	Registry string `json:"registry"`
	Name     string `json:"name"`
	Version  string `json:"version"`
	OS       string `json:"os"`
	Arch     string `json:"arch"`
	Checksum string `json:"checksum"`
	Path     string `json:"path"`
}

type Dependency

type Dependency struct {
	Name     string `yaml:"name,omitempty"`
	Registry string `yaml:"registry,omitempty"`
	Version  string `yaml:"version"`
	Alias    string `yaml:"-"`
}

Dependency describes project's dependency - command or plugin.

type GenericConfigFile

type GenericConfigFile struct {
	// Meta stores metadata of the config file (such as a path).
	Meta Metadata `yaml:"-"`
	// APIVersion can be used to handle more than one config file format
	APIVersion string `yaml:"apiVersion"`
	// Kind of the config file
	Kind string `yaml:"kind"`
}

type Metadata

type Metadata struct {
	Path   string
	Exists bool
}

Metadata contains additional info, such as path of config file.

type PluginConfig

type PluginConfig struct {
	// Meta stores metadata of the config file (such as a path).
	Meta Metadata `yaml:"-"`
	// APIVersion can be used to handle more than one config file format
	APIVersion string `yaml:"apiVersion,omitempty"`
	// Kind of the config file
	Kind string `yaml:"kind,omitempty" validate:"eq=Command"`
	// Name of the command.
	BinPath string `yaml:"binPath,omitempty" validate:"required,file"`
	// Description of the command used by core "klio" binary in order to show usage.
	Description string `yaml:"description,omitempty"`
}

PluginConfig describes structure of klio.yaml files.

type ProjectConfig

type ProjectConfig struct {
	Meta            Metadata
	DefaultRegistry string
	Dependencies    []Dependency
	// contains filtered or unexported fields
}

ProjectConfig describes structure of klio.yaml files.

func CreateDefaultProjectConfig

func CreateDefaultProjectConfig(filePath string) (*ProjectConfig, error)

CreateDefaultProjectConfig creates default ProjectConfig and save it to give path if it's not already there.

func LoadProjectConfig

func LoadProjectConfig(filePath string) (*ProjectConfig, error)

LoadProjectConfig reads a project configuration file.

func NewDefaultProjectConfig

func NewDefaultProjectConfig() *ProjectConfig

func (ProjectConfig) MarshalYAML

func (p ProjectConfig) MarshalYAML() (interface{}, error)

func (*ProjectConfig) UnmarshalYAML

func (p *ProjectConfig) UnmarshalYAML(node *yaml.Node) error

type Registry

type Registry struct {
	Meta        Metadata          `yaml:"-"`
	APIVersion  string            `yaml:"apiVersion,omitempty"`
	Kind        string            `yaml:"kind,omitempty"`
	Annotations map[string]string `yaml:"annotations"`
	Entries     []RegistryEntry   `yaml:"entries"`
}

type RegistryEntry

type RegistryEntry struct {
	Name        string            `yaml:"name"`
	Version     string            `yaml:"version"`
	OS          string            `json:"os"`
	Arch        string            `json:"arch"`
	Annotations map[string]string `yaml:"annotations"`
	URL         string            `yaml:"url"`
	Checksum    string            `yaml:"checksum"`
}

type RegistryEntryVersion

type RegistryEntryVersion struct {
	Number string `yaml:"number" json:"number"`
	OS     string `yaml:"os" json:"os"`
	Arch   string `yaml:"arch" json:"arch"`
}

Jump to

Keyboard shortcuts

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