Merge pull request #85037 from hvaara/fix-golint-pkg-apis-authorization

Fix golint issues in pkg/apis/authorization
This commit is contained in:
Kubernetes Prow Robot 2019-11-09 15:29:48 -08:00 committed by GitHub
commit 80b25a766a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 3 deletions

View File

@ -15,8 +15,6 @@ pkg/apis/apps/v1beta1
pkg/apis/apps/v1beta2
pkg/apis/auditregistration/v1alpha1
pkg/apis/authentication/v1
pkg/apis/authorization/v1
pkg/apis/authorization/validation
pkg/apis/autoscaling/v1
pkg/apis/autoscaling/v2beta1
pkg/apis/autoscaling/v2beta2

View File

@ -33,8 +33,11 @@ func Resource(resource string) schema.GroupResource {
}
var (
// localSchemeBuilder extends the SchemeBuilder instance with the external types. In this package,
// defaulting and conversion init funcs are registered as well.
localSchemeBuilder = &authorizationv1.SchemeBuilder
AddToScheme = localSchemeBuilder.AddToScheme
// AddToScheme is a global function that registers this API group & version to a scheme
AddToScheme = localSchemeBuilder.AddToScheme
)
func init() {

View File

@ -23,6 +23,8 @@ import (
authorizationapi "k8s.io/kubernetes/pkg/apis/authorization"
)
// ValidateSubjectAccessReviewSpec validates a SubjectAccessReviewSpec and returns an
// ErrorList with any errors.
func ValidateSubjectAccessReviewSpec(spec authorizationapi.SubjectAccessReviewSpec, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if spec.ResourceAttributes != nil && spec.NonResourceAttributes != nil {
@ -38,6 +40,8 @@ func ValidateSubjectAccessReviewSpec(spec authorizationapi.SubjectAccessReviewSp
return allErrs
}
// ValidateSelfSubjectAccessReviewSpec validates a SelfSubjectAccessReviewSpec and returns an
// ErrorList with any errors.
func ValidateSelfSubjectAccessReviewSpec(spec authorizationapi.SelfSubjectAccessReviewSpec, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if spec.ResourceAttributes != nil && spec.NonResourceAttributes != nil {
@ -50,10 +54,14 @@ func ValidateSelfSubjectAccessReviewSpec(spec authorizationapi.SelfSubjectAccess
return allErrs
}
// ValidateSelfSubjectRulesReview validates a SelfSubjectRulesReview and returns an
// ErrorList with any errors.
func ValidateSelfSubjectRulesReview(review *authorizationapi.SelfSubjectRulesReview) field.ErrorList {
return field.ErrorList{}
}
// ValidateSubjectAccessReview validates a SubjectAccessReview and returns an
// ErrorList with any errors.
func ValidateSubjectAccessReview(sar *authorizationapi.SubjectAccessReview) field.ErrorList {
allErrs := ValidateSubjectAccessReviewSpec(sar.Spec, field.NewPath("spec"))
objectMetaShallowCopy := sar.ObjectMeta
@ -64,6 +72,8 @@ func ValidateSubjectAccessReview(sar *authorizationapi.SubjectAccessReview) fiel
return allErrs
}
// ValidateSelfSubjectAccessReview validates a SelfSubjectAccessReview and returns an
// ErrorList with any errors.
func ValidateSelfSubjectAccessReview(sar *authorizationapi.SelfSubjectAccessReview) field.ErrorList {
allErrs := ValidateSelfSubjectAccessReviewSpec(sar.Spec, field.NewPath("spec"))
objectMetaShallowCopy := sar.ObjectMeta
@ -74,6 +84,8 @@ func ValidateSelfSubjectAccessReview(sar *authorizationapi.SelfSubjectAccessRevi
return allErrs
}
// ValidateLocalSubjectAccessReview validates a LocalSubjectAccessReview and returns an
// ErrorList with any errors.
func ValidateLocalSubjectAccessReview(sar *authorizationapi.LocalSubjectAccessReview) field.ErrorList {
allErrs := ValidateSubjectAccessReviewSpec(sar.Spec, field.NewPath("spec"))