util

package
v0.0.53 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: BSD-3-Clause Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadByte added in v0.0.10

func LoadByte(filePath string) ([]byte, error)

LoadByte receives path of a file. It returns the file content as byte array.

func LoadString added in v0.0.15

func LoadString(filePath string) (string, error)

LoadString receives path of a file. It returns the file content as string.

func ValidateTagName added in v0.0.20

func ValidateTagName(tag string) bool

ValidateTagName validates tag name.

Types

type Binary added in v0.0.10

type Binary struct {
	File string `json:"file,omitempty" yaml:"file,omitempty"`
}

A Binary represents a set of data for Binary. All value will be omitted if it is not set. This will works as a part of CommandSpec.

type CommandSpec added in v0.0.10

type CommandSpec struct {
	ID           int      `json:"id,omitempty" yaml:"id,omitempty"`
	Namespace    string   `json:"namespace" yaml:"namespace"`
	Name         string   `json:"name" yaml:"name"`
	Description  string   `json:"description" yaml:"description"`
	Usage        string   `json:"usage,omitempty" yaml:"usage,omitempty"`
	Maintainer   string   `json:"maintainer" yaml:"maintainer"`
	Version      string   `json:"version" yaml:"version"`
	Format       string   `json:"format" yaml:"format"`
	Habitat      *Habitat `json:"habitat,omitempty" yaml:"habitat,omitempty"`
	Docker       *Docker  `json:"docker,omitempty" yaml:"docker,omitempty"`
	Binary       *Binary  `json:"binary,omitempty" yaml:"binary,omitempty"`
	PipelineID   int      `json:"pipelineId,omitempty" yaml:"pipelineId,omitempty"`
	SpecYamlPath string   `json:"-" yaml:"-"`
}

A CommandSpec represents a set of data for commands. Some value will be omitted if it is not set.

func LoadYaml added in v0.0.10

func LoadYaml(yamlPath string) (*CommandSpec, error)

LoadYaml receives path for command spec. It returns CommandSpec struct if yaml is valid.

func SplitCmd

func SplitCmd(cmd string) (smallSpec *CommandSpec, err error)

SplitCmd splits full command to namespace, command, version. ex(ns/cmd/1.0.1 => ns cmd 1.0.1)

func SplitCmdWithSearch

func SplitCmdWithSearch(cmds []string) (smallSpec *CommandSpec, pos int, err error)

SplitCmdWithSearch searches full command. If there is valid full command, return split full command name.

type Docker added in v0.0.10

type Docker struct {
	Image   string `json:"image,omitempty" yaml:"image,omitempty"`
	Command string `json:"command,omitempty" yaml:"command,omitempty"`
}

A Docker represents a set of data for Docker. All value will be omitted if it is not set. This will works as a part of CommandSpec.

type Habitat added in v0.0.10

type Habitat struct {
	Mode    string `json:"mode,omitempty" yaml:"mode,omitempty"`
	File    string `json:"file,omitempty" yaml:"file,omitempty"`
	Package string `json:"package,omitempty" yaml:"package,omitempty"`
	Command string `json:"command,omitempty" yaml:"command,omitempty"`
}

A Habitat represents a set of data for Habitat. All value will be omitted if it is not set. This will works as a part of CommandSpec.

type PayloadYaml added in v0.0.10

type PayloadYaml struct {
	Yaml string `json:"yaml"`
}

PayloadYaml represents a set of data for posting command. The key "yaml" and the value of json string is needed to post to api.

type TagResponse added in v0.0.20

type TagResponse struct {
	Namespace string `json:"namespace"`
	Name      string `json:"name"`
	Tag       string `json:"tag"`
	Version   string `json:"version"`
}

TagResponse represents a response from API when tags command

type TagTargetVersion added in v0.0.20

type TagTargetVersion struct {
	Version string `json:"version"`
}

TagTargetVersion represents a body of a tagging request.

type ValidateError added in v0.0.15

type ValidateError struct {
	Message string `json:"message"`
}

ValidateError represents an error message of a command validation.

type ValidateResponse added in v0.0.15

type ValidateResponse struct {
	Errors []ValidateError `json:"errors"`
}

ValidateResponse represents a response from API when validates command.

Jump to

Keyboard shortcuts

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