model

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "0.3.6 (sp1r4l)"

Variables

This section is empty.

Functions

func ActiveInstanceId

func ActiveInstanceId() string

func ActiveInstancePath

func ActiveInstancePath() string

func AddBootstrapExtension

func AddBootstrapExtension(ext BootstrapExtension)

func AllocateDump added in v0.3.4

func AllocateDump(run string) string

func AllocateForensicScenario added in v0.3.5

func AllocateForensicScenario(run, scenario string) string

func Bootstrap

func Bootstrap() error

func BootstrapBindings

func BootstrapBindings() error

func BootstrapInstance

func BootstrapInstance() error

func ClearActiveInstance

func ClearActiveInstance() error

func ConfigBuild

func ConfigBuild() string

func ConfigSrc

func ConfigSrc() string

func CreateLabel

func CreateLabel(instanceId, modelName string) error

func FablabRoot

func FablabRoot() string

func KitBuild

func KitBuild() string

func ListDumps added in v0.3.4

func ListDumps() ([]string, error)

func ListInstances

func ListInstances() ([]string, error)

func ListModels

func ListModels() []string

func NewInstance

func NewInstance() (string, error)

func NewNamedInstance

func NewNamedInstance(name string) error

func PkiBuild

func PkiBuild() string

func RegisterModel

func RegisterModel(name string, m *Model)

func RemoveInstance

func RemoveInstance(instanceId string) error

func ScriptBuild

func ScriptBuild() string

func ScriptSrc

func ScriptSrc() string

func SetActiveInstance

func SetActiveInstance(instanceId string) error

Types

type Action

type Action interface {
	Execute(m *Model) error
}

type ActionBinder

type ActionBinder func(m *Model) Action

type ActionBinders

type ActionBinders map[string]ActionBinder

type ActivationBinder

type ActivationBinder func(m *Model) ActivationStage

type ActivationBinders

type ActivationBinders []ActivationBinder

type ActivationStage

type ActivationStage interface {
	Activate(m *Model) error
}

type Bindings

type Bindings map[interface{}]interface{}

func GetBindings added in v0.3.4

func GetBindings() Bindings

func (Bindings) Get

func (bindings Bindings) Get(name ...string) (interface{}, bool)

func (Bindings) Has added in v0.3.4

func (bindings Bindings) Has(name ...string) bool

func (Bindings) Must

func (bindings Bindings) Must(name ...string) interface{}

type BootstrapExtension

type BootstrapExtension interface {
	Bootstrap(m *Model) error
}

type Component

type Component struct {
	Scope
	ScriptSrc       string
	ScriptName      string
	ConfigSrc       string
	ConfigName      string
	BinaryName      string
	PublicIdentity  string
	PrivateIdentity string
}

func (*Component) Merge

func (c *Component) Merge(parent *Component) (*Component, error)

type ComponentDump added in v0.3.5

type ComponentDump struct {
	Scope           *ScopeDump `json:"scope,omitempty"`
	ScriptSrc       string     `json:"script_src,omitempty"`
	ScriptName      string     `json:"script_name,omitempty"`
	ConfigSrc       string     `json:"config_src,omitempty"`
	ConfigName      string     `json:"config_name,omitempty"`
	BinaryName      string     `json:"binary_name,omitempty"`
	PublicIdentity  string     `json:"public_identity,omitempty`
	PrivateIdentity string     `json:"private_identity,omitempty"`
}

type Components

type Components map[string]*Component

func (Components) Merge

func (c Components) Merge(parent Components) (Components, error)

type ConfigurationBinder

type ConfigurationBinder func(m *Model) ConfigurationStage

type ConfigurationBinders

type ConfigurationBinders []ConfigurationBinder

type ConfigurationStage

type ConfigurationStage interface {
	Configure(m *Model) error
}

type CpuTimeslice added in v0.3.5

type CpuTimeslice struct {
	TimestampMs   int64   `json:"timestamp_ms"`
	PercentUser   float64 `json:"percent_user"`
	PercentNice   float64 `json:"percent_nice"`
	PercentSystem float64 `json:"percent_system"`
	PercentIowait float64 `json:"percent_iowait"`
	PercentSteal  float64 `json:"percent_steal"`
	PercentIdle   float64 `json:"percent_idle"`
}

type Data

type Data map[string]interface{}

type DisposalBinder

type DisposalBinder func(m *Model) DisposalStage

