// validDogfileName checks if a Dogfile name is valid as defined
// by the Dogfile Spec.
540790
func validDogfileName(name string) bool {
	var match bool
	match, err := regexp.MatchString("^(dog|🐕).*\\.(yml|yaml)$", name)
	if err != nil {
		return false
	}
	return match
}
461517
func IsValidPathSegmentName(name string) []string {
	for _, illegalName := range NameMayNotBe {
		if name == illegalName {
			return []string{fmt.Sprintf(`may not be '%s'`, illegalName)}
		}
	}

	var errors []string
	for _, illegalContent := range NameMayNotContain {
		if strings.Contains(name, illegalContent) {
			errors = append(errors, fmt.Sprintf(`may not contain '%s'`, illegalContent))
		}
	}

	return errors
}
923447
func (c *downloadCommand) ResolveFilename() string {
	filename := c.Filename
	if filename == "" {
		filename = backups.FilenamePrefix + c.ID + ".tar.gz"
	}
	return filename
}
1217269
func (l *LanguageOpts) MangleFileName(name string) string {
	if l.fileNameFunc != nil {
		return l.fileNameFunc(name)
	}
	return swag.ToFileName(name)
}
92769
func isValidWorkflowFieldName(name string) []string {
	var errs []string
	if len(name) > workflowFieldMaxLength {
		errs = append(errs, apivalidation.MaxLenError(workflowFieldMaxLength))
	}
	if !workflowFieldNameRegexp.MatchString(name) {
		msg := workflowFieldNameErrMsg + " (e.g. My-name1-2, 123-NAME)"
		errs = append(errs, msg)
	}
	return errs
}
888531
func CheckValidObjectName(objectName string) error {
	if strings.TrimSpace(objectName) == "" {
		return errors.New("Object name cannot be empty")
	}
	return CheckValidObjectNamePrefix(objectName)
}
776420
func ValidateName(name string) error {
	length := len(name)
	if length == 0 {
		return errors.New("unit name cannot be empty")
	}
	if length > unitNameMax {
		return fmt.Errorf("unit name exceeds maximum length (%d)", unitNameMax)
	}
	dot := strings.LastIndex(name, ".")
	if dot == -1 {
		return errors.New(`unit name must contain "."`)
	}
	if dot == length-1 {
		return errors.New(`unit name cannot end in "."`)
	}
	suffix := name[dot+1:]
	if !validUnitTypes.Contains(suffix) {
		return fmt.Errorf("invalid unit type: %q", suffix)
	}
	if strings.Contains(name, "@") && !validTemplateTypes.Contains(suffix) {
		return fmt.Errorf("invalid unit type for template: %q", suffix)
	}
	for _, char := range name[:dot] {
		if !strings.ContainsRune(validChars, char) {
			return fmt.Errorf("invalid character %q in unit name", char)
		}
	}
	if strings.HasPrefix(name, "@") {
		return errors.New(`unit name cannot start in "@"`)
	}
	return nil
}
778358
func validateNodeName(nodeName string, fldPath *field.Path) field.ErrorList {
	allErrs := field.ErrorList{}
	for _, msg := range apivalidation.ValidateNodeName(nodeName, false /* prefix */) {
		allErrs = append(allErrs, field.Invalid(fldPath, nodeName, msg))
	}
	return allErrs
}
1068510
func ParseFilename(name string) (level, id int) {
	a := fileIDRegex.FindStringSubmatch(filepath.Base(name))
	if a == nil {
		return 0, 0
	}

	level, _ = strconv.Atoi(a[1])
	id, _ = strconv.Atoi(a[2])
	return id, level
}
304960
func isValidServiceIdentityName(name string) bool {
	if len(name) < 1 || len(name) > serviceIdentityNameMaxLength {
		return false
	}
	return validServiceIdentityName.MatchString(name)
}
637706
func goldenFileName(name string) string {
	return filepath.Join(FixtureDir, fmt.Sprintf("%s%s", name, FileNameSuffix))
}
561112
func (m *DogStatsdSink) Validate() error {
	if m == nil {
		return nil
	}

	// no validation rules for Prefix

	switch m.DogStatsdSpecifier.(type) {

	case *DogStatsdSink_Address:

		{
			tmp := m.GetAddress()

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return DogStatsdSinkValidationError{
						field:  "Address",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	default:
		return DogStatsdSinkValidationError{
			field:  "DogStatsdSpecifier",
			reason: "value is required",
		}

	}

	return nil
}
1366054
func (c *ConfigFile) Filename() string {
	rw, err := NewConfigReadWriter(c.version)
	if err != nil {
		return ""
	}
	return rw.Filename(c)
}
299410
func ErrInvalidBucketName(message string) error {
	return ErrorResponse{
		StatusCode: http.StatusBadRequest,
		Code:       "InvalidBucketName",
		Message:    message,
		RequestID:  "minio",
	}
}
935075
func validateRuntimeClassName(actual *string, validNames []string) field.ErrorList {
	if actual == nil {
		return nil // An unset RuntimeClassName is always allowed.
	}

	for _, valid := range validNames {
		if valid == policy.AllowAllRuntimeClassNames {
			return nil
		}
		if *actual == valid {
			return nil
		}
	}
	return field.ErrorList{field.Invalid(field.NewPath("spec", "runtimeClassName"), *actual, "")}
}
806945
func (c *CompileContext) SetFilename(f string) {
	c.filename = f
	c.ctx.filename = C.CString(c.filename)
}
296906
func (p *windowsParser) ValidateVolumeName(name string) error {
	nameExp := regexp.MustCompile(`^` + rxName + `$`)
	if !nameExp.MatchString(name) {
		return errors.New("invalid volume name")
	}
	nameExp = regexp.MustCompile(`^` + rxReservedNames + `$`)
	if nameExp.MatchString(name) {
		return fmt.Errorf("volume name %q cannot be a reserved word for Windows filenames", name)
	}
	return nil
}