chef

package
v0.0.0-...-ac43bb1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCookbookNotFound        = errors.New("cookbook not found")
	ErrCookbookVersionNotFound = errors.New("cookbook version not found")
	ErrCookbookFileNotFound    = errors.New("cookbook file not found")
	ErrInternalServerError     = errors.New("internal server error")
)
View Source
var (
	ErrDatabagNotFound     = errors.New("databag not found")
	ErrDatabagItemNotFound = errors.New("databag item not found")
)
View Source
var ErrEnvironmentNotFound = errors.New("environment not found")
View Source
var ErrPathNotFound = errors.New("attribute not found at path")
View Source
var ErrRoleNotFound = errors.New("role not found")

Functions

func ReverseSlice

func ReverseSlice[T comparable](s []T)

Types

type Cookbook

type Cookbook struct {
	chef.Cookbook
}

func (Cookbook) GetFile

func (s Cookbook) GetFile(ctx context.Context, client *http.Client, path string) (string, error)

func (Cookbook) GetReadme

func (s Cookbook) GetReadme(ctx context.Context, client *http.Client) (string, error)

type CookbookListItem

type CookbookListItem struct {
	Name         string   `json:"name"`
	Versions     []string `json:"versions"`
	Dependencies []string `json:"dependencies,omitempty"`
}

type CookbookListResult

type CookbookListResult struct {
	Cookbooks []CookbookListItem `json:"cookbooks"`
}

type CookbookMeta

type CookbookMeta struct {
	chef.CookbookMeta
}

type CookbookVersion

type CookbookVersion struct {
	Version string
}

type Interface

type Interface interface {
	GetCookbook(ctx context.Context) (Cookbook, error)
	GetCookbooks(ctx context.Context) ([]Cookbook, error)
}

type Node

type Node struct {
	chef.Node
	MergedAttributes map[string]interface{}
}

func (Node) GetEffectiveAttributeValue

func (s Node) GetEffectiveAttributeValue(paths ...string) (interface{}, error)

GetEffectiveAttributeValue returns the effective attribute value of a given path considering attribute precedence.

func (Node) MergeAttributes

func (s Node) MergeAttributes() map[string]interface{}

MergeAttributes returns the merged set of all node attributes taking attribute precedence into consideration. Ref: https://docs.chef.io/attribute_precedence/

type NodeList

type NodeList struct {
	Nodes []string `json:"nodes"`
}

type PolicyGroup

type PolicyGroup struct {
	chef.PolicyGroup
}

type Role

type Role struct {
	*chef.Role
}

type RoleList

type RoleList struct {
	Roles []string `json:"roles"`
}

type Service

type Service struct {
	Interface
	// contains filtered or unexported fields
}

func New

func New(config *config.Config, logger *logging.Logger) *Service

func (Service) GetClient

func (s Service) GetClient() *chef.Client

func (Service) GetCookbook

func (s Service) GetCookbook(ctx context.Context, name string) (*Cookbook, error)

GetCookbook should get the latest version of the cookbook

func (Service) GetCookbookVersion

func (s Service) GetCookbookVersion(ctx context.Context, name string, version string) (*Cookbook, error)

func (Service) GetCookbooks

func (s Service) GetCookbooks(ctx context.Context) (*CookbookListResult, error)

func (Service) GetDatabagItemContent

func (s Service) GetDatabagItemContent(ctx context.Context, databag string, item string) (chef.DataBagItem, error)

func (Service) GetDatabagItems

func (s Service) GetDatabagItems(ctx context.Context, name string) (*chef.DataBagListResult, error)

func (Service) GetDatabags

func (s Service) GetDatabags(ctx context.Context) (interface{}, error)

func (Service) GetEnvironment

func (s Service) GetEnvironment(ctx context.Context, name string) (*chef.Environment, error)

func (Service) GetEnvironments

func (s Service) GetEnvironments(ctx context.Context) (interface{}, error)

func (Service) GetGroup

func (s Service) GetGroup(ctx context.Context, name string) (chef.Group, error)

func (Service) GetGroups

func (s Service) GetGroups(ctx context.Context) (interface{}, error)

func (Service) GetLatestCookbooks

func (s Service) GetLatestCookbooks(ctx context.Context) (*CookbookListResult, error)

func (Service) GetNode

func (s Service) GetNode(ctx context.Context, name string) (*Node, error)

func (Service) GetNodes

func (s Service) GetNodes(ctx context.Context) (*NodeList, error)

func (Service) GetPolicies

func (s Service) GetPolicies(ctx context.Context) (chef.PoliciesGetResponse, error)

func (Service) GetPolicy

func (s Service) GetPolicy(ctx context.Context, name string) (chef.PolicyGetResponse, error)

func (Service) GetPolicyGroup

func (s Service) GetPolicyGroup(ctx context.Context, name string) (PolicyGroup, error)

func (Service) GetPolicyGroups

func (s Service) GetPolicyGroups(ctx context.Context) (chef.PolicyGroupGetResponse, error)

func (Service) GetPolicyRevision

func (s Service) GetPolicyRevision(ctx context.Context, name string, revision string) (chef.RevisionDetailsResponse, error)

func (Service) GetRole

func (s Service) GetRole(ctx context.Context, name string) (*Role, error)

GetRole will return a single named role

func (Service) GetRoles

func (s Service) GetRoles(ctx context.Context) (*RoleList, error)

GetRoles will return a list of all roles found on the server

func (Service) SearchNodes

func (s Service) SearchNodes(ctx context.Context, q string) (*NodeList, error)

Jump to

Keyboard shortcuts

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