// UnmarshalJSON unmarshals JSON into a ConfigPolicy func (c *ConfigPolicy) UnmarshalJSON(data []byte) error { m := map[string]map[string]interface{}{} decoder := json.NewDecoder(bytes.NewReader(data)) if err := decoder.Decode(&m); err != nil { return err } c.config = ctree.New() if config, ok := m["config"]; ok { if node, ok := config["root"]; ok { if n, ok := node.(map[string]interface{}); ok { return unmarshalJSON(n, &[]string{}, c.config) } } } return nil }
// Returns a new ConfigDataTree. func NewTree() *ConfigDataTree { return &ConfigDataTree{ cTree: ctree.New(), } }
// Returns a new ConfigPolicy. func New() *ConfigPolicy { return &ConfigPolicy{ config: ctree.New(), } }