// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: interservice/authz/authz.proto

package authz

import (
	"bytes"
	"errors"
	"fmt"
	"net"
	"net/mail"
	"net/url"
	"regexp"
	"sort"
	"strings"
	"time"
	"unicode/utf8"

	"google.golang.org/protobuf/types/known/anypb"
)

// ensure the imports are used
var (
	_ = bytes.MinRead
	_ = errors.New("")
	_ = fmt.Print
	_ = utf8.UTFMax
	_ = (*regexp.Regexp)(nil)
	_ = (*strings.Reader)(nil)
	_ = net.IPv4len
	_ = time.Duration(0)
	_ = (*url.URL)(nil)
	_ = (*mail.Address)(nil)
	_ = anypb.Any{}
	_ = sort.Sort
)

// Validate checks the field values on IsAuthorizedReq with the rules defined
// in the proto definition for this message. If any rules are violated, the
// first error encountered is returned, or nil if there are no violations.
func (m *IsAuthorizedReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on IsAuthorizedReq with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// IsAuthorizedReqMultiError, or nil if none found.
func (m *IsAuthorizedReq) ValidateAll() error {
	return m.validate(true)
}

func (m *IsAuthorizedReq) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if len(m.GetSubjects()) < 1 {
		err := IsAuthorizedReqValidationError{
			field:  "Subjects",
			reason: "value must contain at least 1 item(s)",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	for idx, item := range m.GetSubjects() {
		_, _ = idx, item

		if !_IsAuthorizedReq_Subjects_Pattern.MatchString(item) {
			err := IsAuthorizedReqValidationError{
				field:  fmt.Sprintf("Subjects[%v]", idx),
				reason: "value does not match regex pattern \"^(?:team|user):(?:local|ldap|saml):[^:*]+$|^token:[^:*]+$|^tls:service:[^:*]+:[^:*]+$\"",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

	if !_IsAuthorizedReq_Resource_Pattern.MatchString(m.GetResource()) {
		err := IsAuthorizedReqValidationError{
			field:  "Resource",
			reason: "value does not match regex pattern \"^[a-z][^:*]*(?::[^:*]+)*$\"",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if !_IsAuthorizedReq_Action_Pattern.MatchString(m.GetAction()) {
		err := IsAuthorizedReqValidationError{
			field:  "Action",
			reason: "value does not match regex pattern \"^[a-z][^:*]*(?::[^:*]+)*$\"",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if len(errors) > 0 {
		return IsAuthorizedReqMultiError(errors)
	}

	return nil
}

// IsAuthorizedReqMultiError is an error wrapping multiple validation errors
// returned by IsAuthorizedReq.ValidateAll() if the designated constraints
// aren't met.
type IsAuthorizedReqMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m IsAuthorizedReqMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m IsAuthorizedReqMultiError) AllErrors() []error { return m }

// IsAuthorizedReqValidationError is the validation error returned by
// IsAuthorizedReq.Validate if the designated constraints aren't met.
type IsAuthorizedReqValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e IsAuthorizedReqValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e IsAuthorizedReqValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e IsAuthorizedReqValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e IsAuthorizedReqValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e IsAuthorizedReqValidationError) ErrorName() string { return "IsAuthorizedReqValidationError" }

// Error satisfies the builtin error interface
func (e IsAuthorizedReqValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sIsAuthorizedReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = IsAuthorizedReqValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = IsAuthorizedReqValidationError{}

var _IsAuthorizedReq_Subjects_Pattern = regexp.MustCompile("^(?:team|user):(?:local|ldap|saml):[^:*]+$|^token:[^:*]+$|^tls:service:[^:*]+:[^:*]+$")

var _IsAuthorizedReq_Resource_Pattern = regexp.MustCompile("^[a-z][^:*]*(?::[^:*]+)*$")

var _IsAuthorizedReq_Action_Pattern = regexp.MustCompile("^[a-z][^:*]*(?::[^:*]+)*$")

// Validate checks the field values on GetVersionReq with the rules defined in
// the proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *GetVersionReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on GetVersionReq with the rules defined
// in the proto definition for this message. If any rules are violated, the
// result is a list of violation errors wrapped in GetVersionReqMultiError, or
// nil if none found.
func (m *GetVersionReq) ValidateAll() error {
	return m.validate(true)
}

func (m *GetVersionReq) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if len(errors) > 0 {
		return GetVersionReqMultiError(errors)
	}

	return nil
}

// GetVersionReqMultiError is an error wrapping multiple validation errors
// returned by GetVersionReq.ValidateAll() if the designated constraints
// aren't met.
type GetVersionReqMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m GetVersionReqMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m GetVersionReqMultiError) AllErrors() []error { return m }

// GetVersionReqValidationError is the validation error returned by
// GetVersionReq.Validate if the designated constraints aren't met.
type GetVersionReqValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e GetVersionReqValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e GetVersionReqValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e GetVersionReqValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e GetVersionReqValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e GetVersionReqValidationError) ErrorName() string { return "GetVersionReqValidationError" }

// Error satisfies the builtin error interface
func (e GetVersionReqValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sGetVersionReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = GetVersionReqValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = GetVersionReqValidationError{}

// Validate checks the field values on ProjectsAuthorizedReq with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *ProjectsAuthorizedReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on ProjectsAuthorizedReq with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// ProjectsAuthorizedReqMultiError, or nil if none found.
func (m *ProjectsAuthorizedReq) ValidateAll() error {
	return m.validate(true)
}

func (m *ProjectsAuthorizedReq) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if len(m.GetSubjects()) < 1 {
		err := ProjectsAuthorizedReqValidationError{
			field:  "Subjects",
			reason: "value must contain at least 1 item(s)",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	for idx, item := range m.GetSubjects() {
		_, _ = idx, item

		if !_ProjectsAuthorizedReq_Subjects_Pattern.MatchString(item) {
			err := ProjectsAuthorizedReqValidationError{
				field:  fmt.Sprintf("Subjects[%v]", idx),
				reason: "value does not match regex pattern \"^(?:team|user):(?:local|ldap|saml):[^:*]+$|^token:[^:*]+$|^tls:service:[^:*]+:[^:*]+$\"",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

	if !_ProjectsAuthorizedReq_Resource_Pattern.MatchString(m.GetResource()) {
		err := ProjectsAuthorizedReqValidationError{
			field:  "Resource",
			reason: "value does not match regex pattern \"^[a-z][^:*]*(?::[^:*]+)*$\"",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if !_ProjectsAuthorizedReq_Action_Pattern.MatchString(m.GetAction()) {
		err := ProjectsAuthorizedReqValidationError{
			field:  "Action",
			reason: "value does not match regex pattern \"^[a-z][a-zA-Z]*(?::[a-z][a-zA-Z]*){2}$\"",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	_ProjectsAuthorizedReq_ProjectsFilter_Unique := make(map[string]struct{}, len(m.GetProjectsFilter()))

	for idx, item := range m.GetProjectsFilter() {
		_, _ = idx, item

		if _, exists := _ProjectsAuthorizedReq_ProjectsFilter_Unique[item]; exists {
			err := ProjectsAuthorizedReqValidationError{
				field:  fmt.Sprintf("ProjectsFilter[%v]", idx),
				reason: "repeated value must contain unique items",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		} else {
			_ProjectsAuthorizedReq_ProjectsFilter_Unique[item] = struct{}{}
		}

		if !_ProjectsAuthorizedReq_ProjectsFilter_Pattern.MatchString(item) {
			err := ProjectsAuthorizedReqValidationError{
				field:  fmt.Sprintf("ProjectsFilter[%v]", idx),
				reason: "value does not match regex pattern \"^[a-z0-9()-_]{1,64}$\"",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

	if len(errors) > 0 {
		return ProjectsAuthorizedReqMultiError(errors)
	}

	return nil
}

// ProjectsAuthorizedReqMultiError is an error wrapping multiple validation
// errors returned by ProjectsAuthorizedReq.ValidateAll() if the designated
// constraints aren't met.
type ProjectsAuthorizedReqMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m ProjectsAuthorizedReqMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m ProjectsAuthorizedReqMultiError) AllErrors() []error { return m }

// ProjectsAuthorizedReqValidationError is the validation error returned by
// ProjectsAuthorizedReq.Validate if the designated constraints aren't met.
type ProjectsAuthorizedReqValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e ProjectsAuthorizedReqValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e ProjectsAuthorizedReqValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e ProjectsAuthorizedReqValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e ProjectsAuthorizedReqValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e ProjectsAuthorizedReqValidationError) ErrorName() string {
	return "ProjectsAuthorizedReqValidationError"
}

// Error satisfies the builtin error interface
func (e ProjectsAuthorizedReqValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sProjectsAuthorizedReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ProjectsAuthorizedReqValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = ProjectsAuthorizedReqValidationError{}

var _ProjectsAuthorizedReq_Subjects_Pattern = regexp.MustCompile("^(?:team|user):(?:local|ldap|saml):[^:*]+$|^token:[^:*]+$|^tls:service:[^:*]+:[^:*]+$")

var _ProjectsAuthorizedReq_Resource_Pattern = regexp.MustCompile("^[a-z][^:*]*(?::[^:*]+)*$")

var _ProjectsAuthorizedReq_Action_Pattern = regexp.MustCompile("^[a-z][a-zA-Z]*(?::[a-z][a-zA-Z]*){2}$")

var _ProjectsAuthorizedReq_ProjectsFilter_Pattern = regexp.MustCompile("^[a-z0-9()-_]{1,64}$")

// Validate checks the field values on ProjectsAuthorizedResp with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *ProjectsAuthorizedResp) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on ProjectsAuthorizedResp with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// ProjectsAuthorizedRespMultiError, or nil if none found.
func (m *ProjectsAuthorizedResp) ValidateAll() error {
	return m.validate(true)
}

func (m *ProjectsAuthorizedResp) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	_ProjectsAuthorizedResp_Projects_Unique := make(map[string]struct{}, len(m.GetProjects()))

	for idx, item := range m.GetProjects() {
		_, _ = idx, item

		if _, exists := _ProjectsAuthorizedResp_Projects_Unique[item]; exists {
			err := ProjectsAuthorizedRespValidationError{
				field:  fmt.Sprintf("Projects[%v]", idx),
				reason: "repeated value must contain unique items",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		} else {
			_ProjectsAuthorizedResp_Projects_Unique[item] = struct{}{}
		}

		if !_ProjectsAuthorizedResp_Projects_Pattern.MatchString(item) {
			err := ProjectsAuthorizedRespValidationError{
				field:  fmt.Sprintf("Projects[%v]", idx),
				reason: "value does not match regex pattern \"^[a-z0-9-_]{1,64}$\"",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

	if len(errors) > 0 {
		return ProjectsAuthorizedRespMultiError(errors)
	}

	return nil
}

// ProjectsAuthorizedRespMultiError is an error wrapping multiple validation
// errors returned by ProjectsAuthorizedResp.ValidateAll() if the designated
// constraints aren't met.
type ProjectsAuthorizedRespMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m ProjectsAuthorizedRespMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m ProjectsAuthorizedRespMultiError) AllErrors() []error { return m }

// ProjectsAuthorizedRespValidationError is the validation error returned by
// ProjectsAuthorizedResp.Validate if the designated constraints aren't met.
type ProjectsAuthorizedRespValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e ProjectsAuthorizedRespValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e ProjectsAuthorizedRespValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e ProjectsAuthorizedRespValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e ProjectsAuthorizedRespValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e ProjectsAuthorizedRespValidationError) ErrorName() string {
	return "ProjectsAuthorizedRespValidationError"
}

// Error satisfies the builtin error interface
func (e ProjectsAuthorizedRespValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sProjectsAuthorizedResp.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ProjectsAuthorizedRespValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = ProjectsAuthorizedRespValidationError{}

var _ProjectsAuthorizedResp_Projects_Pattern = regexp.MustCompile("^[a-z0-9-_]{1,64}$")

// Validate checks the field values on FilterAuthorizedPairsReq with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *FilterAuthorizedPairsReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on FilterAuthorizedPairsReq with the
// rules defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// FilterAuthorizedPairsReqMultiError, or nil if none found.
func (m *FilterAuthorizedPairsReq) ValidateAll() error {
	return m.validate(true)
}

func (m *FilterAuthorizedPairsReq) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if len(m.GetSubjects()) < 1 {
		err := FilterAuthorizedPairsReqValidationError{
			field:  "Subjects",
			reason: "value must contain at least 1 item(s)",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	for idx, item := range m.GetSubjects() {
		_, _ = idx, item

		if !_FilterAuthorizedPairsReq_Subjects_Pattern.MatchString(item) {
			err := FilterAuthorizedPairsReqValidationError{
				field:  fmt.Sprintf("Subjects[%v]", idx),
				reason: "value does not match regex pattern \"^(?:(?:team|user):(?:local|ldap|saml)|token|tls:service:[^:*]+):[^:*]+$\"",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

	for idx, item := range m.GetPairs() {
		_, _ = idx, item

		if all {
			switch v := interface{}(item).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, FilterAuthorizedPairsReqValidationError{
						field:  fmt.Sprintf("Pairs[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, FilterAuthorizedPairsReqValidationError{
						field:  fmt.Sprintf("Pairs[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return FilterAuthorizedPairsReqValidationError{
					field:  fmt.Sprintf("Pairs[%v]", idx),
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	}

	if len(errors) > 0 {
		return FilterAuthorizedPairsReqMultiError(errors)
	}

	return nil
}

// FilterAuthorizedPairsReqMultiError is an error wrapping multiple validation
// errors returned by FilterAuthorizedPairsReq.ValidateAll() if the designated
// constraints aren't met.
type FilterAuthorizedPairsReqMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m FilterAuthorizedPairsReqMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m FilterAuthorizedPairsReqMultiError) AllErrors() []error { return m }

// FilterAuthorizedPairsReqValidationError is the validation error returned by
// FilterAuthorizedPairsReq.Validate if the designated constraints aren't met.
type FilterAuthorizedPairsReqValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e FilterAuthorizedPairsReqValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e FilterAuthorizedPairsReqValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e FilterAuthorizedPairsReqValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e FilterAuthorizedPairsReqValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e FilterAuthorizedPairsReqValidationError) ErrorName() string {
	return "FilterAuthorizedPairsReqValidationError"
}

// Error satisfies the builtin error interface
func (e FilterAuthorizedPairsReqValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sFilterAuthorizedPairsReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = FilterAuthorizedPairsReqValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = FilterAuthorizedPairsReqValidationError{}

var _FilterAuthorizedPairsReq_Subjects_Pattern = regexp.MustCompile("^(?:(?:team|user):(?:local|ldap|saml)|token|tls:service:[^:*]+):[^:*]+$")

// Validate checks the field values on FilterAuthorizedPairsResp with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *FilterAuthorizedPairsResp) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on FilterAuthorizedPairsResp with the
// rules defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// FilterAuthorizedPairsRespMultiError, or nil if none found.
func (m *FilterAuthorizedPairsResp) ValidateAll() error {
	return m.validate(true)
}

func (m *FilterAuthorizedPairsResp) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	for idx, item := range m.GetPairs() {
		_, _ = idx, item

		if all {
			switch v := interface{}(item).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, FilterAuthorizedPairsRespValidationError{
						field:  fmt.Sprintf("Pairs[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, FilterAuthorizedPairsRespValidationError{
						field:  fmt.Sprintf("Pairs[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return FilterAuthorizedPairsRespValidationError{
					field:  fmt.Sprintf("Pairs[%v]", idx),
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	}

	if len(errors) > 0 {
		return FilterAuthorizedPairsRespMultiError(errors)
	}

	return nil
}

// FilterAuthorizedPairsRespMultiError is an error wrapping multiple validation
// errors returned by FilterAuthorizedPairsResp.ValidateAll() if the
// designated constraints aren't met.
type FilterAuthorizedPairsRespMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m FilterAuthorizedPairsRespMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m FilterAuthorizedPairsRespMultiError) AllErrors() []error { return m }

// FilterAuthorizedPairsRespValidationError is the validation error returned by
// FilterAuthorizedPairsResp.Validate if the designated constraints aren't met.
type FilterAuthorizedPairsRespValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e FilterAuthorizedPairsRespValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e FilterAuthorizedPairsRespValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e FilterAuthorizedPairsRespValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e FilterAuthorizedPairsRespValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e FilterAuthorizedPairsRespValidationError) ErrorName() string {
	return "FilterAuthorizedPairsRespValidationError"
}

// Error satisfies the builtin error interface
func (e FilterAuthorizedPairsRespValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sFilterAuthorizedPairsResp.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = FilterAuthorizedPairsRespValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = FilterAuthorizedPairsRespValidationError{}

// Validate checks the field values on Pair with the rules defined in the proto
// definition for this message. If any rules are violated, the first error
// encountered is returned, or nil if there are no violations.
func (m *Pair) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on Pair with the rules defined in the
// proto definition for this message. If any rules are violated, the result is
// a list of violation errors wrapped in PairMultiError, or nil if none found.
func (m *Pair) ValidateAll() error {
	return m.validate(true)
}

func (m *Pair) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if !_Pair_Resource_Pattern.MatchString(m.GetResource()) {
		err := PairValidationError{
			field:  "Resource",
			reason: "value does not match regex pattern \"^[a-z][^:*]*(?::[^:*]+)*$\"",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if !_Pair_Action_Pattern.MatchString(m.GetAction()) {
		err := PairValidationError{
			field:  "Action",
			reason: "value does not match regex pattern \"^[a-z][a-zA-Z]*(?::[a-z][a-zA-Z]*){2}$\"",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if len(errors) > 0 {
		return PairMultiError(errors)
	}

	return nil
}

// PairMultiError is an error wrapping multiple validation errors returned by
// Pair.ValidateAll() if the designated constraints aren't met.
type PairMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m PairMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m PairMultiError) AllErrors() []error { return m }

// PairValidationError is the validation error returned by Pair.Validate if the
// designated constraints aren't met.
type PairValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e PairValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e PairValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e PairValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e PairValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e PairValidationError) ErrorName() string { return "PairValidationError" }

// Error satisfies the builtin error interface
func (e PairValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sPair.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = PairValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = PairValidationError{}

var _Pair_Resource_Pattern = regexp.MustCompile("^[a-z][^:*]*(?::[^:*]+)*$")

var _Pair_Action_Pattern = regexp.MustCompile("^[a-z][a-zA-Z]*(?::[a-z][a-zA-Z]*){2}$")

// Validate checks the field values on FilterAuthorizedProjectsReq with the
// rules defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *FilterAuthorizedProjectsReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on FilterAuthorizedProjectsReq with the
// rules defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// FilterAuthorizedProjectsReqMultiError, or nil if none found.
func (m *FilterAuthorizedProjectsReq) ValidateAll() error {
	return m.validate(true)
}

func (m *FilterAuthorizedProjectsReq) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if len(m.GetSubjects()) < 1 {
		err := FilterAuthorizedProjectsReqValidationError{
			field:  "Subjects",
			reason: "value must contain at least 1 item(s)",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	for idx, item := range m.GetSubjects() {
		_, _ = idx, item

		if !_FilterAuthorizedProjectsReq_Subjects_Pattern.MatchString(item) {
			err := FilterAuthorizedProjectsReqValidationError{
				field:  fmt.Sprintf("Subjects[%v]", idx),
				reason: "value does not match regex pattern \"^(?:(?:team|user):(?:local|ldap|saml)|token|tls:service:[^:*]+):[^:*]+$\"",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

	if len(errors) > 0 {
		return FilterAuthorizedProjectsReqMultiError(errors)
	}

	return nil
}

// FilterAuthorizedProjectsReqMultiError is an error wrapping multiple
// validation errors returned by FilterAuthorizedProjectsReq.ValidateAll() if
// the designated constraints aren't met.
type FilterAuthorizedProjectsReqMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m FilterAuthorizedProjectsReqMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m FilterAuthorizedProjectsReqMultiError) AllErrors() []error { return m }

// FilterAuthorizedProjectsReqValidationError is the validation error returned
// by FilterAuthorizedProjectsReq.Validate if the designated constraints
// aren't met.
type FilterAuthorizedProjectsReqValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e FilterAuthorizedProjectsReqValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e FilterAuthorizedProjectsReqValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e FilterAuthorizedProjectsReqValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e FilterAuthorizedProjectsReqValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e FilterAuthorizedProjectsReqValidationError) ErrorName() string {
	return "FilterAuthorizedProjectsReqValidationError"
}

// Error satisfies the builtin error interface
func (e FilterAuthorizedProjectsReqValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sFilterAuthorizedProjectsReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = FilterAuthorizedProjectsReqValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = FilterAuthorizedProjectsReqValidationError{}

var _FilterAuthorizedProjectsReq_Subjects_Pattern = regexp.MustCompile("^(?:(?:team|user):(?:local|ldap|saml)|token|tls:service:[^:*]+):[^:*]+$")

// Validate checks the field values on FilterAuthorizedProjectsResp with the
// rules defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *FilterAuthorizedProjectsResp) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on FilterAuthorizedProjectsResp with the
// rules defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// FilterAuthorizedProjectsRespMultiError, or nil if none found.
func (m *FilterAuthorizedProjectsResp) ValidateAll() error {
	return m.validate(true)
}

func (m *FilterAuthorizedProjectsResp) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if len(errors) > 0 {
		return FilterAuthorizedProjectsRespMultiError(errors)
	}

	return nil
}

// FilterAuthorizedProjectsRespMultiError is an error wrapping multiple
// validation errors returned by FilterAuthorizedProjectsResp.ValidateAll() if
// the designated constraints aren't met.
type FilterAuthorizedProjectsRespMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m FilterAuthorizedProjectsRespMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m FilterAuthorizedProjectsRespMultiError) AllErrors() []error { return m }

// FilterAuthorizedProjectsRespValidationError is the validation error returned
// by FilterAuthorizedProjectsResp.Validate if the designated constraints
// aren't met.
type FilterAuthorizedProjectsRespValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e FilterAuthorizedProjectsRespValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e FilterAuthorizedProjectsRespValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e FilterAuthorizedProjectsRespValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e FilterAuthorizedProjectsRespValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e FilterAuthorizedProjectsRespValidationError) ErrorName() string {
	return "FilterAuthorizedProjectsRespValidationError"
}

// Error satisfies the builtin error interface
func (e FilterAuthorizedProjectsRespValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sFilterAuthorizedProjectsResp.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = FilterAuthorizedProjectsRespValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = FilterAuthorizedProjectsRespValidationError{}

// Validate checks the field values on ValidateProjectAssignmentReq with the
// rules defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *ValidateProjectAssignmentReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on ValidateProjectAssignmentReq with the
// rules defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// ValidateProjectAssignmentReqMultiError, or nil if none found.
func (m *ValidateProjectAssignmentReq) ValidateAll() error {
	return m.validate(true)
}

func (m *ValidateProjectAssignmentReq) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	_ValidateProjectAssignmentReq_OldProjects_Unique := make(map[string]struct{}, len(m.GetOldProjects()))

	for idx, item := range m.GetOldProjects() {
		_, _ = idx, item

		if _, exists := _ValidateProjectAssignmentReq_OldProjects_Unique[item]; exists {
			err := ValidateProjectAssignmentReqValidationError{
				field:  fmt.Sprintf("OldProjects[%v]", idx),
				reason: "repeated value must contain unique items",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		} else {
			_ValidateProjectAssignmentReq_OldProjects_Unique[item] = struct{}{}
		}

		if !_ValidateProjectAssignmentReq_OldProjects_Pattern.MatchString(item) {
			err := ValidateProjectAssignmentReqValidationError{
				field:  fmt.Sprintf("OldProjects[%v]", idx),
				reason: "value does not match regex pattern \"^[a-z0-9()-_]{1,64}$\"",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

	_ValidateProjectAssignmentReq_NewProjects_Unique := make(map[string]struct{}, len(m.GetNewProjects()))

	for idx, item := range m.GetNewProjects() {
		_, _ = idx, item

		if _, exists := _ValidateProjectAssignmentReq_NewProjects_Unique[item]; exists {
			err := ValidateProjectAssignmentReqValidationError{
				field:  fmt.Sprintf("NewProjects[%v]", idx),
				reason: "repeated value must contain unique items",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		} else {
			_ValidateProjectAssignmentReq_NewProjects_Unique[item] = struct{}{}
		}

		if !_ValidateProjectAssignmentReq_NewProjects_Pattern.MatchString(item) {
			err := ValidateProjectAssignmentReqValidationError{
				field:  fmt.Sprintf("NewProjects[%v]", idx),
				reason: "value does not match regex pattern \"^[a-z0-9()-_]{1,64}$\"",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

	// no validation rules for IsUpdateRequest

	if len(errors) > 0 {
		return ValidateProjectAssignmentReqMultiError(errors)
	}

	return nil
}

// ValidateProjectAssignmentReqMultiError is an error wrapping multiple
// validation errors returned by ValidateProjectAssignmentReq.ValidateAll() if
// the designated constraints aren't met.
type ValidateProjectAssignmentReqMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m ValidateProjectAssignmentReqMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m ValidateProjectAssignmentReqMultiError) AllErrors() []error { return m }

// ValidateProjectAssignmentReqValidationError is the validation error returned
// by ValidateProjectAssignmentReq.Validate if the designated constraints
// aren't met.
type ValidateProjectAssignmentReqValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e ValidateProjectAssignmentReqValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e ValidateProjectAssignmentReqValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e ValidateProjectAssignmentReqValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e ValidateProjectAssignmentReqValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e ValidateProjectAssignmentReqValidationError) ErrorName() string {
	return "ValidateProjectAssignmentReqValidationError"
}

// Error satisfies the builtin error interface
func (e ValidateProjectAssignmentReqValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sValidateProjectAssignmentReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ValidateProjectAssignmentReqValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = ValidateProjectAssignmentReqValidationError{}

var _ValidateProjectAssignmentReq_OldProjects_Pattern = regexp.MustCompile("^[a-z0-9()-_]{1,64}$")

var _ValidateProjectAssignmentReq_NewProjects_Pattern = regexp.MustCompile("^[a-z0-9()-_]{1,64}$")

// Validate checks the field values on ValidateProjectAssignmentResp with the
// rules defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *ValidateProjectAssignmentResp) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on ValidateProjectAssignmentResp with
// the rules defined in the proto definition for this message. If any rules
// are violated, the result is a list of violation errors wrapped in
// ValidateProjectAssignmentRespMultiError, or nil if none found.
func (m *ValidateProjectAssignmentResp) ValidateAll() error {
	return m.validate(true)
}

func (m *ValidateProjectAssignmentResp) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if len(errors) > 0 {
		return ValidateProjectAssignmentRespMultiError(errors)
	}

	return nil
}

// ValidateProjectAssignmentRespMultiError is an error wrapping multiple
// validation errors returned by ValidateProjectAssignmentResp.ValidateAll()
// if the designated constraints aren't met.
type ValidateProjectAssignmentRespMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m ValidateProjectAssignmentRespMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m ValidateProjectAssignmentRespMultiError) AllErrors() []error { return m }

// ValidateProjectAssignmentRespValidationError is the validation error
// returned by ValidateProjectAssignmentResp.Validate if the designated
// constraints aren't met.
type ValidateProjectAssignmentRespValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e ValidateProjectAssignmentRespValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e ValidateProjectAssignmentRespValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e ValidateProjectAssignmentRespValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e ValidateProjectAssignmentRespValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e ValidateProjectAssignmentRespValidationError) ErrorName() string {
	return "ValidateProjectAssignmentRespValidationError"
}

// Error satisfies the builtin error interface
func (e ValidateProjectAssignmentRespValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sValidateProjectAssignmentResp.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ValidateProjectAssignmentRespValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = ValidateProjectAssignmentRespValidationError{}
