Documentation ¶
Index ¶
- Constants
- func ValidateClusterConfTmpl(clusterTmpl *ClusterConfTemplate, input *ClusterUserConfig) error
- type App
- type BufferedFile
- type ClusterConf
- type ClusterConfTemplate
- type ClusterUserConfig
- type ConfigTemplate
- type HealthCheck
- type IndexFile
- func (i IndexFile) Add(md *Metadata, filename, baseURL, digest string)
- func (i IndexFile) Get(name, version string) (*Version, error)
- func (i IndexFile) Has(name, version string) bool
- func (i *IndexFile) Merge(f *IndexFile)
- func (i IndexFile) SortEntries()
- func (i IndexFile) WriteFile(dest string, mode os.FileMode) error
- type Maintainer
- type Metadata
- func (m *Metadata) GetApiVersion() string
- func (m *Metadata) GetAppVersion() string
- func (m *Metadata) GetDescription() string
- func (m *Metadata) GetHome() string
- func (m *Metadata) GetIcon() string
- func (m *Metadata) GetKeywords() []string
- func (m *Metadata) GetMaintainers() []*Maintainer
- func (m *Metadata) GetName() string
- func (m *Metadata) GetSources() []string
- func (m *Metadata) GetVersion() string
- type Monitor
- type Node
- type Service
- type ServiceParams
- type Version
- type Versions
Constants ¶
const ( TypeArray = "array" TypeString = "string" TypeInteger = "integer" TypeNumber = "number" TypePassword = "password" TypeBoolean = "boolean" )
const APIVersionV1 = "v1"
const ClusterSchema = `` /* 13647-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func ValidateClusterConfTmpl ¶
func ValidateClusterConfTmpl(clusterTmpl *ClusterConfTemplate, input *ClusterUserConfig) error
Types ¶
type App ¶
type App struct { Metadata *Metadata `json:"metadata,omitempty"` ConfigTemplate *ConfigTemplate `json:"config,omitempty"` ClusterConfTemplate *ClusterConfTemplate `json:"cluster_template,omitempty"` Files []BufferedFile `json:"files,omitempty"` }
type BufferedFile ¶
BufferedFile represents an archive file buffered for later processing.
type ClusterConf ¶
type ClusterConf struct { RenderJson string `json:"-"` AppId string `json:"app_id"` VersionId string `json:"version_id"` GlobalUuid string `json:"global_uuid"` Name string `json:"name"` Description string `json:"description"` Subnet string `json:"subnet"` Links map[string]string `json:"links"` BackupPolicy string `json:"backup_policy"` IncrementalBackupSupported *bool `json:"incremental_backup_supported"` UpgradePolicy []string `json:"upgrade_policy"` Nodes []Node `json:"nodes"` Env map[string]interface{} `json:"env"` AdvancedActions []string `json:"advanced_actions"` Endpoints map[string]struct { Port uint32 `json:"port"` Protocol string `json:"protocol"` } `json:"endpoints"` MetadataRootAccess *bool `json:"metadata_root_access"` HealthCheck *HealthCheck `json:"health_check"` Monitor *Monitor `json:"monitor"` DisplayTabs struct { DisplayTabsItems map[string]struct { Cmd string `json:"cmd"` RolesToExecuteOn []string `json:"roles_to_execute_on"` Description string `json:"description"` Timeout uint32 `json:"timeout"` } } `json:"display_tabs"` }
func (ClusterConf) Validate ¶
func (c ClusterConf) Validate() error
type ClusterConfTemplate ¶
type ClusterConfTemplate struct {
Raw string
}
func (*ClusterConfTemplate) Render ¶
func (c *ClusterConfTemplate) Render(input ClusterUserConfig) (ClusterConf, error)
type ClusterUserConfig ¶
type ClusterUserConfig interface{}
type ConfigTemplate ¶
type ConfigTemplate struct { Raw string Type string `json:"type,omitempty"` Properties []*ConfigTemplate `json:"properties,omitempty"` Key string `json:"key,omitempty"` Description string `json:"description,omitempty"` Required bool `json:"required,omitempty"` Default interface{} `json:"default,omitempty"` Pattern string `json:"pattern,omitempty"` Limits map[string][]string `json:"limits,omitempty"` AllowedOperations []string `json:"allowed_operations,omitempty"` Port int `json:"port,omitempty"` Range []interface{} `json:"range,omitempty"` Min int `json:"min,omitempty"` Max int `json:"max,omitempty"` Step int `json:"step,omitempty"` Changeable bool `json:"changeable,omitempty"` Separator string `json:"separator,omitempty"` Multichoice bool `json:"multichoice,omitempty"` }
func DecodeConfigJson ¶
func DecodeConfigJson(data []byte) (*ConfigTemplate, error)
func (*ConfigTemplate) GetDefaultConfig ¶
func (c *ConfigTemplate) GetDefaultConfig() ClusterUserConfig
type HealthCheck ¶
type HealthCheck struct { Enable *bool `json:"enable"` IntervalSec uint32 `json:"interval_sec"` TimeoutSec uint32 `json:"timeout_sec"` ActionTimeoutSec uint32 `json:"action_timeout_sec"` HealthyThreshold uint32 `json:"healthy_threshold"` UnhealthyThreshold uint32 `json:"unhealthy_threshold"` CheckCmd string `json:"check_cmd"` ActionCmd string `json:"action_cmd"` }
type IndexFile ¶
type IndexFile struct { APIVersion string `json:"api_version"` Generated time.Time `json:"generated"` Entries map[string]Versions `json:"entries"` }
func LoadIndexFile ¶
LoadIndexFile takes a file at the given path and returns an IndexFile object
func (IndexFile) Get ¶
Get returns the AppVersion for the given name.
If version is empty, this will return the app with the highest version.
func (IndexFile) Has ¶
Has returns true if the index has an entry for a app with the given name and exact version.
func (*IndexFile) Merge ¶
Merge merges the given index file into this index.
This merges by name and version.
If one of the entries in the given index does _not_ already exist, it is added. In all other cases, the existing record is preserved.
This can leave the index in an unsorted state
func (IndexFile) SortEntries ¶
func (i IndexFile) SortEntries()
SortEntries sorts the entries by version in descending order.
In canonical form, the individual version records should be sorted so that the most recent release for every version is in the 0th slot in the Entries.AppVersions array. That way, tooling can predict the newest version without needing to parse SemVers.
type Maintainer ¶
type Metadata ¶
type Metadata struct { ApiVersion string `json:"api_version,omitempty"` Name string `json:"name"` Version string `json:"version"` AppVersion string `json:"app_version,omitempty"` Description string `json:"description,omitempty"` Home string `json:"home,omitempty"` Icon string `json:"icon,omitempty"` Maintainers []*Maintainer `json:"maintainers,omitempty"` Screenshots []string `json:"screenshots,omitempty"` Keywords []string `json:"keywords,omitempty"` Sources []string `json:"sources,omitempty"` }
func DecodePackageJson ¶
func (*Metadata) GetApiVersion ¶
func (*Metadata) GetAppVersion ¶
func (*Metadata) GetDescription ¶
func (*Metadata) GetKeywords ¶
func (*Metadata) GetMaintainers ¶
func (m *Metadata) GetMaintainers() []*Maintainer
func (*Metadata) GetSources ¶
func (*Metadata) GetVersion ¶
type Monitor ¶
type Monitor struct { Enable *bool `json:"enable"` Cmd string `json:"cmd"` Items map[string]struct { Unit string `json:"unit"` ValueType string `json:"value_type"` StatisticsType string `json:"statistics_type"` ScaleFactorWhenDisplay uint32 `json:"scale_factor_when_display"` Enums []string `json:"enums"` } `json:"items"` Groups map[string][]string `json:"groups"` Display []string `json:"display"` Alarm []string `json:"alarm"` }
type Node ¶
type Node struct { Role string `json:"role"` AdvancedActions []string `json:"advanced_actions"` Loadbalancer []struct { Listener string `json:"listener"` Port uint32 `json:"port"` Policy string `json:"policy"` } `json:"loadbalancer"` Container struct { Type string `json:"type"` Image string `json:"image"` } `json:"container"` Count uint32 `json:"count"` CPU uint32 `json:"cpu"` Memory uint32 `json:"memory"` GPU uint32 `json:"gpu"` Volume struct { Size uint32 `json:"size"` InstanceSize uint32 `json:"instance_size"` MountPoint interface{} `json:"mount_point"` MountOptions string `json:"mount_options"` Filesystem string `json:"filesystem"` } `json:"volume"` Replica uint32 `json:"replica"` Passphraseless string `json:"passphraseless"` VerticalScalingPolicy string `json:"vertical_scaling_policy"` UserAccess *bool `json:"user_access"` Services map[string]interface{} `json:"services"` ServerIDUpperBound uint32 `json:"server_id_upper_bound"` Env map[string]interface{} `json:"env"` AgentInstalled *bool `json:"agent_installed"` CustomMetadata map[string]interface{} `json:"custom_metadata"` HealthCheck *HealthCheck `json:"health_check"` Monitor *Monitor `json:"monitor"` }
type Service ¶
type Service struct { NodesToExecuteOn *uint32 `json:"nodes_to_execute_on"` PostStartService *bool `json:"post_start_service"` PostStopService *bool `json:"post_stop_service"` Timeout *uint32 `json:"timeout"` ServiceParams map[string]interface{} `json:"service_params"` PreCheck string `json:"pre_check"` Cmd string `json:"cmd"` Order *uint32 `json:"order"` }
type ServiceParams ¶
type ServiceParams struct {
Params map[string]interface{}
}
type Version ¶
type Version struct { *Metadata URLs []string `json:"urls"` Created time.Time `json:"created,omitempty"` Removed bool `json:"removed,omitempty"` Digest string `json:"digest,omitempty"` }
Version represents a app entry in the IndexFile