MCPcopy Create free account
hub / github.com/cortexproject/cortex / ValidTenantID

Function ValidTenantID

pkg/util/users/tenant.go:58–78  ·  view source on GitHub ↗

ValidTenantID validate tenantID

(s string)

Source from the content-addressed store, hash-verified

56
57// ValidTenantID validate tenantID
58func ValidTenantID(s string) error {
59 // check if it contains invalid runes
60 for pos, r := range s {
61 if !isSupported(r) {
62 return &errTenantIDUnsupportedCharacter{
63 tenantID: s,
64 pos: pos,
65 }
66 }
67 }
68
69 if err := CheckTenantIDLength(s); err != nil {
70 return err
71 }
72
73 if err := CheckTenantIDIsSupported(s); err != nil {
74 return err
75 }
76
77 return nil
78}
79
80func CheckTenantIDLength(s string) error {
81 if len(s) > 150 {

Callers 4

TenantIDMethod · 0.85
ValidateOrgIDsFunction · 0.85
TestValidTenantIDsFunction · 0.85

Calls 3

CheckTenantIDLengthFunction · 0.85
CheckTenantIDIsSupportedFunction · 0.85
isSupportedFunction · 0.70

Tested by 1

TestValidTenantIDsFunction · 0.68