本文整理汇总了Golang中github.com/openshift/origin/pkg/api.MinimalNameRequirements函数的典型用法代码示例。如果您正苦于以下问题:Golang MinimalNameRequirements函数的具体用法?Golang MinimalNameRequirements怎么用?Golang MinimalNameRequirements使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MinimalNameRequirements函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ValidateIdentityProviderName
func ValidateIdentityProviderName(name string) []string {
if reasons := oapi.MinimalNameRequirements(name, false); len(reasons) != 0 {
return reasons
}
if strings.Contains(name, ":") {
return []string{`may not contain ":"`}
}
return nil
}
示例2: ValidateIdentityProviderName
func ValidateIdentityProviderName(name string) (bool, string) {
if ok, reason := oapi.MinimalNameRequirements(name, false); !ok {
return ok, reason
}
if strings.Contains(name, ":") {
return false, `may not contain ":"`
}
return true, ""
}
示例3: ValidateImageStreamName
func ValidateImageStreamName(name string, prefix bool) (bool, string) {
if ok, reason := oapi.MinimalNameRequirements(name, prefix); !ok {
return ok, reason
}
if !RepositoryNameComponentAnchoredRegexp.MatchString(name) {
return false, fmt.Sprintf("must match %q", RepositoryNameComponentRegexp.String())
}
return true, ""
}
示例4: ValidateImageStreamName
func ValidateImageStreamName(name string, prefix bool) []string {
if reasons := oapi.MinimalNameRequirements(name, prefix); len(reasons) != 0 {
return reasons
}
if !RepositoryNameComponentAnchoredRegexp.MatchString(name) {
return []string{fmt.Sprintf("must match %q", RepositoryNameComponentRegexp.String())}
}
return nil
}
示例5: ValidateTokenName
func ValidateTokenName(name string, prefix bool) (bool, string) {
if ok, reason := oapi.MinimalNameRequirements(name, prefix); !ok {
return ok, reason
}
if len(name) < MinTokenLength {
return false, fmt.Sprintf("must be at least %d characters long", MinTokenLength)
}
return true, ""
}
示例6: ValidateTokenName
func ValidateTokenName(name string, prefix bool) []string {
if reasons := oapi.MinimalNameRequirements(name, prefix); len(reasons) != 0 {
return reasons
}
if len(name) < MinTokenLength {
return []string{fmt.Sprintf("must be at least %d characters long", MinTokenLength)}
}
return nil
}
示例7: ValidateApplicationName
func ValidateApplicationName(name string, prefix bool) (bool, string) {
if ok, reason := oapi.MinimalNameRequirements(name, prefix); !ok {
return ok, reason
}
if len(name) < 2 {
return false, "must be at least 2 characters long"
}
return true, ""
}
示例8: ValidatePolicyName
func ValidatePolicyName(name string, prefix bool) []string {
if reasons := oapi.MinimalNameRequirements(name, prefix); len(reasons) != 0 {
return reasons
}
if name != authorizationapi.PolicyName {
return []string{"name must be " + authorizationapi.PolicyName}
}
return nil
}
示例9: ValidatePolicyName
func ValidatePolicyName(name string, prefix bool) (bool, string) {
if ok, reason := oapi.MinimalNameRequirements(name, prefix); !ok {
return ok, reason
}
if name != authorizationapi.PolicyName {
return false, "name must be " + authorizationapi.PolicyName
}
return true, ""
}
示例10: BackingServiceInstanceName
func BackingServiceInstanceName(name string, prefix bool) (bool, string) {
if ok, reason := oapi.MinimalNameRequirements(name, prefix); !ok {
return ok, reason
}
if len(name) < 2 {
return false, "must be at least 2 characters long"
}
return true, ""
}
示例11: ValidateClientAuthorizationName
func ValidateClientAuthorizationName(name string, prefix bool) (bool, string) {
if ok, reason := oapi.MinimalNameRequirements(name, prefix); !ok {
return ok, reason
}
lastColon := strings.Index(name, ":")
if lastColon <= 0 || lastColon >= len(name)-1 {
return false, "must be in the format <userName>:<clientName>"
}
return true, ""
}
示例12: ValidateClientAuthorizationName
func ValidateClientAuthorizationName(name string, prefix bool) []string {
if reasons := oapi.MinimalNameRequirements(name, prefix); len(reasons) != 0 {
return reasons
}
lastColon := strings.Index(name, ":")
if lastColon <= 0 || lastColon >= len(name)-1 {
return []string{"must be in the format <userName>:<clientName>"}
}
return nil
}
示例13: ValidateGroupName
func ValidateGroupName(name string, _ bool) []string {
if reasons := oapi.MinimalNameRequirements(name, false); len(reasons) != 0 {
return reasons
}
if strings.Contains(name, ":") {
return []string{`may not contain ":"`}
}
if name == "~" {
return []string{`may not equal "~"`}
}
return nil
}
示例14: PolicyBindingNameValidator
func PolicyBindingNameValidator(policyRefNamespace string) validation.ValidateNameFunc {
return func(name string, prefix bool) []string {
if reasons := oapi.MinimalNameRequirements(name, prefix); len(reasons) != 0 {
return reasons
}
if name != authorizationapi.GetPolicyBindingName(policyRefNamespace) {
return []string{"name must be " + authorizationapi.GetPolicyBindingName(policyRefNamespace)}
}
return nil
}
}
示例15: ValidateImageStreamName
func ValidateImageStreamName(name string, prefix bool) (bool, string) {
if ok, reason := oapi.MinimalNameRequirements(name, prefix); !ok {
return ok, reason
}
if len(name) < v2.RepositoryNameComponentMinLength {
return false, fmt.Sprintf("must be at least %d characters long", v2.RepositoryNameComponentMinLength)
}
if !v2.RepositoryNameComponentAnchoredRegexp.MatchString(name) {
return false, fmt.Sprintf("must match %q", v2.RepositoryNameComponentRegexp.String())
}
return true, ""
}