Documentation ¶
Overview ¶
Package databag provides a convenient way to store arbitrary data on the server.
Index ¶
- func DoesExist(dbName string) (bool, util.Gerror)
- func GetList() []string
- func RawDataBagJSON(data io.ReadCloser) map[string]interface{}
- type DataBag
- func (db *DataBag) AllDBItems() (map[string]*DataBagItem, error)
- func (db *DataBag) Delete() error
- func (db *DataBag) DeleteDBItem(dbItemName string) error
- func (db *DataBag) DoesItemExist(dbItemName string) (bool, util.Gerror)
- func (db *DataBag) GetDBItem(dbItemName string) (*DataBagItem, error)
- func (db *DataBag) GetMultiDBItems(dbItemNames []string) ([]*DataBagItem, util.Gerror)
- func (db *DataBag) GetName() string
- func (db *DataBag) ListDBItems() []string
- func (db *DataBag) NewDBItem(rawDbagItem map[string]interface{}) (*DataBagItem, util.Gerror)
- func (db *DataBag) NumDBItems() int
- func (db *DataBag) Save() error
- func (db *DataBag) URLType() string
- func (db *DataBag) UpdateDBItem(dbiID string, rawDbagItem map[string]interface{}) (*DataBagItem, error)
- type DataBagItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 (*DataBag) AllDBItems ¶
func (db *DataBag) AllDBItems() (map[string]*DataBagItem, error)
AllDBItems returns a map of all the items in a data bag.
func (*DataBag) DeleteDBItem ¶
DeleteDBItem deletes a data bag item.
func (*DataBag) DoesItemExist ¶ added in v0.11.4
DoesItemExist checks if the data bag item exists without returning the entire data bag and all items.
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) ListDBItems ¶
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 ¶
NumDBItems returns the number of items in a data bag.
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.