Documentation ¶
Index ¶
Constants ¶
const ( // defaults SEMANTIC_PREFIX = "v" MORPHEUS_PREFIX = "morpheus" )
Variables ¶
var ( ERR_TEMPLATE_ID_NOT_FOUND = errors.New("no template with that id found") ERR_TEMPLATE_NAME_NOT_FOUND = errors.New("no template with that name found") ERR_PLUGIN_ID_NOT_FOUND = errors.New("no plugin with that id found") ERR_PLUGIN_NAME_NOT_FOUND = errors.New("no plugin with that name found") )
var ERR_UNMARSHALLING = errors.New("could not unmarshal the YAML")
var ERR_UNMARSHALLING_RSS = errors.New("could not unmarshal the RSS XML")
Functions ¶
func GetMetadata ¶
func GetMetadata(remoteUri, cache string, cacheTTL time.Duration, logger *koan.Logger) ([]byte, error)
GetMetadata wraps a http request to obtain metadata from the or from a local cache, since this is a CLI we don't want to make the same HTTP request on every invocation so we cache the data with a TTL
Types ¶
type Channel ¶ added in v0.2.0
type Channel struct { Title string `xml:"title"` Link string `xml:"link"` Description string `xml:"description"` Language string `xml:"language"` PubDate string `xml:"pubDate"` Items []Item `xml:"item"` }
Channel captures RSS channel info it is not of much interest to us but included for completeness
type Item ¶ added in v0.2.0
type Item struct { Name string `xml:"name"` Code string `xml:"code"` WebLink string `xml:"webLink"` FileLink string `xml:"fileLink"` FileName string `xml:"fileName"` Version string `xml:"version"` MinApplianceVersion string `xml:"minApplianceVersion"` MaxApplianceVersion string `xml:"maxApplianceVersion"` Description string `xml:"description"` PubDate string `xml:"pubDate"` }
Item represents a single <item></item> element from the feed, again we capture it all for completeness TODO are there more properties which could be included in he feed, such as repository, provider type, and tags
type Metadata ¶
type Metadata []struct { Plugin `yaml:"plugin"` }
Metadata is a representation of the parsed YAML metadata
func ParseMetadataYAML ¶
ParseMetadataYAML parses the YAML metadata to the Metadata type then sets defaults on string types which would otherwise be default empty, we also check the category is one of those allowed
func (*Metadata) GetTemplateByIndex ¶ added in v0.4.0
GetTemplateByIndex will iterate the metadata to retrieve by index
type Plugin ¶
type Plugin struct { Name string Category string `yaml:"category"` Description string `yaml:"description"` URL string `yaml:"url"` Tags string `yaml:"tags"` Versioning Versioning `yaml:"versioning"` MinimumMorpheus string `yaml:"minimumMorpheus"` Disabled bool `yaml:"disabled"` }
Plugin represents the metadata for a single plugin starter
type RssMetadata ¶ added in v0.2.0
RssMetadata is a representation of the parsed XML RSS metadata
func ParseMetadataXML ¶ added in v0.2.0
func ParseMetadataXML(data []byte, logger *koan.Logger) (RssMetadata, error)
ParseMetadataXML parses the XML RSS feed to the Metadata type
func (*RssMetadata) GetPluginByIndex ¶ added in v0.4.0
func (md *RssMetadata) GetPluginByIndex(id int) (Item, []string, []string, []string, []string, error)
GetPluginByIndex will iterate the rss metadata to retrieve by index
func (*RssMetadata) GetPluginByName ¶ added in v0.4.0
func (md *RssMetadata) GetPluginByName(key string) (Item, int, []string, []string, []string, []string, error)
GetPluginByName will iterate the rss metadata to retrieve by name key we also return the index as useful TODO five return values because it evolved, need to refactor