Documentation ¶
Overview ¶
Package cookbook handles the basic building block of any chef (or goiardi) run, the humble cookbook.
Index ¶
- Constants
- func CookbookLatest() map[string]interface{}
- func CookbookLister(numResults interface{}) map[string]interface{}
- func CookbookRecipes() ([]string, util.Gerror)
- func DependsCookbooks(runList []string, envConstraints map[string]string) (map[string]interface{}, error)
- func GetList() []string
- func Universe() map[string]map[string]interface{}
- type Cookbook
- func (c *Cookbook) ConstrainedInfoHash(numResults interface{}, constraint string) map[string]interface{}
- func (c *Cookbook) Delete() error
- func (c *Cookbook) DeleteVersion(cbVersion string) util.Gerror
- func (c *Cookbook) GetName() string
- func (c *Cookbook) GetVersion(cbVersion string) (*CookbookVersion, util.Gerror)
- func (c *Cookbook) InfoHash(numResults interface{}) map[string]interface{}
- func (c *Cookbook) LatestConstrained(constraint string) *CookbookVersion
- func (c *Cookbook) LatestVersion() *CookbookVersion
- func (c *Cookbook) NewVersion(cbVersion string, cbvData map[string]interface{}) (*CookbookVersion, util.Gerror)
- func (c *Cookbook) NumVersions() int
- func (c *Cookbook) Save() error
- func (c *Cookbook) URLType() string
- func (c *Cookbook) UpdateLatestVersion()
- type CookbookVersion
- func (cbv *CookbookVersion) GetName() string
- func (cbv *CookbookVersion) RecipeList() ([]string, util.Gerror)
- func (cbv *CookbookVersion) ToJSON(method string) map[string]interface{}
- func (cbv *CookbookVersion) URLType() string
- func (cbv *CookbookVersion) UpdateVersion(cbvData map[string]interface{}, force string) util.Gerror
- type DependsError
- type VersionStrings
Constants ¶
const ( CookbookNotFound int = iota CookbookNoVersion )
Variables ¶
This section is empty.
Functions ¶
func CookbookLatest ¶ added in v0.7.0
func CookbookLatest() map[string]interface{}
CookbookLatest returns the URL of the latest version of each cookbook on the server.
func CookbookLister ¶ added in v0.7.0
func CookbookLister(numResults interface{}) map[string]interface{}
CookbookLister lists all of the cookbooks on the server, along with some information like URL, available versions, etc.
func CookbookRecipes ¶ added in v0.7.0
CookbookRecipes returns a list of all the recipes on the server in the latest version of each cookbook.
Types ¶
type Cookbook ¶
type Cookbook struct { Name string Versions map[string]*CookbookVersion // contains filtered or unexported fields }
The Cookbook struct holds an array of cookbook versions, which is where the run lists, definitions, attributes, etc. are.
func AllCookbooks ¶ added in v0.5.0
func AllCookbooks() (cookbooks []*Cookbook)
AllCookbooks returns all the cookbooks that have been uploaded to this server.
func (*Cookbook) ConstrainedInfoHash ¶
func (c *Cookbook) ConstrainedInfoHash(numResults interface{}, constraint string) map[string]interface{}
ConstrainedInfoHash gets numResults (or all if numResults is nil) versions of a cookbook that match the given constraint and returns a hash describing the cookbook and the versions returned.
func (*Cookbook) DeleteVersion ¶
DeleteVersion deletes a particular version of a cookbook.
func (*Cookbook) GetVersion ¶
func (c *Cookbook) GetVersion(cbVersion string) (*CookbookVersion, util.Gerror)
GetVersion gets a particular version of the cookbook.
func (*Cookbook) InfoHash ¶
InfoHash gets numResults (or all if numResults is nil) versions of a cookbook,returning a hash describing the cookbook and the versions returned.
func (*Cookbook) LatestConstrained ¶
func (c *Cookbook) LatestConstrained(constraint string) *CookbookVersion
LatestConstrained returns the latest version of a cookbook that matches the given constraint. If no constraint is given, returns the latest version.
func (*Cookbook) LatestVersion ¶
func (c *Cookbook) LatestVersion() *CookbookVersion
LatestVersion gets the latest version of this cookbook.
func (*Cookbook) NewVersion ¶
func (c *Cookbook) NewVersion(cbVersion string, cbvData map[string]interface{}) (*CookbookVersion, util.Gerror)
NewVersion creates a new version of the cookbook.
func (*Cookbook) NumVersions ¶ added in v0.5.0
NumVersions returns the number of versions this cookbook has.
func (*Cookbook) UpdateLatestVersion ¶
func (c *Cookbook) UpdateLatestVersion()
UpdateLatestVersion updates what the cookbook stores as the latest version available.
type CookbookVersion ¶
type CookbookVersion struct { CookbookName string `json:"cookbook_name"` Name string `json:"name"` Version string `json:"version"` ChefType string `json:"chef_type"` JSONClass string `json:"json_class"` Definitions []map[string]interface{} `json:"definitions"` Libraries []map[string]interface{} `json:"libraries"` Attributes []map[string]interface{} `json:"attributes"` Recipes []map[string]interface{} `json:"recipes"` Providers []map[string]interface{} `json:"providers"` Resources []map[string]interface{} `json:"resources"` Templates []map[string]interface{} `json:"templates"` RootFiles []map[string]interface{} `json:"root_files"` Files []map[string]interface{} `json:"files"` IsFrozen bool `json:"frozen?"` Metadata map[string]interface{} `json:"metadata"` // contains filtered or unexported fields }
CookbookVersion is the meat of the cookbook. This is what's set when a new cookbook is uploaded.
func (*CookbookVersion) GetName ¶ added in v0.5.1
func (cbv *CookbookVersion) GetName() string
GetName returns the name of the cookbook version.
func (*CookbookVersion) RecipeList ¶
func (cbv *CookbookVersion) RecipeList() ([]string, util.Gerror)
RecipeList provides a list of recipes in this cookbook version.
func (*CookbookVersion) ToJSON ¶ added in v0.6.0
func (cbv *CookbookVersion) ToJSON(method string) map[string]interface{}
ToJSON is a helper function that coverts the internal representation of a cookbook version to JSON in a way that knife and chef-client expect.
func (*CookbookVersion) URLType ¶ added in v0.5.1
func (cbv *CookbookVersion) URLType() string
URLType returns the first path element in a cookbook version's URL.
func (*CookbookVersion) UpdateVersion ¶
func (cbv *CookbookVersion) UpdateVersion(cbvData map[string]interface{}, force string) util.Gerror
UpdateVersion updates a specific version of a cookbook.
type DependsError ¶ added in v0.9.1
type DependsError struct {
// contains filtered or unexported fields
}
func (*DependsError) ErrMap ¶ added in v0.9.1
func (d *DependsError) ErrMap() map[string]interface{}
func (*DependsError) Error ¶ added in v0.9.1
func (d *DependsError) Error() string
func (*DependsError) String ¶ added in v0.9.1
func (d *DependsError) String() string
type VersionStrings ¶
type VersionStrings []string
VersionStrings is a type to make version strings with the format "x.y.z" sortable.
func (VersionStrings) Len ¶
func (v VersionStrings) Len() int
func (VersionStrings) Less ¶
func (v VersionStrings) Less(i, j int) bool
func (VersionStrings) Swap ¶
func (v VersionStrings) Swap(i, j int)