当前位置: 首页>>代码示例>>Golang>>正文


Golang api.MinimalNameRequirements函数代码示例

本文整理汇总了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
}
开发者ID:Xmagicer,项目名称:origin,代码行数:10,代码来源:validation.go

示例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, ""
}
开发者ID:RomainVabre,项目名称:origin,代码行数:10,代码来源:validation.go

示例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, ""
}
开发者ID:RomainVabre,项目名称:origin,代码行数:10,代码来源:validation.go

示例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
}
开发者ID:legionus,项目名称:origin,代码行数:10,代码来源:validation.go

示例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, ""
}
开发者ID:johnmccawley,项目名称:origin,代码行数:10,代码来源:validation.go

示例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
}
开发者ID:pweil-,项目名称:origin,代码行数:10,代码来源:validation.go

示例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, ""
}
开发者ID:asiainfoLDP,项目名称:datafactory,代码行数:11,代码来源:validation.go

示例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
}
开发者ID:juanluisvaladas,项目名称:origin,代码行数:11,代码来源:validation.go

示例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, ""
}
开发者ID:dctse,项目名称:openshift-cucumber,代码行数:11,代码来源:validation.go

示例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, ""
}
开发者ID:asiainfoLDP,项目名称:datafactory,代码行数:11,代码来源:validation.go

示例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, ""
}
开发者ID:RomainVabre,项目名称:origin,代码行数:12,代码来源:validation.go

示例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
}
开发者ID:pweil-,项目名称:origin,代码行数:12,代码来源:validation.go

示例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
}
开发者ID:Xmagicer,项目名称:origin,代码行数:13,代码来源:validation.go

示例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
	}
}
开发者ID:juanluisvaladas,项目名称:origin,代码行数:13,代码来源:validation.go

示例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, ""
}
开发者ID:dctse,项目名称:openshift-cucumber,代码行数:13,代码来源:validation.go


注:本文中的github.com/openshift/origin/pkg/api.MinimalNameRequirements函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。