// CheckAnnotations checks v.spec.Annotations
770855
func (v *Validator) CheckAnnotations() (errs error) {
	logrus.Debugf("check annotations")

	reversedDomain := regexp.MustCompile(`^[A-Za-z]{2,6}(\.[A-Za-z0-9-]{1,63})+$`)
	for key := range v.spec.Annotations {
		if strings.HasPrefix(key, "org.opencontainers") {
			errs = multierror.Append(errs,
				specerror.NewError(
					specerror.AnnotationsKeyReservedNS,
					fmt.Errorf("key %q is reserved", key),
					rspec.Version))
		}

		if !reversedDomain.MatchString(key) {
			errs = multierror.Append(errs,
				specerror.NewError(
					specerror.AnnotationsKeyReversedDomain,
					fmt.Errorf("key %q SHOULD be named using a reverse domain notation", key),
					rspec.Version))
		}
	}

	return
}
1013798
func (s *TraceSummary) SetAnnotations(v map[string][]*ValueWithServiceIds) *TraceSummary {
	s.Annotations = v
	return s
}
1173976
func NewAnnotations(annotations []Annotation, endpoint Endpoint) []trace.Annotation {
	formatted := make([]trace.Annotation, len(annotations))
	for i, annotation := range annotations {
		formatted[i] = trace.Annotation{
			Host:        endpoint.Host(),
			ServiceName: endpoint.Name(),
			Timestamp:   annotation.Timestamp(),
			Value:       annotation.Value(),
		}
	}

	return formatted
}
280890
func HandleAnnotations(mux *http.ServeMux, prefix string, handler AnnotationsHandler) {
	mux.Handle(path.Join("/", prefix, "annotations"), NewAnnotationsHandler(handler))
}
419014
func (v *Service) GetAnnotations() (o map[string]string) {
	if v != nil && v.Annotations != nil {
		return v.Annotations
	}

	return
}
902214
func ValidateTolerationsInPodAnnotations(annotations map[string]string, fldPath *field.Path) field.ErrorList {
	allErrs := field.ErrorList{}

	tolerations, err := helper.GetTolerationsFromPodAnnotations(annotations)
	if err != nil {
		allErrs = append(allErrs, field.Invalid(fldPath, core.TolerationsAnnotationKey, err.Error()))
		return allErrs
	}

	if len(tolerations) > 0 {
		allErrs = append(allErrs, ValidateTolerations(tolerations, fldPath.Child(core.TolerationsAnnotationKey))...)
	}

	return allErrs
}
1349673
func (c *CheckRunOutput) GetAnnotationsCount() int {
	if c == nil || c.AnnotationsCount == nil {
		return 0
	}
	return *c.AnnotationsCount
}
1362769
func Check(err error, checker func(error) bool) bool {
	if annotated, ok := err.(*annotatedError); ok {
		return checker(annotated.LastError())
	}
	return checker(err)
}
1253174
func (a AnnotationsMap) Validate(_ interface{}) error {
	countReserved := 0
	for key, value := range a {
		// Make sure the key is a valid key
		if err := AnnotationKey(key).Validate(nil); err != nil {
			return errors.Errorf("Key '%s' is not a valid annotation key", key)
		}
		// Make sure that, if the key is reserved, it is validated
		if strings.HasPrefix(key, AnnotationReservedKeyPrefix) {
			found := false
			for _, reservedKey := range AnnotationKnownReservedKeys {
				if reservedKey == key {
					found = true
				}
			}
			if !found {
				return errors.Errorf("Key '%s' is not an accepted reserved key", key)
			}
			countReserved++
		}

		// Make sure every value is a valid value
		for _, subvalue := range value {
			if err := AnnotationValue(subvalue).Validate(nil); err != nil {
				return errors.Errorf("Value '%s' is not a valid annotation value", subvalue)
			}
		}
	}

	// Finally, make sure we didn't overflow the mx number of reserved keys
	if countReserved > AnnotationMaxReservedKeys {
		return errors.New("Annotation has more than 20 annotation keys")
	}
	return nil
}
157784
func (o AnnotateOptions) Validate(args []string) error {
	if err := validateAnnotations(o.removeAnnotations, o.newAnnotations); err != nil {
		return err
	}

	// only apply resource version locking on a single resource
	if len(o.resources) > 1 && len(o.resourceVersion) > 0 {
		return fmt.Errorf("--resource-version may only be used with a single resource")
	}

	return nil
}
44434
func NewAnnotateOptions(ioStreams genericclioptions.IOStreams) *AnnotateOptions {
	return &AnnotateOptions{
		PrintFlags: genericclioptions.NewPrintFlags("annotated").WithTypeSetter(scheme.Scheme),

		RecordFlags: genericclioptions.NewRecordFlags(),
		Recorder:    genericclioptions.NoopRecorder{},
		IOStreams:   ioStreams,
	}
}
784162
func (g *Generator) ClearAnnotations() {
	if g.Config == nil {
		return
	}
	g.Config.Annotations = make(map[string]string)
}
1322173
func (v *Function) GetAnnotations() (o map[string]string) {
	if v != nil && v.Annotations != nil {
		return v.Annotations
	}

	return
}
37099
func (s *EntityRecognizerInputDataConfig) SetAnnotations(v *EntityRecognizerAnnotations) *EntityRecognizerInputDataConfig {
	s.Annotations = v
	return s
}
533
func WithAnnotations(annotations map[string]string) SpecOpts {
	return func(_ context.Context, _ Client, _ *containers.Container, s *Spec) error {
		if s.Annotations == nil {
			s.Annotations = make(map[string]string)
		}
		for k, v := range annotations {
			s.Annotations[k] = v
		}
		return nil
	}
}
1004675
func CheckPackages(c context.Context, names []string, includeHidden bool) ([]string, error) {
	if len(names) == 0 {
		return nil, nil
	}

	pkgs := make([]*Package, len(names))
	for i, n := range names {
		pkgs[i] = &Package{Name: n}
	}

	if err := datastore.Get(c, pkgs); err != nil {
		merr, ok := err.(errors.MultiError)
		if !ok {
			return nil, transient.Tag.Apply(err)
		}
		existing := pkgs[:0]
		for i, pkg := range pkgs {
			switch err := merr[i]; {
			case err == nil:
				existing = append(existing, pkg)
			case err != datastore.ErrNoSuchEntity:
				return nil, errors.Annotate(err, "failed to fetch %q", pkg.Name).Tag(transient.Tag).Err()
			}
		}
		pkgs = existing
	}

	out := make([]string, 0, len(pkgs))
	for _, p := range pkgs {
		if !p.Hidden || includeHidden {
			out = append(out, p.Name)
		}
	}
	return out, nil
}
584290
func (a *funcCompiler) checkLabels() {
	nerr := a.numError()
	for _, l := range a.labels {
		if !l.resolved.IsValid() {
			a.diagAt(l.used, "label %s not defined", l.name)
		}
	}
	if nerr != a.numError() {
		// Don't check scopes if we have unresolved labels
		return
	}

	// Executing the "goto" statement must not cause any variables
	// to come into scope that were not already in scope at the
	// point of the goto.
	a.flow.gotosObeyScopes(a.compiler)
}