cookbook

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2016 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package cookbook handles the basic building block of any chef (or goiardi) run, the humble cookbook.

Index

Constants

View Source
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

func CookbookRecipes() ([]string, util.Gerror)

CookbookRecipes returns a list of all the recipes on the server in the latest version of each cookbook.

func DependsCookbooks

func DependsCookbooks(runList []string, envConstraints map[string]string) (map[string]interface{}, error)

DependsCookbooks will, for the given run list and environment constraints, return the cookbook dependencies.

func GetList

func GetList() []string

GetList gets a list of all cookbooks on this server.

func Universe added in v0.7.0

func Universe() map[string]map[string]interface{}

Universe returns a hash of the cookbooks stored on this server, with a list of each version of each cookbook formatted to be compatible with the supermarket/berks /universe endpoint.

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 Get

func Get(name string) (*Cookbook, util.Gerror)

Get a cookbook.

func New

func New(name string) (*Cookbook, util.Gerror)

New creates a new cookbook.

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) Delete

func (c *Cookbook) Delete() error

Delete a coookbook.

func (*Cookbook) DeleteVersion

func (c *Cookbook) DeleteVersion(cbVersion string) util.Gerror

DeleteVersion deletes a particular version of a cookbook.

func (*Cookbook) GetName

func (c *Cookbook) GetName() string

GetName returns the name of the cookbook.

func (*Cookbook) GetVersion

func (c *Cookbook) GetVersion(cbVersion string) (*CookbookVersion, util.Gerror)

GetVersion gets a particular version of the cookbook.

func (*Cookbook) InfoHash

func (c *Cookbook) InfoHash(numResults interface{}) map[string]interface{}

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

func (c *Cookbook) NumVersions() int

NumVersions returns the number of versions this cookbook has.

func (*Cookbook) Save

func (c *Cookbook) Save() error

Save a cookbook to the in-memory data store or database.

func (*Cookbook) URLType

func (c *Cookbook) URLType() string

URLType returns the first path element in a cookbook's URL.

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)

Jump to

Keyboard shortcuts

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