type DisposalBinders

type DisposalBinders []DisposalBinder

type DisposalStage

type DisposalStage interface {
	Dispose(m *Model) error
}

type DistributionBinder

type DistributionBinder func(m *Model) DistributionStage

type DistributionBinders

type DistributionBinders []DistributionBinder

type DistributionStage

type DistributionStage interface {
	Distribute(m *Model) error
}

type Dump added in v0.3.4

type Dump struct {
	Scope   *ScopeDump             `json:"scope,omitempty"`
	Regions map[string]*RegionDump `json:"regions"`
}

type Factory

type Factory interface {
	Build(m *Model) error
}

Factory builds model instances.

type Host

type Host struct {
	Scope
	PublicIp     string
	PrivateIp    string
	InstanceType string
	Components   Components
}

func (*Host) GetComponent

func (h *Host) GetComponent(componentId string) *Component

func (*Host) GetComponents

func (h *Host) GetComponents(componentSpec string) []*Component

func (*Host) GetComponentsByTag

func (h *Host) GetComponentsByTag(componentTag string) []*Component

func (*Host) HasTag added in v0.3.6

func (h *Host) HasTag(tag string) bool

func (*Host) Merge

func (h *Host) Merge(parent *Host) (*Host, error)

type HostDump added in v0.3.4

type HostDump struct {
	Scope        *ScopeDump                `json:"scope,omitempty"`
	PublicIp     string                    `json:"public_ip,omitempty"`
	PrivateIp    string                    `json:"private_ip,omitempty"`
	InstanceType string                    `json:"instance_type,omitempty"`
	Components   map[string]*ComponentDump `json:"components,omitempty"`
}

type HostSummary added in v0.3.5

type HostSummary struct {
	Cpu     []*CpuTimeslice     `json:"cpu,omitempty"`
	Memory  []*MemoryTimeslice  `json:"memory,omitempty"`
	Process []*ProcessTimeslice `json:"process,omitempty"`
}

type Hosts

type Hosts map[string]*Host

func (Hosts) Merge

func (h Hosts) Merge(parent Hosts) (Hosts, error)

type InfrastructureBinder

type InfrastructureBinder func(m *Model) InfrastructureStage

type InfrastructureBinders

type InfrastructureBinders []InfrastructureBinder

type InfrastructureStage

type InfrastructureStage interface {
	Express(m *Model, l *Label) error
}

type InstanceState

type InstanceState int
const (
	Created InstanceState = iota
	Expressed
	Configured
	Kitted
	Distributed
	Activated
	Operating
	Disposed
)

func (InstanceState) String

func (instanceState InstanceState) String() string

type IperfSummary

type IperfSummary struct {
	Timeslices    []*IperfTimeslice `json:"timeslices"`
	Bytes         float64           `json:"bytes"`
	BitsPerSecond float64           `json:"bits_per_second"`
}

type IperfTimeslice

type IperfTimeslice struct {
	TimestampMs   int64   `json:"timestamp_ms"`
	BitsPerSecond float64 `json:"bits_per_second"`
}

type IperfUdpSummary

type IperfUdpSummary struct {
	Timeslices    []*IperfUdpTimeslice `json:"timeslices"`
	Bytes         float64              `json:"bytes"`
	BitsPerSecond float64              `json:"bits_per_second"`
	JitterMs      float64              `json:"jitter_ms"`
	LostPackets   float64              `json:"lost_packets"`
}

type IperfUdpTimeslice

type IperfUdpTimeslice struct {
	TimestampMs   int64   `json:"timestamp_ms"`
	BitsPerSecond float64 `json:"bits_per_second"`
	Packets       float64 `json:"packets"`
}

type KittingBinder

type KittingBinder func(m *Model) KittingStage

type KittingBinders

type KittingBinders []KittingBinder

type KittingStage

type KittingStage interface {
	Kit(m *Model) error
}

type Label

type Label struct {
	Model    string        `yaml:"model"`
	State    InstanceState `yaml:"state"`
	Bindings Bindings      `yaml:"bindings"`
	// contains filtered or unexported fields
}

func GetLabel

func GetLabel() *Label

func LoadLabel

func LoadLabel(path string) (*Label, error)

func LoadLabelForInstance

func LoadLabelForInstance(instanceId string) (*Label, error)

func (*Label) Get added in v0.3.4

func (label *Label) Get(name ...string) (interface{}, bool)

