// MakeSimpleName strips any non-alphanumeric characters out of a string and returns
// either an empty string or a string which is valid for most Kubernetes resources.
164468
func MakeSimpleName(name string) string {
	name = strings.ToLower(name)
	name = invalidServiceChars.ReplaceAllString(name, "")
	name = strings.TrimFunc(name, func(r rune) bool { return r == '-' })
	if len(name) > kuval.DNS1035LabelMaxLength {
		name = name[:kuval.DNS1035LabelMaxLength]
	}
	return name
}
13741
func (s *ListTablesInput) SetExclusiveStartTableName(v string) *ListTablesInput {
	s.ExclusiveStartTableName = &v
	return s
}
1251884
func makeNetInterfaceName(base string) string {
	for {
		name := base + randomString(6)
		if _, err := net.InterfaceByName(name); err == nil {
			continue
		}

		return name
	}
}
723894
func (s *Service) ValidateName(name string) error {
	// Ensure the service name is valid per RFC-952 §1
	// (https://tools.ietf.org/html/rfc952), RFC-1123 §2.1
	// (https://tools.ietf.org/html/rfc1123), and RFC-2782
	// (https://tools.ietf.org/html/rfc2782).
	re := regexp.MustCompile(`^(?i:[a-z0-9]|[a-z0-9][a-z0-9\-]{0,61}[a-z0-9])$`)
	if !re.MatchString(name) {
		return fmt.Errorf("service name must be valid per RFC 1123 and can contain only alphanumeric characters or dashes and must be no longer than 63 characters: %q", name)
	}
	return nil
}
438505
func FuncFullPath(i interface{}) (pkgName string, objName string, funcName string) {
	return ParseFuncName(FuncName(i))
}
483148
func SafeObjectName(name string, clusterName string) string {
	gceName := name + "-" + clusterName

	// TODO: If the cluster name > some max size (32?) we should curtail it
	return SafeClusterName(gceName)
}
1282407
func (DefaultForeignKeyNamer) BuildKeyName(kind, tableName string, fields ...string) string {
	keyName := fmt.Sprintf("%s_%s_%s", kind, tableName, strings.Join(fields, "_"))
	keyName = keyNameRegex.ReplaceAllString(keyName, "_")
	return keyName
}
121433
func formatProcName(fullURI string) string {
	// remove leading `/`
	fullURI = fullURI[1:]

	// When meet `/{`
	// - replace it with `By`
	// - make uppercase the first char after `/{`
	spl := strings.Split(fullURI, "/{")
	tmp := []string{}
	for i, v := range spl {
		if i != 0 {
			v = strings.Title(v)
		}
		tmp = append(tmp, v)
	}
	name := strings.Join(tmp, "By")

	// when meet `/`
	// - make uppercase the first char after `/`
	// - remove the `/`
	spl = strings.Split(name, "/")
	tmp = []string{}
	for i, v := range spl {
		if i != 0 {
			v = strings.Title(v)
		}
		tmp = append(tmp, v)
	}

	return strings.Join(tmp, "")
}
1241647
func (d *driver) getFullName(name string) string {
	if d.tag() != "" {
		return d.tag() + fittedcloud.TagDelimiter + name
	}
	return name
}
1008267
func SigFromName(n string) os.Signal {
	n = strings.ToUpper(n)
	if strings.HasPrefix(n, "SIG") {
		n = n[3:] // remove SIG prefix
	}

	if sig, ok := niceNameToSigs[n]; ok {
		return sig
	}
	return nil
}
1215475
func ToJSONName(name string) string {
	in := split(name)
	out := make([]string, 0, len(in))

	for i, w := range in {
		if i == 0 {
			out = append(out, lower(w))
			continue
		}
		out = append(out, Camelize(w))
	}
	return strings.Join(out, "")
}
891397
func composeFullName(firstname, surname, username string) string {
	switch {
	case len(firstname) == 0 && len(surname) == 0:
		return username
	case len(firstname) == 0:
		return surname
	case len(surname) == 0:
		return firstname
	default:
		return firstname + " " + surname
	}
}
1101807
func (b *BaseBuilder) QuoteSimpleColumnName(s string) string {
	if strings.Contains(s, `"`) || s == "*" {
		return s
	}
	return `"` + s + `"`
}
612741
func nsToTaskName(v string) string {
	// Escape single underscores in the namespace name.
	v = strings.Replace(v, "_", "__", -1)

	// Replace any invalid task queue name characters with underscore.
	return strings.Map(func(r rune) rune {
		switch {
		case (r >= 'a' && r <= 'z'),
			(r >= 'A' && r <= 'Z'),
			r == '_', r == '-':
			return r
		default:
			return '_'
		}
	}, v)
}
966203
func (b *SqliteBuilder) QuoteSimpleTableName(s string) string {
	if strings.ContainsAny(s, "`") {
		return s
	}
	return "`" + s + "`"
}
214293
func validateSimpleKeys(simpleKeys ...string) error {
	for _, key := range simpleKeys {
		if len(key) > 0 && key[0] == compositeKeyNamespace[0] {
			return errors.Errorf(`first character of the key [%s] contains a null character which is not allowed`, key)
		}
	}
	return nil
}
165039
func (s *Shape) EnumName(n int) string {
	enum := s.Enum[n]
	enum = enumStrip.ReplaceAllLiteralString(enum, "")
	enum = enumCamelCase.ReplaceAllString(enum, "$1-$2")
	parts := enumDelims.Split(enum, -1)
	for i, v := range parts {
		v = strings.ToLower(v)
		parts[i] = ""
		if len(v) > 0 {
			parts[i] = strings.ToUpper(v[0:1])
		}
		if len(v) > 1 {
			parts[i] += v[1:]
		}
	}
	enum = strings.Join(parts, "")
	enum = strings.ToUpper(enum[0:1]) + enum[1:]
	return enum
}