// bindAdditionalMetadata binds and validates parameter AdditionalMetadata from formData.
330480
func (o *PetUploadImageParams) bindAdditionalMetadata(rawData []string, hasKey bool, formats strfmt.Registry) error {
	var raw string
	if len(rawData) > 0 {
		raw = rawData[len(rawData)-1]
	}

	// Required: false

	if raw == "" { // empty values pass all other validations
		return nil
	}

	o.AdditionalMetadata = &raw

	return nil
}
861108
func (s *RedisAnnouncementStore) AddMetadata(serviceName, serviceID string, metadata ...Metadata) error {
	key := fmt.Sprintf("%s:%s", serviceName, serviceID)

	metadataStrings := make([]string, 0, len(metadata))
	for _, meta := range metadata {
		txt, err := meta.MarshalText()
		if err != nil {
			return err
		}
		metadataStrings = append(metadataStrings, string(txt))

		switch meta := meta.(type) {
		case AppIDMetadata:
			existing, err := s.byAppID.Get(meta.AppID)
			switch {
			case errors.GetErrType(err) == errors.NotFound:
				if err := s.byAppID.Create(meta.AppID, key); err != nil {
					return err
				}
			case err != nil:
				return err
			case existing == key:
				continue
			default:
				go s.metadata.Remove(existing, string(txt))
				if err := s.byAppID.Update(meta.AppID, key); err != nil {
					return err
				}
			}
		case GatewayIDMetadata:
			existing, err := s.byGatewayID.Get(meta.GatewayID)
			switch {
			case errors.GetErrType(err) == errors.NotFound:
				if err := s.byGatewayID.Create(meta.GatewayID, key); err != nil {
					return err
				}
			case err != nil:
				return err
			case existing == key:
				continue
			default:
				go s.metadata.Remove(existing, string(txt))
				if err := s.byGatewayID.Update(meta.GatewayID, key); err != nil {
					return err
				}
			}
		case AppEUIMetadata:
			existing, err := s.byAppEUI.Get(meta.AppEUI.String())
			switch {
			case errors.GetErrType(err) == errors.NotFound:
				if err := s.byAppEUI.Create(meta.AppEUI.String(), key); err != nil {
					return err
				}
			case err != nil:
				return err
			case existing == key:
				continue
			default:
				go s.metadata.Remove(existing, string(txt))
				if err := s.byAppEUI.Update(meta.AppEUI.String(), key); err != nil {
					return err
				}
			}
		}
	}
	err := s.metadata.Add(key, metadataStrings...)
	if err != nil {
		return err
	}
	return nil
}
598223
func (s *InitiateDocumentVersionUploadOutput) SetUploadMetadata(v *UploadMetadata) *InitiateDocumentVersionUploadOutput {
	s.UploadMetadata = v
	return s
}
527268
func (o *FindParams) bindTags(rawData []string, hasKey bool, formats strfmt.Registry) error {
	if !hasKey {
		return errors.Required("tags", "formData")
	}

	// CollectionFormat: multi
	tagsIC := rawData

	if len(tagsIC) == 0 {
		return nil
	}

	var tagsIR []int32
	for i, tagsIV := range tagsIC {
		// items.Format: "int32"
		tagsI, err := swag.ConvertInt32(tagsIV)
		if err != nil {
			return errors.InvalidType(fmt.Sprintf("%s.%v", "tags", i), "formData", "int32", tagsI)
		}

		tagsIR = append(tagsIR, tagsI)
	}

	o.Tags = tagsIR

	return nil
}
700289
func (o *FindParams) bindXRateLimit(rawData []string, hasKey bool, formats strfmt.Registry) error {
	if !hasKey {
		return errors.Required("X-Rate-Limit", "header")
	}
	var raw string
	if len(rawData) > 0 {
		raw = rawData[len(rawData)-1]
	}

	// Required: true

	if err := validate.RequiredString("X-Rate-Limit", "header", raw); err != nil {
		return err
	}

	value, err := swag.ConvertInt32(raw)
	if err != nil {
		return errors.InvalidType("X-Rate-Limit", "header", "int32", raw)
	}
	o.XRateLimit = value

	return nil
}
1363247
func NewBinDataAsset(assetName, targetDir, targetName, permissions string, isTemplate bool) *BinDataAsset {
	m := &BinDataAsset{
		BaseAsset: BaseAsset{
			AssetName:   assetName,
			TargetDir:   targetDir,
			TargetName:  targetName,
			Permissions: permissions,
		},
		template: nil,
	}
	m.loadData(isTemplate)
	return m
}
404305
func (s *Segment) AddBoolMetadata(key string, value bool) {
	s.addMetadata(key, value)
}
554046
func (h *BindHandle) appendBindMeta(hash string, meta *BindMeta) {
	newCache := h.bindInfo.Value.Load().(cache).copy()
	newCache.removeStaleBindMetas(hash, meta)
	newCache[hash] = append(newCache[hash], meta)
	h.bindInfo.Value.Store(newCache)
}
561670
func (b *binder) Bind(ctx Context, i interface{}) (err error) {
	if ctx.Request().Method == http.MethodGet {
		err = b.unmarshal(ctx, i)
		return
	}

	if ctx.Request().ContentLength == 0 {
		return errors.New("request body is empty")
	}

	ct := ctx.ContentType()
	switch {
	case strings.HasPrefix(ct, "application/x-www-form-urlencoded"):
		return b.unmarshal(ctx, i)
	case strings.HasPrefix(ct, "multipart/form-data"):
		return b.unmarshal(ctx, i)
	case strings.HasPrefix(ct, "application/json"):
		return json.NewDecoder(ctx.Request().Body).Decode(i)
	case strings.HasPrefix(ct, "application/xml"):
		return xml.NewDecoder(ctx.Request().Body).Decode(i)
	default:
		return errors.New("unsupported content type")
	}
}
106276
func (s *Segment) AddMetadata(key string, value string) {
	s.addMetadata(key, value)
}
439987
func (woc *wfOperationCtx) addMetadata(pod *apiv1.Pod, tmpl *wfv1.Template) {
	for k, v := range tmpl.Metadata.Annotations {
		pod.ObjectMeta.Annotations[k] = v
	}
	for k, v := range tmpl.Metadata.Labels {
		pod.ObjectMeta.Labels[k] = v
	}
	if woc.workflowDeadline != nil {
		execCtl := common.ExecutionControl{
			Deadline: woc.workflowDeadline,
		}
		execCtlBytes, err := json.Marshal(execCtl)
		if err != nil {
			panic(err)
		}
		pod.ObjectMeta.Annotations[common.AnnotationKeyExecutionControl] = string(execCtlBytes)
	}
}
850459
func (s *AssociationStatus) SetAdditionalInfo(v string) *AssociationStatus {
	s.AdditionalInfo = &v
	return s
}
1172486
func AttachRequestData(ctx context.Context, r *http.Request) context.Context {
	return context.WithValue(ctx, requestContextKey, r)
}
697862
func (s *RunJobFlowInput) SetAdditionalInfo(v string) *RunJobFlowInput {
	s.AdditionalInfo = &v
	return s
}
132121
func ValidateBindRequest(breq *api.BindRequest) field.ErrorList {
	var allErrs field.ErrorList

	for key := range breq.Parameters {
		if !templatevalidation.ParameterNameRegexp.MatchString(key) {
			allErrs = append(allErrs, field.Invalid(field.NewPath("parameters."+key), key, fmt.Sprintf("does not match %v", templatevalidation.ParameterNameRegexp)))
		}
	}

	return allErrs
}
570300
func (r *Registry) AddExternalHTTPRule(qualifiedMethodName string, rule *annotations.HttpRule) {
	r.externalHTTPRules[qualifiedMethodName] = append(r.externalHTTPRules[qualifiedMethodName], rule)
}
879707
func (a *AQL) Bind(name string, value interface{}) *AQL {
	if a.bindVars == nil {
		a.bindVars = make(map[string]interface{})
	}
	a.bindVars[name] = value
	return a
}