models

package
v0.0.0-...-dd9c9e3 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MIT Imports: 10 Imported by: 46

Documentation

Index

Constants

View Source
const (
	// DefaultIsAlwaysRun ...
	DefaultIsAlwaysRun = false
	// DefaultIsRequiresAdminUser ...
	DefaultIsRequiresAdminUser = false
	// DefaultIsSkippable ...
	DefaultIsSkippable = false
	// DefaultTimeout ...
	DefaultTimeout = 0
)

Variables

This section is empty.

Functions

func CmpSemver

func CmpSemver(a, b Semver) int

func JSONMarshallable

func JSONMarshallable(source map[string]interface{}) (map[string]interface{}, error)

JSONMarshallable replaces map[interface{}]interface{} with map[string]string recursively map[interface{}]interface{} is usually returned by parser go-yaml/v2

Types

type AptGetDepModel

type AptGetDepModel struct {
	// Name is the package name for Apt-get
	Name string `json:"name,omitempty" yaml:"name,omitempty"`
	// BinName is the binary's name, if it doesn't match the package's name.
	// Can be used for e.g. calling `which`.
	// E.g. in case of "AWS CLI" the package is `awscli` and the binary is `aws`.
	// If BinName is empty Name will be used as BinName too.
	BinName string `json:"bin_name,omitempty" yaml:"bin_name,omitempty"`
}

func (AptGetDepModel) GetBinaryName

func (aptGetDep AptGetDepModel) GetBinaryName() string

GetBinaryName ...

type BashStepToolkitModel

type BashStepToolkitModel struct {
	EntryFile string `json:"entry_file,omitempty" yaml:"entry_file,omitempty"`
}

type BrewDepModel

type BrewDepModel struct {
	// Name is the package name for Brew
	Name string `json:"name,omitempty" yaml:"name,omitempty"`
	// BinName is the binary's name, if it doesn't match the package's name.
	// Can be used for e.g. calling `which`.
	// E.g. in case of "AWS CLI" the package is `awscli` and the binary is `aws`.
	// If BinName is empty Name will be used as BinName too.
	BinName string `json:"bin_name,omitempty" yaml:"bin_name,omitempty"`
}

func (BrewDepModel) GetBinaryName

func (brewDep BrewDepModel) GetBinaryName() string

GetBinaryName ...

type DependencyModel

type DependencyModel struct {
	Manager string `json:"manager,omitempty" yaml:"manager,omitempty"`
	Name    string `json:"name,omitempty" yaml:"name,omitempty"`
}

type DepsModel

type DepsModel struct {
	Brew   []BrewDepModel   `json:"brew,omitempty" yaml:"brew,omitempty"`
	AptGet []AptGetDepModel `json:"apt_get,omitempty" yaml:"apt_get,omitempty"`
}

type DownloadLocationModel

type DownloadLocationModel struct {
	Type string `json:"type"`
	Src  string `json:"src"`
}

type EnvInfoModel

type EnvInfoModel struct {
	Key          string   `json:"key,omitempty" yaml:"key,omitempty"`
	Title        string   `json:"title,omitempty" yaml:"title,omitempty"`
	Description  string   `json:"description,omitempty" yaml:"description,omitempty"`
	ValueOptions []string `json:"value_options,omitempty" yaml:"value_options,omitempty"`
	DefaultValue string   `json:"default_value,omitempty" yaml:"default_value,omitempty"`
	IsExpand     bool     `json:"is_expand" yaml:"is_expand"`
	IsSensitive  bool     `json:"is_sensitive" yaml:"is_sensitive"`
}

type GoStepToolkitModel

type GoStepToolkitModel struct {
	// PackageName - required
	PackageName string `json:"package_name" yaml:"package_name"`
}

type Semver

type Semver struct {
	Major, Minor, Patch uint64
}

Semver represents a semantic version

func ParseSemver

func ParseSemver(version string) (Semver, error)

func (*Semver) String

func (v *Semver) String() string

String converts a Semver to string

type StepCollectionModel

type StepCollectionModel struct {
	FormatVersion         string                  `json:"format_version" yaml:"format_version"`
	GeneratedAtTimeStamp  int64                   `json:"generated_at_timestamp" yaml:"generated_at_timestamp"`
	SteplibSource         string                  `json:"steplib_source" yaml:"steplib_source"`
	DownloadLocations     []DownloadLocationModel `json:"download_locations" yaml:"download_locations"`
	AssetsDownloadBaseURI string                  `json:"assets_download_base_uri" yaml:"assets_download_base_uri"`
	Steps                 StepHash                `json:"steps" yaml:"steps"`
}

