// SuggestName returns a name derived from the source URL
341161
func (r *SourceRef) SuggestName() (string, bool) {
	if r == nil {
		return "", false
	}
	if len(r.Name) > 0 {
		return r.Name, true
	}
	return nameFromGitURL(r.URL)
}
641606
func CheckName(name string) (string, error) {
	// Validate given name.
	if !names.IsValidSpace(name) {
		return "", errors.Errorf("%q is not a valid space name", name)
	}
	return name, nil
}
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
}
1368708
func (s *CreateThreatIntelSetInput) SetName(v string) *CreateThreatIntelSetInput {
	s.Name = &v
	return s
}
37476
func (s *SearchService) Suggester(suggester Suggester) *SearchService {
	s.searchSource = s.searchSource.Suggester(suggester)
	return s
}
1298523
func OptionHostname(name string) SandboxOption {
	return func(sb *sandbox) {
		sb.config.hostName = name
	}
}
1103070
func RandomSuffixNamer(fw *firewall, prefix string, existingNames set.Strings) (string, error) {
	// For backwards compatibility, open rules for "0.0.0.0/0"
	// do not use any suffix in the name.
	if len(fw.SourceCIDRs) == 0 || len(fw.SourceCIDRs) == 1 && fw.SourceCIDRs[0] == "0.0.0.0/0" {
		return prefix, nil
	}
	data := make([]byte, 4)
	for i := 0; i < 10; i++ {
		_, err := rand.Read(data)
		if err != nil {
			return "", errors.Trace(err)
		}
		name := fmt.Sprintf("%s-%x", prefix, data)
		if !existingNames.Contains(name) {
			return name, nil
		}
	}
	return "", errors.New("couldn't pick unique name after 10 attempts")
}
675738
func baseName(name string) string {
	// First, find the last element
	if i := strings.LastIndex(name, "/"); i >= 0 {
		name = name[i+1:]
	}
	// Now drop the suffix
	if i := strings.LastIndex(name, "."); i >= 0 {
		name = name[0:i]
	}
	return name
}
428072
func (s *TrafficPolicySummary) SetName(v string) *TrafficPolicySummary {
	s.Name = &v
	return s
}
1108937
func (e *Validation) ValidateName(name string) *Validation {
	if e.Name == "" && name != "" {
		e.Name = name
		e.message = name + e.message
	}
	return e
}
1019203
func (s *GetIPSetOutput) SetName(v string) *GetIPSetOutput {
	s.Name = &v
	return s
}
4293
func (s *DeleteSuggesterInput) SetSuggesterName(v string) *DeleteSuggesterInput {
	s.SuggesterName = &v
	return s
}
644389
func randomizeName(name string) string {
	return strings.Join([]string{
		name,
		fmt.Sprintf("%08x", rand.Uint32()),
	}, nameDelimiter)
}
1063200
func (r *Request) Name(s string) *Request {
	r.resourceName = &s
	return r
}
66508
func (q *SuggesterCategoryQuery) Source() interface{} {
	source := make(map[string]interface{})

	switch len(q.values) {
	case 0:
		source[q.name] = q.values
	case 1:
		source[q.name] = q.values[0]
	default:
		source[q.name] = q.values
	}

	return source
}
199507
func (s *WriteCampaignRequest) SetName(v string) *WriteCampaignRequest {
	s.Name = &v
	return s
}
54829
func SuggestedPlace(s string) string {
	n := rand.Intn(4)
	switch n {
	case 0:
		return "How does this place look? " + s
	case 1:
		return "How about " + s + "?"
	case 2:
		return "Have you been here before? " + s
	case 3:
		return "You could try this: " + s
	}
	log.Debug("suggestedPlace failed to return a response")
	return ""
}