manifest

package
v0.0.0-...-b9690c5 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package manifest represents structure of a user entered YAML deployment manifest.

Index

Constants

View Source
const (
	NetworkTypeManual  = "manual"
	NetworkTypeLocal   = "local"
	NetworkTypeDynamic = "dynamic"
	NetworkTypeVip     = "vip"
)

Variables

View Source
var (
	DefaultWatchTime = WatchTime{0, 60000}
)

Functions

func NewIPsFromStrings

func NewIPsFromStrings(strs []string) ([]gonet.IP, error)

Types

type Compilation

type Compilation struct {
	NetworkName string `yaml:"network"`
}

type Deployment

type Deployment struct {
	Name string `yaml:"name"`

	Releases []Release `yaml:"releases"`

	Networks []Network `yaml:"networks"`

	Compilation Compilation `yaml:"compilation"`

	// Deployment-wide update config can be
	// overwritten by job-specific update config
	Update Update `yaml:"update"`

	Jobs []Job `yaml:"jobs"`

	// Global properties.
	// Non-raw field is populated by the validator.
	PropertiesRaw map[interface{}]interface{} `yaml:"properties"`
	Properties    Properties
}

func (Deployment) CanaryWatchTime

func (d Deployment) CanaryWatchTime(job Job) WatchTime

func (Deployment) InstanceProperties

func (d Deployment) InstanceProperties(job Job, i int) Properties

func (Deployment) InstanceWatchTime

func (d Deployment) InstanceWatchTime(job Job, i int) WatchTime

func (Deployment) UpdateWatchTime

func (d Deployment) UpdateWatchTime(job Job) WatchTime

type Job

type Job struct {
	Name      string `yaml:"name"`
	Instances int    `yaml:"instances"`

	Update Update `yaml:"update"`

	// Deprecated in favor of Templates
	Template interface{} `yaml:"template"`

	Templates []Template `yaml:"templates"`

	// Job specific properties that override global properties.
	// Non-raw field is populated by the validator.
	PropertiesRaw map[interface{}]interface{} `yaml:"properties"`
	Properties    Properties

	NetworkAssociations []NetworkAssociation `yaml:"networks"`
}

type Manifest

type Manifest struct {
	Deployment Deployment
}

func NewManifestFromBytes

func NewManifestFromBytes(bytes []byte) (Manifest, error)

NewManifestFromBytes returns manifest built from given bytes. Before returning manifest is syntactically validated.

func NewManifestFromPath

func NewManifestFromPath(path string, fs boshsys.FileSystem) (Manifest, error)

NewManifestFromPath returns manifest read from the file system. Before returning manifest is syntactically validated.

type Network

type Network struct {
	Name string `yaml:"name"`

	// e.g. manual, dynamic, vip
	Type string `yaml:"type"`
}

type NetworkAssociation

type NetworkAssociation struct {
	NetworkName string `yaml:"name"`

	// Non-raw field populated by the validator.
	StaticIPsRaw []string `yaml:"static_ips"`
	StaticIPs    []gonet.IP
}

type Properties

type Properties map[string]interface{}

type Release

type Release struct {
	Name    string `yaml:"name"`
	Version string `yaml:"version"`

	// Not offical BOSH manifest construct
	URL string `yaml:"url"`
}

type SyntaxValidator

type SyntaxValidator struct {
	// contains filtered or unexported fields
}

SyntaxValidator parses and saves all manifest values to determine their syntactic validity. Determining if individual values make sense in a greater context (within a deployment or a job) is outside of scope. e.g. - can watch time string value be parsed into a time range?

func NewSyntaxValidator

func NewSyntaxValidator(manifest *Manifest) SyntaxValidator

func (SyntaxValidator) Validate

func (v SyntaxValidator) Validate() error

type Template

type Template struct {
	Name        string `yaml:"name"`
	ReleaseName string `yaml:"release"`
}

type Update

type Update struct {
	// Integer pointers to determine absence
	Canaries    *int `yaml:"canaries"`
	MaxInFlight *int `yaml:"max_in_flight"`

	// String pointers to determine absence
	CanaryWatchTimeRaw *string `yaml:"canary_watch_time"`
	UpdateWatchTimeRaw *string `yaml:"update_watch_time"`

	// Populated by the validator
	CanaryWatchTime *WatchTime
	UpdateWatchTime *WatchTime
}

type WatchTime

type WatchTime [2]int

func NewWatchTimeFromString

func NewWatchTimeFromString(str string) (WatchTime, error)

func (WatchTime) End

func (wt WatchTime) End() int

func (WatchTime) Start

func (wt WatchTime) Start() int

Jump to

Keyboard shortcuts

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