func (StepCollectionModel) GetDownloadLocations

func (collection StepCollectionModel) GetDownloadLocations(id, version string) ([]DownloadLocationModel, error)

GetDownloadLocations ...

func (StepCollectionModel) GetLatestStepVersion

func (collection StepCollectionModel) GetLatestStepVersion(id string) (string, error)

GetLatestStepVersion ...

func (StepCollectionModel) GetStep

func (collection StepCollectionModel) GetStep(id, version string) (StepModel, bool, bool)

GetStep ...

func (StepCollectionModel) GetStepVersion

func (collection StepCollectionModel) GetStepVersion(id, version string) (stepVersion StepVersionModel, stepFound bool, versionFound bool)

GetStepVersion ...

func (StepCollectionModel) IsStepExist

func (collection StepCollectionModel) IsStepExist(id, version string) bool

IsStepExist ...

type StepGroupInfoModel

type StepGroupInfoModel struct {
	RemovalDate    string            `json:"removal_date,omitempty" yaml:"removal_date,omitempty"`
	DeprecateNotes string            `json:"deprecate_notes,omitempty" yaml:"deprecate_notes,omitempty"`
	AssetURLs      map[string]string `json:"asset_urls,omitempty" yaml:"asset_urls,omitempty"`
	Maintainer     string            `json:"maintainer,omitempty" yaml:"maintainer,omitempty"`
}

type StepGroupModel

type StepGroupModel struct {
	Info                StepGroupInfoModel   `json:"info,omitempty" yaml:"info,omitempty"`
	LatestVersionNumber string               `json:"latest_version_number,omitempty" yaml:"latest_version_number,omitempty"`
	Versions            map[string]StepModel `json:"versions,omitempty" yaml:"versions,omitempty"`
}

func (StepGroupModel) LatestVersion

func (stepGroup StepGroupModel) LatestVersion() (StepModel, bool)

type StepHash

type StepHash map[string]StepGroupModel

type StepInfoModel

type StepInfoModel struct {
	Library         string             `json:"library,omitempty" yaml:"library,omitempty"`
	ID              string             `json:"id,omitempty" yaml:"id,omitempty"`
	Version         string             `json:"version,omitempty" yaml:"version,omitempty"`
	OriginalVersion string             `json:"original_version,omitempty" yaml:"original_version,omitempty"`
	LatestVersion   string             `json:"latest_version,omitempty" yaml:"latest_version,omitempty"`
	GroupInfo       StepGroupInfoModel `json:"info,omitempty" yaml:"info,omitempty"`
	Step            StepModel          `json:"step,omitempty" yaml:"step,omitempty"`
	DefinitionPth   string             `json:"definition_pth,omitempty" yaml:"definition_pth,omitempty"`
}

func (StepInfoModel) CreateFromJSON

func (stepInfo StepInfoModel) CreateFromJSON(jsonStr string) (StepInfoModel, error)

CreateFromJSON ...

func (StepInfoModel) JSON

func (stepInfo StepInfoModel) JSON() string

JSON ...

func (StepInfoModel) String

func (stepInfo StepInfoModel) String() string

String ...

type StepListModel

type StepListModel struct {
	StepLib string   `json:"steplib,omitempty" yaml:"steplib,omitempty"`
	Steps   []string `json:"steps,omitempty" yaml:"steps,omitempty"`
}

type StepModel

