chef

package module
v0.0.0-...-0673ba5 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2014 License: Apache-2.0 Imports: 18 Imported by: 0

README

chef

In-memory Chef API abiding to golang interface convention. Supplies Readers!

Build Status Coverage Status

Documentation

Index

Constants

View Source
const ChefVersion = "11.12.0"

ChefVersion that we pretend to emulate

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	// contains filtered or unexported fields
}

AuthConfig representing a client and a private key used for encryption

func (AuthConfig) SignRequest

func (ac AuthConfig) SignRequest(request *http.Request) error

SignRequest modifies headers of an http.Request

type Client

type Client struct {
	Auth    *AuthConfig
	BaseURL *url.URL

	Environments *EnvironmentService
	Nodes        *NodeService
	// contains filtered or unexported fields
}

Client is vessel for public methods used against the chef-server

func NewClient

func NewClient(cfg *Config) (*Client, error)

NewClient is the client generator used to instantiate a client for talking to a chef-server It is a simple constructor for the Client struct intended as a easy interface for issuing signed requests

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)

func (*Client) MakeRequest

func (c *Client) MakeRequest(method string, requestUrl string, body io.Reader) (*http.Request, error)

MakeRequest performs a signed request for the chef client

type Config

type Config struct {
	Name    string
	Key     string
	BaseURL string
	SkipSSL bool
}

Config contains the configuration options for a chef client

type Cookbook

type Cookbook struct {
	*Reader
	// contains filtered or unexported fields
}

Cookbook is the chef-cookbook container

func NewCookbook

func NewCookbook(reader *Reader) (*Cookbook, error)

NewCookbook is used to create a cookbook from a Reader

type CookbookItem

type CookbookItem struct {
	Url         string `mapstructure:"url"`
	Path        string `mapstructure:"path"`
	Name        string `mapstructure:"name"`
	Checksum    string `mapstructure:"checksum"`
	Specificity string `mapstructure:"specificity"`
}

Each Cookbook lists it's files as a cookbookItem. This structure captures those and makes it easier to work with cook data

type CookbookMeta

type CookbookMeta struct {
	Name            string            `mapstructure:"cookbook_name"`
	Version         string            `mapstructure:"version"`
	Description     string            `mapstructure:"description"`
	LongDescription string            `mapstructure:"long_description"`
	Maintainer      string            `mapstructure:"maintainer"`
	MaintainerEmail string            `mapstructure:"maintainer_email"`
	License         string            `mapstructure:"license"`
	Platforms       map[string]string `mapstructure:"platforms"`
	Depends         map[string]string `mapstructure:"dependencies"`
	Reccomends      map[string]string `mapstructure:"recommendations"`
	Suggests        map[string]string `mapstructure:"suggestions"`
	Conflicts       map[string]string `mapstructure:"conflicting"`
	Provides        map[string]string `mapstructure:"providing"`
	Replaces        map[string]string `mapstructure:"replacing"`
	// contains filtered or unexported fields
}

CookbookMeta represents a Golang version of cookbook metadata

type Environment

type Environment struct {
	Name               string      `json:"name"`
	Description        string      `json:"description"`
	ChefType           string      `json:"chef_type"`
	DefaultAttributes  interface{} `json:"default_attributes"`
	OverrideAttributes interface{} `json:"override_attributes"`
	JsonClass          string      `json:"json_class"`
	CookbookVersions   interface{} `json:"cookbook_versions"`
}

Environment represents the native Go version of the deserialized Environment type

type EnvironmentService

type EnvironmentService struct {
	// contains filtered or unexported fields
}

Environment has a Reader, hey presto

func (*EnvironmentService) Get

func (e *EnvironmentService) Get(name string) (*Environment, error)

Get gets an environment from the Chef server.

Chef API docs: http://docs.opscode.com/api_chef_server.html#id17

func (*EnvironmentService) List

func (e *EnvironmentService) List() (data map[string]string, err error)

List lists the environments in the Chef server.

Chef API docs: http://docs.opscode.com/api_chef_server.html#id14

type Node

type Node struct {
	Name                string                 `json:"name"`
	Environment         string                 `json:"chef_environment"`
	ChefType            string                 `json:"chef_type"`
	AutomaticAttributes map[string]interface{} `json:"automatic"`
	NormalAttributes    map[string]interface{} `json:"normal"`
	DefaultAttributes   map[string]interface{} `json:"default"`
	OverrideAttributes  map[string]interface{} `json:"override"`
	JsonClass           string                 `json:"json_class"`
	RunList             []string               `json:"run_list"`
}

Node represents the native Go version of the deserialized Node type

type NodeService

type NodeService struct {
	// contains filtered or unexported fields
}

func (*NodeService) Get

func (e *NodeService) Get(name string) (*Node, error)

Get gets a node from the Chef server.

Chef API docs: http://docs.opscode.com/api_chef_server.html#id28

func (*NodeService) List

func (e *NodeService) List() (data map[string]string, err error)

List lists the nodes in the Chef server.

Chef API docs: http://docs.opscode.com/api_chef_server.html#id25

type Reader

type Reader map[string]interface{}

Reader is a map string interface of arbitrary json

func (*Reader) Read

func (b *Reader) Read(p []byte) (size int, err error)

Read uses json.Marshal internally to provide a []byte interface to our raw json data

type Role

type Role struct {
	*Reader
	// contains filtered or unexported fields
}

Role has a Reader, hey presto

func NewRole

func NewRole(reader *Reader) (*Role, error)

NewRole wraps a Role around a pointer to a Reader

type RunList

type RunList []string

Jump to

Keyboard shortcuts

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