databag

package
v0.10.0-pre6 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2015 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package databag provides a convenient way to store arbitrary data on the server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetList

func GetList() []string

GetList returns a list of data bags on the server.

func RawDataBagJSON

func RawDataBagJSON(data io.ReadCloser) map[string]interface{}

RawDataBagJSON extract the data bag item's raw data from the request, saving it to the server.

Types

type DataBag

type DataBag struct {
	Name         string
	DataBagItems map[string]*DataBagItem
	// contains filtered or unexported fields
}

DataBag is the overall data bag.

func AllDataBags

func AllDataBags() []*DataBag

AllDataBags returns all data bags on this server, and all their items.

func Get

func Get(dbName string) (*DataBag, util.Gerror)

Get a data bag.

func New

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

New creates an empty data bag, and kicks off adding it to the index.

func (*DataBag) AllDBItems

func (db *DataBag) AllDBItems() (map[string]*DataBagItem, error)

AllDBItems returns a map of all the items in a data bag.

func (*DataBag) Delete

func (db *DataBag) Delete() error

Delete a data bag.

func (*DataBag) DeleteDBItem

func (db *DataBag) DeleteDBItem(dbItemName string) error

DeleteDBItem deletes a data bag item.

func (*DataBag) GetDBItem

func (db *DataBag) GetDBItem(dbItemName string) (*DataBagItem, error)

GetDBItem gets a data bag item.

func (*DataBag) GetMultiDBItems added in v0.10.0

func (db *DataBag) GetMultiDBItems(dbItemNames []string) ([]*DataBagItem, util.Gerror)

GetMultiDBItems gets multiple data bag items from a slice of names.

func (*DataBag) GetName

func (db *DataBag) GetName() string

GetName returns the data bag's name.

func (*DataBag) ListDBItems

func (db *DataBag) ListDBItems() []string

ListDBItems returns a list of items in a data bag.

func (*DataBag) NewDBItem

func (db *DataBag) NewDBItem(rawDbagItem map[string]interface{}) (*DataBagItem, util.Gerror)

NewDBItem creates a new data bag item in the associated data bag.

func (*DataBag) NumDBItems

func (db *DataBag) NumDBItems() int

NumDBItems returns the number of items in a data bag.

func (*DataBag) Save

func (db *DataBag) Save() error

Save a data bag.

func (*DataBag) URLType

func (db *DataBag) URLType() string

URLType returns the base element of a data bag's URL.

func (*DataBag) UpdateDBItem

func (db *DataBag) UpdateDBItem(dbiID string, rawDbagItem map[string]interface{}) (*DataBagItem, error)

UpdateDBItem updates a data bag item in this data bag.

type DataBagItem

type DataBagItem struct {
	Name        string                 `json:"name"`
	ChefType    string                 `json:"chef_type"`
	JSONClass   string                 `json:"json_class"`
	DataBagName string                 `json:"data_bag"`
	RawData     map[string]interface{} `json:"raw_data"`
	// contains filtered or unexported fields
}

DataBagItem is an individual item within a data bag.

func (*DataBagItem) DocID

func (dbi *DataBagItem) DocID() string

DocID returns the id of the data bag item for the indexer.

func (*DataBagItem) Flatten

func (dbi *DataBagItem) Flatten() map[string]interface{}

Flatten a data bag item out so it's suitable for indexing.

func (*DataBagItem) GetName

func (dbi *DataBagItem) GetName() string

GetName returns the data bag item's identifier.

func (*DataBagItem) Index

func (dbi *DataBagItem) Index() string

Index returns the name of the data bag this data bag item belongs to, so it's placed in the correct index.

func (*DataBagItem) URLType

func (dbi *DataBagItem) URLType() string

URLType returns the base element of a data bag's URL.

Jump to

Keyboard shortcuts

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