Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dependency ¶
type Dependency struct { // Name on the pack dependency which must match the MetadataPack.Name // value if the source is empty. Otherwise, the source dictates where the // pack is loaded from, allowing the same pack to be used multiple times as // a dependency with different variables. Name string `hcl:"name,label"` // Source is the remote source where the pack can be fetched. This string // can follow any format as supported by go-getter or be a local path // indicating the pack has already been downloaded. Source string `hcl:"source,optional"` // Enabled is a boolean flag to determine whether the dependency is // available for loading. This allows easy administrative control. Enabled *bool `hcl:"enabled,optional"` }
Dependency is a single dependency of a pack. A pack can have multiple and each dependency represents an individual pack. A pack can be used as a dependency multiple times. This allows helper pack to define jobspec blocks which are used multiple times, with different variable substitutions.
type File ¶
type File struct { // Name represents the name of the file as a reference from the pack // directory. Name string // Path is the absolute path of the file in question. Path string // Content is the file contents as a byte array. Content []byte }
File is an individual file component of a Pack.
type Metadata ¶
type Metadata struct { App *MetadataApp `hcl:"app,block"` Pack *MetadataPack `hcl:"pack,block"` Dependencies []*Dependency `hcl:"dependency,block"` }
Metadata is the contents of the Pack metadata.hcl file. It contains high-level information about the pack which is useful for operators and is also exposed as template variables during rendering.
func (*Metadata) AddToInterfaceMap ¶
AddToInterfaceMap adds the metadata information to the provided map as a new entry under the "nom" key. This is useful for adding this information to the template rendering data.
func (*Metadata) ConvertToMapInterface ¶
ConvertToMapInterface returns a map[string]interface{} representation of the metadata object. The conversion doesn't take into account empty values and will add them.
type MetadataApp ¶
type MetadataApp struct { // URL is the HTTP(S) url to the homepage of the application to provide a // quick reference to the documentation and help pages. URL string `hcl:"url"` // Author is an identifier to the author and maintainer of the pack such as // HashiCorp or James Rasell Author string `hcl:"author"` }
MetadataApp contains information regarding the application that the pack is focussed around.
type MetadataPack ¶
type MetadataPack struct { // Name of the pack which acts as a convenience for use within template // rendering. Name string `hcl:"name"` // Description is a small overview of the application that is deployed by // the pack. Description string `hcl:"description,optional"` // URL is the HTTP(S) url of the pack which is acts as a convenience when // managing packs within a registry. URL string `hcl:"url"` // Version is the version of the pack which is acts as a convenience when // managing packs within a registry. Version string `hcl:"version"` }
MetadataPack contains information regarding the pack itself.
type Pack ¶
type Pack struct { // Metadata is the contents of the Pack metadata.hcl file. It contains // high-level information about the pack which is useful for operators and // is also exposed as template variables during rendering. Metadata *Metadata // TemplateFiles are the templated files which constitute this Pack. The // list includes both helper templates and Nomad resource templates and all // files within the list will be processed by the rendering engine. TemplateFiles []*File // RootVariableFile is the file which contains the root variables that can // include a description, type, and default value. This is parsed along // with any override variables and stored within Variables. RootVariableFile *File // OutputTemplateFile contains the optional output template file. If this // string is empty, it is assumed there is no output template to render and // print. OutputTemplateFile *File // contains filtered or unexported fields }
Pack is a single nomad-pack package and contains all the required information to successfully interrogate and render the pack.
func (*Pack) AddDependencies ¶
AddDependencies to the pack, correctly setting their parent pack identifier.
func (*Pack) Dependencies ¶
Dependencies returns the list of dependence the Pack has.
func (*Pack) HasParent ¶
HasParent reports whether this pack has a parent or can be considered the top level pack.
func (*Pack) Name ¶
Name returns the name of the pack. The canonical value for this comes from the Pack.Name Metadata struct field.
func (*Pack) RootVariableFiles ¶
RootVariableFiles generates a mapping of all root variable files for the pack and all dependencies.