// serviceName generates a valid service name for k8s labels
14769
func serviceName(name string) string {
	aname := make([]byte, len(name))

	for i, r := range []byte(name) {
		if !labelRe.Match([]byte{r}) {
			aname[i] = '_'
			continue
		}
		aname[i] = r
	}

	return string(aname)
}
204102
func ToName(serviceName string, methodName string) string {
	return fmt.Sprintf("%s::%s", serviceName, methodName)
}
387401
func CNAME(b ServiceBackend, zone string, state request.Request, opt Options) (records []dns.RR, err error) {
	services, err := b.Services(state, true, opt)
	if err != nil {
		return nil, err
	}

	if len(services) > 0 {
		serv := services[0]
		if ip := net.ParseIP(serv.Host); ip == nil {
			records = append(records, serv.NewCNAME(state.QName(), serv.Host))
		}
	}
	return records, nil
}
214166
func ValidateServiceName(name string, prefix bool) (bool, string) {
	return NameIsDNS952Label(name, prefix)
}
1283954
func GetServiceListByLabel(namespace string, key string, value string) (*v1.ServiceList, error) {
	client, err := K8s.GetCoreClient()
	if err != nil {
		return &v1.ServiceList{}, &util.RetriableError{Err: err}
	}
	services := client.Services(namespace)
	if err != nil {
		return &v1.ServiceList{}, &util.RetriableError{Err: err}
	}
	return getServiceListFromServicesByLabel(services, key, value)
}
477442
func (s service) filename(dir string) string {
	return filepath.Join(dir, s.FilenameNoExt) + ".py"
}
426089
func parseServiceName(name string) (string, string) {
	s := strings.Split(name, ".")
	var sName, nName string
	if len(s) > 1 {
		nName = s[len(s)-1]
		sName = strings.Join(s[:len(s)-1], ".")
	} else {
		sName = s[0]
	}
	return sName, nName
}
1044373
func (v *Service) GetName() (o string) {
	if v != nil {
		o = v.Name
	}
	return
}
1256109
func (conn *Conn) RequestName(name string, flags RequestNameFlags) (RequestNameReply, error) {
	var r uint32
	err := conn.busObj.Call("org.freedesktop.DBus.RequestName", 0, name, flags).Store(&r)
	if err != nil {
		return 0, err
	}
	return RequestNameReply(r), nil
}
305394
func (s *VPCEConfiguration) SetServiceDnsName(v string) *VPCEConfiguration {
	s.ServiceDnsName = &v
	return s
}
753062
func BaseName(s string) string {

	// Replace certain joining characters with a dash
	baseName := baseNameSeparators.ReplaceAllString(s, "-")

	// Remove illegal characters for names, replacing some common separators with -
	baseName = cleanString(baseName, illegalName)

	// NB this may be of length 0, caller must check
	return baseName
}
305809
func (s *HttpInstanceSummary) SetServiceName(v string) *HttpInstanceSummary {
	s.ServiceName = &v
	return s
}
1123068
func (s *ServiceRecord) ServiceName() string {
	if s.serviceName == "" {
		s.serviceName = fmt.Sprintf("%s.%s.", trimDot(s.Service), trimDot(s.Domain))
	}
	return s.serviceName
}
1213543
func (l *State) serviceToken(id string) string {
	var token string
	if s := l.services[id]; s != nil {
		token = s.Token
	}
	if token == "" {
		token = l.tokens.UserToken()
	}
	return token
}
492047
func ServiceWithName(name string) ServiceSpecOpt {
	return func(spec *swarmtypes.ServiceSpec) {
		spec.Annotations.Name = name
	}
}
482582
func (s *ServiceSpecificCredential) SetServiceUserName(v string) *ServiceSpecificCredential {
	s.ServiceUserName = &v
	return s
}
682804
func (m *MenuEntry) KeyName() string {
	if m.Identifier != "" {
		return m.Identifier
	}
	return m.Name
}