Documentation ¶
Overview ¶
Package environment provides... environments. They're like roles, but more so, except without run lists. They're a convenient way to share many attributes and cookbook version constraints among many servers.
Index ¶
- func DoesExist(environmentName string) (bool, util.Gerror)
- func GetList() []string
- func MakeDefaultEnvironment()
- type ChefEnvironment
- func AllEnvironments() []*ChefEnvironment
- func Get(envName string) (*ChefEnvironment, util.Gerror)
- func GetMulti(envNames []string) ([]*ChefEnvironment, util.Gerror)
- func New(name string) (*ChefEnvironment, util.Gerror)
- func NewFromJSON(jsonEnv map[string]interface{}) (*ChefEnvironment, util.Gerror)
- func (e *ChefEnvironment) AllCookbookHash(numVersions interface{}) map[string]interface{}
- func (e *ChefEnvironment) Delete() error
- func (e *ChefEnvironment) DocID() string
- func (e *ChefEnvironment) Flatten() map[string]interface{}
- func (e *ChefEnvironment) GetName() string
- func (e *ChefEnvironment) Index() string
- func (e *ChefEnvironment) RecipeList() []string
- func (e *ChefEnvironment) Save() util.Gerror
- func (e *ChefEnvironment) URLType() string
- func (e *ChefEnvironment) UpdateFromJSON(jsonEnv map[string]interface{}) util.Gerror
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeDefaultEnvironment ¶
func MakeDefaultEnvironment()
MakeDefaultEnvironment creates the default environment on startup.
Types ¶
type ChefEnvironment ¶
type ChefEnvironment struct { Name string `json:"name"` ChefType string `json:"chef_type"` JSONClass string `json:"json_class"` Description string `json:"description"` Default map[string]interface{} `json:"default_attributes"` Override map[string]interface{} `json:"override_attributes"` CookbookVersions map[string]string `json:"cookbook_versions"` }
ChefEnvironment is a collection of attributes and cookbook versions for organizing how nodes are deployed.
func AllEnvironments ¶ added in v0.5.2
func AllEnvironments() []*ChefEnvironment
AllEnvironments returns a slice of all environments on this server.
func GetMulti ¶ added in v0.10.0
func GetMulti(envNames []string) ([]*ChefEnvironment, util.Gerror)
GetMulti gets multiple environmets from a given slice of environment names.
func New ¶
func New(name string) (*ChefEnvironment, util.Gerror)
New creates a new environment, returning an error if the environment already exists or you try to create an environment named "_default".
func NewFromJSON ¶ added in v0.6.0
func NewFromJSON(jsonEnv map[string]interface{}) (*ChefEnvironment, util.Gerror)
NewFromJSON creates a new environment from JSON uploaded to the server.
func (*ChefEnvironment) AllCookbookHash ¶
func (e *ChefEnvironment) AllCookbookHash(numVersions interface{}) map[string]interface{}
AllCookbookHash returns a hash of the cookbooks and their versions available to this environment.
func (*ChefEnvironment) Delete ¶
func (e *ChefEnvironment) Delete() error
Delete the environment, returning an error if you try to delete the "_default" environment.
func (*ChefEnvironment) DocID ¶ added in v0.6.0
func (e *ChefEnvironment) DocID() string
DocID returns the environment's name.
func (*ChefEnvironment) Flatten ¶
func (e *ChefEnvironment) Flatten() map[string]interface{}
Flatten the environment so it's suitable for indexing.
func (*ChefEnvironment) GetName ¶
func (e *ChefEnvironment) GetName() string
GetName returns the environment's name.
func (*ChefEnvironment) Index ¶
func (e *ChefEnvironment) Index() string
Index returns the environment's type so the indexer knows where it should go.
func (*ChefEnvironment) RecipeList ¶
func (e *ChefEnvironment) RecipeList() []string
RecipeList gets a list of recipes available to this environment.
func (*ChefEnvironment) Save ¶
func (e *ChefEnvironment) Save() util.Gerror
Save the environment. Returns an error if you try to save the "_default" environment.
func (*ChefEnvironment) URLType ¶
func (e *ChefEnvironment) URLType() string
URLType returns the base of an environment's URL.
func (*ChefEnvironment) UpdateFromJSON ¶ added in v0.6.0
func (e *ChefEnvironment) UpdateFromJSON(jsonEnv map[string]interface{}) util.Gerror
UpdateFromJSON updates an existing environment from JSON uploaded to the server.