func (*Label) Has added in v0.3.4

func (label *Label) Has(name ...string) bool

func (*Label) Must added in v0.3.4

func (label *Label) Must(name ...string) interface{}

func (*Label) Save

func (label *Label) Save() error

func (*Label) SaveAtPath

func (label *Label) SaveAtPath(path string) error

type MemoryTimeslice added in v0.3.5

type MemoryTimeslice struct {
	TimestampMs   int64   `json:"timestamp_ms"`
	MemFreeK      int64   `json:"free_k"`
	AvailK        int64   `json:"avail_k"`
	UsedK         int64   `json:"used_k"`
	UsedPercent   float64 `json:"used_percent"`
	BuffersK      int64   `json:"buffers_k"`
	CachedK       int64   `json:"cached_k"`
	CommitK       int64   `json:"commit_k"`
	CommitPercent float64 `json:"commit_percent"`
	ActiveK       int64   `json:"active_k"`
	InactiveK     int64   `json:"inactive_k"`
	DirtyK        int64   `json:"dirty_k"`
}

type Model

type Model struct {
	Parent *Model

	Scope
	Regions Regions

	Factories      []Factory
	Actions        map[string]ActionBinder
	Infrastructure InfrastructureBinders
	Configuration  ConfigurationBinders
	Kitting        KittingBinders
	Distribution   DistributionBinders
	Activation     ActivationBinders
	Operation      OperatingBinders
	Disposal       DisposalBinders
	// contains filtered or unexported fields
}

func GetModel

func GetModel(name string) (*Model, bool)

func (*Model) Activate

func (m *Model) Activate(l *Label) error

func (*Model) BindBindings

func (m *Model) BindBindings(bindings Bindings) error

func (*Model) BindLabel

func (m *Model) BindLabel(l *Label)

func (*Model) Build

func (m *Model) Build(l *Label) error

func (*Model) Dispose

func (m *Model) Dispose(l *Label) error

func (*Model) Dump added in v0.3.4

func (m *Model) Dump() *Dump

func (*Model) Express

func (m *Model) Express(l *Label) error

func (*Model) GetAction

func (m *Model) GetAction(name string) (Action, bool)

func (*Model) GetAllHosts

func (m *Model) GetAllHosts() []*Host

func (*Model) GetAllRegions added in v0.3.5

func (m *Model) GetAllRegions() []*Region

func (*Model) GetComponentsByTag

func (m *Model) GetComponentsByTag(componentTag string) []*Component

func (*Model) GetHostById

func (m *Model) GetHostById(selectId string) (*Host, error)

func (*Model) GetHostByTags

func (m *Model) GetHostByTags(regionTag, hostTag string) *Host

func (*Model) GetHosts

func (m *Model) GetHosts(regionSpec, hostSpec string) []*Host

func (*Model) GetRegion

func (m *Model) GetRegion(regionId string) *Region

func (*Model) GetRegionByTag

func (m *Model) GetRegionByTag(regionTag string) *Region

func (*Model) GetRegionsByTag

func (m *Model) GetRegionsByTag(regionTag string) []*Region

func (*Model) GetVariable

func (m *Model) GetVariable(name ...string) (interface{}, bool)

func (*Model) IsBound

func (m *Model) IsBound() bool

func (*Model) IterateScopes

func (m *Model) IterateScopes(f func(i interface{}, path ...string))

func (*Model) Kit

func (m *Model) Kit(l *Label) error

func (*Model) Merge

func (m *Model) Merge(parent *Model) error

func (*Model) MustVariable

func (m *Model) MustVariable(name ...string) interface{}

func (*Model) Operate

func (m *Model) Operate(l *Label) error

func (*Model) Sync

func (m *Model) Sync(l *Label) error

type OperatingBinder

type OperatingBinder func(m *Model) OperatingStage

type OperatingBinders

type OperatingBinders []OperatingBinder

type OperatingStage

type OperatingStage interface {
	Operate(m *Model, run string) error
}

type ProcessTimeslice added in v0.3.5

type ProcessTimeslice struct {
	TimestampMs     int64   `json:"timestamp_ms"`
	RunQueueSize    int64   `json:"run_queue_size"`
	ProcessListSize int64   `json:"process_list_size"`
	LoadAverage1m   float64 `json:"load_average_1m"`
	LoadAverage5m   float64 `json:"load_average_5m`
	LoadAverage15m  float64 `json:"load_average_15m"`
	Blocked         int64   `json:"blocked"`
}