type StepModel struct {
	Title       *string `json:"title,omitempty" yaml:"title,omitempty"`
	Summary     *string `json:"summary,omitempty" yaml:"summary,omitempty"`
	Description *string `json:"description,omitempty" yaml:"description,omitempty"`
	//
	Website       *string `json:"website,omitempty" yaml:"website,omitempty"`
	SourceCodeURL *string `json:"source_code_url,omitempty" yaml:"source_code_url,omitempty"`
	SupportURL    *string `json:"support_url,omitempty" yaml:"support_url,omitempty"`
	// auto-generated at share
	PublishedAt *time.Time        `json:"published_at,omitempty" yaml:"published_at,omitempty"`
	Source      *StepSourceModel  `json:"source,omitempty" yaml:"source,omitempty"`
	AssetURLs   map[string]string `json:"asset_urls,omitempty" yaml:"asset_urls,omitempty"`
	//
	HostOsTags          []string          `json:"host_os_tags,omitempty" yaml:"host_os_tags,omitempty"`
	ProjectTypeTags     []string          `json:"project_type_tags,omitempty" yaml:"project_type_tags,omitempty"`
	TypeTags            []string          `json:"type_tags,omitempty" yaml:"type_tags,omitempty"`
	Dependencies        []DependencyModel `json:"dependencies,omitempty" yaml:"dependencies,omitempty"`
	Toolkit             *StepToolkitModel `json:"toolkit,omitempty" yaml:"toolkit,omitempty"`
	Deps                *DepsModel        `json:"deps,omitempty" yaml:"deps,omitempty"`
	IsRequiresAdminUser *bool             `json:"is_requires_admin_user,omitempty" yaml:"is_requires_admin_user,omitempty"`
	// IsAlwaysRun : if true then this step will always run,
	//  even if a previous step fails.
	IsAlwaysRun *bool `json:"is_always_run,omitempty" yaml:"is_always_run,omitempty"`
	// IsSkippable : if true and this step fails the build will still continue.
	//  If false then the build will be marked as failed and only those
	//  steps will run which are marked with IsAlwaysRun.
	IsSkippable *bool `json:"is_skippable,omitempty" yaml:"is_skippable,omitempty"`
	// RunIf : only run the step if the template example evaluates to true
	RunIf   *string `json:"run_if,omitempty" yaml:"run_if,omitempty"`
	Timeout *int    `json:"timeout,omitempty" yaml:"timeout,omitempty"`
	// The timeout (in seconds) until a Step with no output (stdout/stderr) is aborted
	// 0 means timeout is disabled.
	NoOutputTimeout *int                   `json:"no_output_timeout,omitempty" yaml:"no_output_timeout,omitempty"`
	Meta            map[string]interface{} `json:"meta,omitempty" yaml:"meta,omitempty"`
	//
	Inputs  []envmanModels.EnvironmentItemModel `json:"inputs,omitempty" yaml:"inputs,omitempty"`
	Outputs []envmanModels.EnvironmentItemModel `json:"outputs,omitempty" yaml:"outputs,omitempty"`
}

StepModel ...

func (*StepModel) Audit

func (step *StepModel) Audit() error

Audit ...

func (*StepModel) AuditBeforeShare

func (step *StepModel) AuditBeforeShare() error

AuditBeforeShare ...

func (*StepModel) FillMissingDefaults

func (step *StepModel) FillMissingDefaults() error

FillMissingDefaults ...

func (*StepModel) Normalize

func (step *StepModel) Normalize() error

Normalize ...

func (*StepModel) ValidateInputAndOutputEnvs

func (step *StepModel) ValidateInputAndOutputEnvs(checkRequiredFields bool) error

ValidateInputAndOutputEnvs ...

type StepSourceModel

type StepSourceModel struct {
	Git    string `json:"git,omitempty" yaml:"git,omitempty"`
	Commit string `json:"commit,omitempty" yaml:"commit,omitempty"`
}

type StepToolkitModel

type StepToolkitModel struct {
	Bash  *BashStepToolkitModel  `json:"bash,omitempty" yaml:"bash,omitempty"`
	Go    *GoStepToolkitModel    `json:"go,omitempty" yaml:"go,omitempty"`
	Swift *SwiftStepToolkitModel `json:"swift,omitempty" yaml:"swift,omitempty"`
}

type StepVersionModel

type StepVersionModel struct {
	Step                   StepModel
	Version                string
	LatestAvailableVersion string
}

type SteplibInfoModel

type SteplibInfoModel struct {
	URI      string `json:"uri,omitempty" yaml:"uri,omitempty"`
	SpecPath string `json:"spec_path,omitempty" yaml:"spec_path,omitempty"`
}

type SwiftStepToolkitModel

type SwiftStepToolkitModel struct {
	BinaryLocation string `json:"binary_location,omitempty" yaml:"binary_location,omitempty"`
	ExecutableName string `json:"executable_name,omitempty" yaml:"executable_name,omitempty"`
}

type VersionConstraint

type VersionConstraint struct {
	VersionLockType VersionLockType
	Version         Semver
}

VersionConstraint describes a version and a cosntraint (e.g. use latest major version available)

func ParseRequiredVersion

func ParseRequiredVersion(version string) (VersionConstraint, error)

ParseRequiredVersion returns VersionConstraint model from raw version string

type VersionLockType

type VersionLockType int

VersionLockType is the type of version lock

const (
	// InvalidVersionConstraint is the value assigned to a VersionLockType if not explicitly initialized
	InvalidVersionConstraint VersionLockType = iota
	// Fixed is an exact version, e.g. 1.2.5
	Fixed
	// Latest means the latest available version
	Latest
	// MajorLocked means the latest available version with a given major version, e.g. 1.*.*
	MajorLocked
	// MinorLocked means the latest available version with a given major and minor version, e.g. 1.2.*
	MinorLocked
)

Jump to

Keyboard shortcuts

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