// BindYAML is a shortcut for c.MustBindWith(obj, binding.YAML).
173773
func (c *Context) BindYAML(obj interface{}) error {
	return c.MustBindWith(obj, binding.YAML)
}
1363267
func normalizeBind(addr, bind string) (string, error) {
	if addr == "" {
		return bind, nil
	}
	return parseSingleIPTemplate(addr)
}
255877
func (c *Context) ShouldBindYAML(obj interface{}) error {
	return c.ShouldBindWith(obj, binding.YAML)
}
178212
func ToYAML(s string) (string, error) {
	m, err := Parse(s)
	if err != nil {
		return "", err
	}
	d, err := yaml.Marshal(m)
	return string(d), err
}
1121711
func (q *Queryx) BindStruct(arg interface{}) *Queryx {
	arglist, err := bindStructArgs(q.Names, arg, nil, q.Mapper)
	if err != nil {
		q.err = fmt.Errorf("bind error: %s", err)
	} else {
		q.err = nil
		q.Bind(arglist...)
	}

	return q
}
201987
func (tx *Tx) BindNamed(query string, arg interface{}) (string, []interface{}, error) {
	return bindNamedMapper(BindType(tx.driverName), query, arg, tx.Mapper)
}
311376
func ParseRawYaml(data []byte, dest interface{}) error {

	// Yaml can't parse empty strings
	configString := string(data)
	configString = strings.TrimSpace(configString)

	if configString != "" {
		err := utils.YamlUnmarshal([]byte(configString), dest)
		if err != nil {
			return fmt.Errorf("error parsing configuration: %v", err)
		}
	}

	return nil
}
199848
func BindStructWithConfig(obj interface{}, config Config) gin.HandlerFunc {
	return func(c *gin.Context) {
		inj, exist := apiutil.Get(c)
		if !exist {
			c.AbortWithError(http.StatusServiceUnavailable, ErrorInjectorNotFound.New(nil))
			return
		}

		bindStruct := reflect.New(reflect.TypeOf(obj))
		defer func() {
			inj.Map(bindStruct.Elem().Interface())
		}()

		req := c.Request

		if !config.DisableBindQuery {
			if err := bindQuery(bindStruct, req); err != nil {
				c.Error(err)
				return
			}
		}

		if !config.DisableBindParams {
			if err := bindParams(bindStruct, c.Params); err != nil {
				c.Error(err)
				return
			}
		}

		if err := c.Bind(bindStruct.Interface()); err != nil {
			c.Error(err)
			return
		}

		// contentType := req.Header.Get("Content-Type")
		// if contentType != "" {
		// 	if strings.Contains(contentType, "json") {
		// 		if err = bindJSONBody(bindStruct, req); err != nil {
		// 			return
		// 		}
		// 	} else if strings.Contains(contentType, "multipart/form-data") {
		// 		if err = bindMultipartForm(bindStruct, config, req); err != nil {
		// 			return
		// 		}
		// 	}
		// }
		//
		if !config.DisableTrimSpace {
			if err := trimstructspace.TrimStructSpace(bindStruct.Interface()); err != nil {
				c.Error(err)
				return
			}
		}

		if !config.DisableGoValidator {
			ok, err := govalidator.ValidateStruct(bindStruct.Interface())
			if err != nil {
				c.Error(err)
				return
			}
			if !ok {
				c.Error(errutil.New("invalid parameters"))
				return
			}
		}

		return
	}
}
266724
func (auth Auth) MarshalYAML() (interface{}, error) {
	if auth.Parameters() == nil {
		return auth.Type(), nil
	}
	return map[string]Parameters(auth), nil
}
331001
func marshalYaml(obj runtime.Object) ([]byte, error) {
	y, err := kopscodecs.ToVersionedYaml(obj)
	if err != nil {
		return nil, fmt.Errorf("error marshaling yaml: %v", err)
	}
	return y, nil
}
1145685
func ProcessYAML(input []byte, options *ProcessorOptions) ([]byte, error) {

	// Convert short form intrinsic functions (e.g. !Sub) to long form
	registerTagMarshallers()

	data, err := yamlwrapper.YAMLToJSON(input)
	if err != nil {
		return nil, fmt.Errorf("invalid YAML template: %s", err)
	}

	return ProcessJSON(data, options)

}
661177
func NewYaml(body []byte) (*Yaml, error) {
	var val interface{}
	err := yaml.Unmarshal(body, &val)
	if err != nil {
		return nil, errors.New("unmarshal []byte to yaml failed: " + err.Error())
	}
	return &Yaml{val}, nil
}
891747
func (b Build) MarshalYAML() (interface{}, error) {
	m := map[string]interface{}{}
	if b.Context != "" {
		m["context"] = b.Context
	}
	if b.Dockerfile != "" {
		m["dockerfile"] = b.Dockerfile
	}
	if len(b.Args) > 0 {
		m["args"] = b.Args
	}
	if len(b.CacheFrom) > 0 {
		m["cache_from"] = b.CacheFrom
	}
	if len(b.Labels) > 0 {
		m["labels"] = b.Labels
	}
	if b.Target != "" {
		m["target"] = b.Target
	}
	if b.Network != "" {
		m["network"] = b.Network
	}
	return m, nil
}
5097
func (ctx *context) YAML(v interface{}) (int, error) {
	out, err := yaml.Marshal(v)
	if err != nil {
		ctx.StatusCode(http.StatusInternalServerError)
		return 0, err
	}

	ctx.ContentType(ContentYAMLHeaderValue)
	return ctx.Write(out)
}
270177
func (n Networks) MarshalYAML() (interface{}, error) {
	m := map[string]*Network{}
	for _, network := range n.Networks {
		m[network.Name] = network
	}
	return m, nil
}
1154549
func (a *ACL) BindingRuleList(methodName string, q *QueryOptions) ([]*ACLBindingRule, *QueryMeta, error) {
	r := a.c.newRequest("GET", "/v1/acl/binding-rules")
	if methodName != "" {
		r.params.Set("authmethod", methodName)
	}
	r.setQueryOptions(q)
	rtt, resp, err := requireOK(a.c.doRequest(r))
	if err != nil {
		return nil, nil, err
	}
	defer resp.Body.Close()

	qm := &QueryMeta{}
	parseQueryMeta(resp, qm)
	qm.RequestTime = rtt

	var entries []*ACLBindingRule
	if err := decodeBody(resp, &entries); err != nil {
		return nil, nil, err
	}
	return entries, qm, nil
}
664631
func (c *Context) ShouldBindQuery(obj interface{}) error {
	return c.ShouldBindWith(obj, binding.Query)
}