type Region

type Region struct {
	Scope
	Id    string
	Az    string
	Hosts Hosts
}

func (*Region) GetAllHosts added in v0.3.5

func (r *Region) GetAllHosts() []*Host

func (*Region) GetHost

func (r *Region) GetHost(hostId string) *Host

func (*Region) GetHostsByTag

func (r *Region) GetHostsByTag(hostTag string) []*Host

func (*Region) Merge

func (r *Region) Merge(parent *Region) (*Region, error)

type RegionDump added in v0.3.4

type RegionDump struct {
	Scope *ScopeDump           `json:"scope,omitempty"`
	Id    string               `json:"id,omitempty"`
	Az    string               `json:"az,omitempty"`
	Hosts map[string]*HostDump `json:"hosts,omitempty"`
}

type Regions

type Regions map[string]*Region

func (Regions) Merge

func (r Regions) Merge(parent Regions) (Regions, error)

type Scope

type Scope struct {
	Variables Variables
	Data      Data
	Tags      Tags
	// contains filtered or unexported fields
}

func (Scope) Merge

func (s Scope) Merge(parent Scope) (Scope, error)

type ScopeDump added in v0.3.4

type ScopeDump struct {
	Variables map[string]interface{} `json:"variables,omitempty"`
	Data      map[string]interface{} `json:"data,omitempty"`
	Tags      []string               `json:"tags,omitempty"`
}

type Tags

type Tags []string

type Variable

type Variable struct {
	Description    string
	Default        interface{}
	Required       bool
	Scoped         bool
	GlobalFallback bool
	Sensitive      bool
	Binder         func(v *Variable, i interface{}, path ...string)
	Value          interface{}
	// contains filtered or unexported fields
}

type VariableDump added in v0.3.4

type VariableDump struct {
	Description    string `json:"description,omitempty"`
	Default        string `json:"default,omitempty"`
	Required       bool   `json:"required"`
	Scoped         bool   `json:"scoped"`
	GlobalFallback bool   `json:"global_fallback"`
	Sensitive      bool   `json:"sensitive"`
	Binder         string `json:"binder,omitempty"`
	Value          string `json:"value,omitempty"`
	Bound          bool   `json:"bound"`
}

type Variables

type Variables map[interface{}]interface{}

type ZitiFabricLinkMetricsSummary

type ZitiFabricLinkMetricsSummary struct {
	LinkId        string  `json:"link_id"`
	LatencyP9999  float64 `json:"latency_p9999"`
	RxBytesRateM1 float64 `json:"rx_bytes_rate_m1"`
	TxBytesRateM1 float64 `json:"tx_bytes_rate_m1"`
}

type ZitiFabricLinkSummary

type ZitiFabricLinkSummary struct {
	LinkId      string  `json:"link_id"`
	State       string  `json:"state"`
	SrcRouterId string  `json:"src_router_id"`
	SrcLatency  float64 `json:"src_latency"`
	DstRouterId string  `json:"dst_router_id"`
	DstLatency  float64 `json:"dst_latency"`
}

type ZitiFabricMeshSummary

type ZitiFabricMeshSummary struct {
	TimestampMs int64                   `json:"timestamp_ms"`
	RouterIds   []string                `json:"router_ids"`
	Links       []ZitiFabricLinkSummary `json:"links,omitempty"`
}

type ZitiFabricRouterMetricsSummary

type ZitiFabricRouterMetricsSummary struct {
	SourceId             string                         `json:"source_id"`
	TimestampMs          int64                          `json:"timestamp_ms"`
	FabricRxBytesRateM1  float64                        `json:"fabric_rx_bytes_rate_m1"`
	FabricTxBytesRateM1  float64                        `json:"fabric_tx_bytes_rate_m1"`
	IngressRxBytesRateM1 float64                        `json:"ingress_rx_bytes_rate_m1"`
	IngressTxBytesRateM1 float64                        `json:"ingress_tx_bytes_rate_m1"`
	EgressRxBytesRateM1  float64                        `json:"egress_rx_bytes_rate_m1"`
	EgressTxBytesRateM1  float64                        `json:"egress_tx_bytes_rate_m1"`
	Links                []ZitiFabricLinkMetricsSummary `json:"links,omitempty"`
}

Jump to

Keyboard shortcuts

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