// normalizedKey returns "normalized" key representation:
//  scheme and host names are lowered, everything else stays the same
193108
func normalizedKey(key string) string {
	addr, err := standardizeAddress(key)
	if err != nil {
		return key
	}
	return addr.Normalize().Key()
}
1028974
func (c *Config) AuthorizedKeys() string {
	value, _ := c.defined[AuthorizedKeysKey].(string)
	return value
}
828424
func normalizeURL(dest string) (string, error) {
	u, err := url.Parse(dest)
	if err != nil {
		return "", err
	}
	// Note: '//host/path' is a location on a server named 'host'.
	if u.IsAbs() || !strings.HasPrefix(u.Path, "/") || strings.HasPrefix(u.Path, "//") {
		return "", errBadDestinationURL
	}
	// path.Clean removes trailing slash. It matters for URLs though. Keep it.
	keepSlash := strings.HasSuffix(u.Path, "/")
	u.Path = path.Clean(u.Path)
	if !strings.HasSuffix(u.Path, "/") && keepSlash {
		u.Path += "/"
	}
	if !strings.HasPrefix(u.Path, "/") {
		return "", errBadDestinationURL
	}
	return u.String(), nil
}
776748
func (s *InputDecryptionSettings) SetEncryptedDecryptionKey(v string) *InputDecryptionSettings {
	s.EncryptedDecryptionKey = &v
	return s
}
535382
func (a *ActivateExecutionReq) Normalize() error {
	if err := a.Auth.Normalize(); err != nil {
		return err
	}
	if len(a.ExecutionToken) < MinimumActivationTokenLength {
		return fmt.Errorf("insufficiently long ExecutionToken: %d",
			len(a.ExecutionToken))
	}
	return nil
}
884175
func normalizeOdbcKey(s string) string {
	return strings.ToLower(strings.TrimRightFunc(s, unicode.IsSpace))
}
315877
func (h *FriendlyHost) Normalized() string {
	host, err := svchost.ForComparison(h.Raw)
	if err != nil {
		return InvalidHostString
	}
	return string(host)
}
99947
func normalize(name string) (string, error) {
	host, remoteName := splitHostname(name)
	if strings.ToLower(remoteName) != remoteName {
		return "", errors.New("invalid reference format: repository name must be lowercase")
	}
	if host == DefaultHostname {
		if strings.HasPrefix(remoteName, DefaultRepoPrefix) {
			return strings.TrimPrefix(remoteName, DefaultRepoPrefix), nil
		}
		return remoteName, nil
	}
	return name, nil
}
1115788
func (i *Config_Isolate) Normalize() (err error) {
	if err = schemaHostURLValidate(i.Url); err != nil {
		return fmt.Errorf("config.isolate.host: %s", err)
	}
	return
}
290813
func normalizeDockerHubHost(host string, v2 bool) string {
	switch host {
	case reference.DockerDefaultRegistry, "www." + reference.DockerDefaultRegistry, reference.DockerDefaultV1Registry, reference.DockerDefaultV2Registry:
		if v2 {
			return reference.DockerDefaultV2Registry
		}
		return reference.DockerDefaultV1Registry
	}
	return host
}
681485
func (n *normalizer) Normalize(un *unstructured.Unstructured) error {
	matched := make([]normalizerPatch, 0)
	for _, patch := range n.patches {
		groupKind := un.GroupVersionKind().GroupKind()
		if groupKind == patch.groupKind &&
			(patch.name == "" || patch.name == un.GetName()) &&
			(patch.namespace == "" || patch.namespace == un.GetNamespace()) {

			matched = append(matched, patch)
		}
	}
	if len(matched) == 0 {
		return nil
	}

	docData, err := json.Marshal(un)
	if err != nil {
		return err
	}

	for _, patch := range matched {
		patchedData, err := patch.patch.Apply(docData)
		if err != nil {
			// bug?
			if strings.HasPrefix(err.Error(), "Unable to remove nonexistent key") {
				continue
			}
			return err
		}
		docData = patchedData
	}

	err = json.Unmarshal(docData, un)
	if err != nil {
		return err
	}
	return nil
}
27125
func DecodeRowKey(key string) (schema.MKey, int32, error) {
	parts := strings.SplitN(key, "_", 2)
	partition, err := strconv.Atoi(parts[0])
	if err != nil {
		return schema.MKey{}, 0, err
	}
	mkey, err := schema.MKeyFromString(parts[1])
	if err != nil {
		return schema.MKey{}, 0, err
	}
	return mkey, int32(partition), nil
}
398115
func (a Address) Normalize() Address {
	path := a.Path
	if !CaseSensitivePath {
		path = strings.ToLower(path)
	}

	// ensure host is normalized if it's an IP address
	host := a.Host
	if ip := net.ParseIP(host); ip != nil {
		host = ip.String()
	}

	return Address{
		Original: a.Original,
		Scheme:   strings.ToLower(a.Scheme),
		Host:     strings.ToLower(host),
		Port:     a.Port,
		Path:     path,
	}
}
1142368
func Normalize(platform specs.Platform) specs.Platform {
	platform.OS = normalizeOS(platform.OS)
	platform.Architecture, platform.Variant = normalizeArch(platform.Architecture, platform.Variant)

	// these fields are deprecated, remove them
	platform.OSFeatures = nil
	platform.OSVersion = ""

	return platform
}
316473
func normalize(key string) string {
	if key == "" {
		return ""
	}
	path := strings.Split(strings.Trim(key, "/"), "/")
	return "/" + strings.Join(path, "/")
}
860199
func (f *Facade) ResetHostKey(ctx datastore.Context, hostID string) ([]byte, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.ResetHostKey"))
	glog.V(2).Infof("Facade.ResetHostKey: id=%s", hostID)
	alog := f.auditLogger.Message(ctx, "Resetting Host Key").
		Action(audit.Update).ID(hostID).Type(host.GetType())

	var value host.Host
	if err := f.hostStore.Get(ctx, host.HostKey(hostID), &value); err != nil {
		return nil, alog.Error(err)
	}
	key, err := f.generateDelegateKey(ctx, &value)
	return key, alog.Error(err)
}
531121
func (v *Value_Array) Normalize() error {
	newAry, err := NormalizeJSON(v.Array, false)
	if err != nil {
		return err
	}
	v.Array = newAry
	return nil
}