// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: interservice/authz/policy.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 Policy 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 *Policy) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on Policy 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 PolicyMultiError, or nil if none found.
func (m *Policy) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	// no validation rules for Name

	// no validation rules for Id

	// no validation rules for Type

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

		if all {
			switch v := interface{}(item).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, PolicyValidationError{
						field:  fmt.Sprintf("Statements[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, PolicyValidationError{
						field:  fmt.Sprintf("Statements[%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 PolicyValidationError{
					field:  fmt.Sprintf("Statements[%v]", idx),
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	}

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m PolicyMultiError) 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 PolicyMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e PolicyValidationError) 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 %sPolicy.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = PolicyValidationError{}

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

// Validate checks the field values on Role 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 *Role) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on Role 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 RoleMultiError, or nil if none found.
func (m *Role) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	// no validation rules for Name

	// no validation rules for Id

	// no validation rules for Type

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m RoleMultiError) 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 RoleMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e RoleValidationError) 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 %sRole.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = RoleValidationError{}

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

// Validate checks the field values on CreatePolicyReq 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 *CreatePolicyReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on CreatePolicyReq 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
// CreatePolicyReqMultiError, or nil if none found.
func (m *CreatePolicyReq) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	if !_CreatePolicyReq_Id_Pattern.MatchString(m.GetId()) {
		err := CreatePolicyReqValidationError{
			field:  "Id",
			reason: "value does not match regex pattern \"^[a-z0-9-_]{1,64}$\"",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	// no validation rules for Name

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

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

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

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

	}

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

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

		if all {
			switch v := interface{}(item).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, CreatePolicyReqValidationError{
						field:  fmt.Sprintf("Statements[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, CreatePolicyReqValidationError{
						field:  fmt.Sprintf("Statements[%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 CreatePolicyReqValidationError{
					field:  fmt.Sprintf("Statements[%v]", idx),
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	}

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

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

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

		// no validation rules for Projects[idx]
	}

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m CreatePolicyReqMultiError) 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 CreatePolicyReqMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e CreatePolicyReqValidationError) 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 %sCreatePolicyReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = CreatePolicyReqValidationError{}

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

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

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

// Validate checks the field values on DeletePolicyReq 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 *DeletePolicyReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on DeletePolicyReq 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
// DeletePolicyReqMultiError, or nil if none found.
func (m *DeletePolicyReq) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	// no validation rules for Id

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m DeletePolicyReqMultiError) 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 DeletePolicyReqMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e DeletePolicyReqValidationError) 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 %sDeletePolicyReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = DeletePolicyReqValidationError{}

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

// Validate checks the field values on DeletePolicyResp 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 *DeletePolicyResp) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on DeletePolicyResp 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
// DeletePolicyRespMultiError, or nil if none found.
func (m *DeletePolicyResp) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m DeletePolicyRespMultiError) 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 DeletePolicyRespMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e DeletePolicyRespValidationError) 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 %sDeletePolicyResp.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = DeletePolicyRespValidationError{}

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

// Validate checks the field values on Statement 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 *Statement) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on Statement 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 StatementMultiError, or nil
// if none found.
func (m *Statement) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	// no validation rules for Effect

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

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

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

		if !_Statement_Resources_Pattern.MatchString(item) {
			err := StatementValidationError{
				field:  fmt.Sprintf("Resources[%v]", idx),
				reason: "value does not match regex pattern \"^[a-z][^:*]*(?::[^:*]+)*(?::[*])?$|^[*]$\"",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

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

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

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

		if !_Statement_Actions_Pattern.MatchString(item) {
			err := StatementValidationError{
				field:  fmt.Sprintf("Actions[%v]", idx),
				reason: "value does not match regex pattern \"^[*]$|^[*]:[a-z][-a-zA-Z]*$|^[a-z][a-zA-Z]*:[a-z][a-zA-Z]*:[a-z][a-zA-Z]*$|^[a-z][a-zA-Z]*:[*]$|^[a-z][a-zA-Z]*:[*]:[a-z][a-zA-Z]*$|^[a-z][a-zA-Z]*:[a-z][a-zA-Z]*:[*]$\"",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

	if !_Statement_Role_Pattern.MatchString(m.GetRole()) {
		err := StatementValidationError{
			field:  "Role",
			reason: "value does not match regex pattern \"^$|^[a-z0-9-_]{1,64}$\"",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

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

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

		// no validation rules for Projects[idx]
	}

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m StatementMultiError) 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 StatementMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e StatementValidationError) 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 %sStatement.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = StatementValidationError{}

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

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

var _Statement_Actions_Pattern = regexp.MustCompile("^[*]$|^[*]:[a-z][-a-zA-Z]*$|^[a-z][a-zA-Z]*:[a-z][a-zA-Z]*:[a-z][a-zA-Z]*$|^[a-z][a-zA-Z]*:[*]$|^[a-z][a-zA-Z]*:[*]:[a-z][a-zA-Z]*$|^[a-z][a-zA-Z]*:[a-z][a-zA-Z]*:[*]$")

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

// Validate checks the field values on ListPoliciesReq 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 *ListPoliciesReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on ListPoliciesReq 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
// ListPoliciesReqMultiError, or nil if none found.
func (m *ListPoliciesReq) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m ListPoliciesReqMultiError) 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 ListPoliciesReqMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e ListPoliciesReqValidationError) 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 %sListPoliciesReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ListPoliciesReqValidationError{}

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

// Validate checks the field values on ListPoliciesResp 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 *ListPoliciesResp) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on ListPoliciesResp 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
// ListPoliciesRespMultiError, or nil if none found.
func (m *ListPoliciesResp) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

		if all {
			switch v := interface{}(item).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, ListPoliciesRespValidationError{
						field:  fmt.Sprintf("Policies[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, ListPoliciesRespValidationError{
						field:  fmt.Sprintf("Policies[%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 ListPoliciesRespValidationError{
					field:  fmt.Sprintf("Policies[%v]", idx),
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	}

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m ListPoliciesRespMultiError) 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 ListPoliciesRespMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e ListPoliciesRespValidationError) 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 %sListPoliciesResp.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ListPoliciesRespValidationError{}

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

// Validate checks the field values on GetPolicyReq 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 *GetPolicyReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on GetPolicyReq 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 GetPolicyReqMultiError, or
// nil if none found.
func (m *GetPolicyReq) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	// no validation rules for Id

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m GetPolicyReqMultiError) 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 GetPolicyReqMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e GetPolicyReqValidationError) 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 %sGetPolicyReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = GetPolicyReqValidationError{}

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

// Validate checks the field values on UpdatePolicyReq 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 *UpdatePolicyReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on UpdatePolicyReq 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
// UpdatePolicyReqMultiError, or nil if none found.
func (m *UpdatePolicyReq) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	// no validation rules for Id

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

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

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

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

	}

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

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

		if all {
			switch v := interface{}(item).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, UpdatePolicyReqValidationError{
						field:  fmt.Sprintf("Statements[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, UpdatePolicyReqValidationError{
						field:  fmt.Sprintf("Statements[%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 UpdatePolicyReqValidationError{
					field:  fmt.Sprintf("Statements[%v]", idx),
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	}

	// no validation rules for Name

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

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

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

		// no validation rules for Projects[idx]
	}

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m UpdatePolicyReqMultiError) 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 UpdatePolicyReqMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e UpdatePolicyReqValidationError) 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 %sUpdatePolicyReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = UpdatePolicyReqValidationError{}

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

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

// Validate checks the field values on ReplacePolicyMembersReq 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 *ReplacePolicyMembersReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on ReplacePolicyMembersReq 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
// ReplacePolicyMembersReqMultiError, or nil if none found.
func (m *ReplacePolicyMembersReq) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	// no validation rules for Id

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

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

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

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

	}

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m ReplacePolicyMembersReqMultiError) 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 ReplacePolicyMembersReqMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e ReplacePolicyMembersReqValidationError) 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 %sReplacePolicyMembersReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ReplacePolicyMembersReqValidationError{}

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

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

// Validate checks the field values on ReplacePolicyMembersResp 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 *ReplacePolicyMembersResp) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on ReplacePolicyMembersResp 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
// ReplacePolicyMembersRespMultiError, or nil if none found.
func (m *ReplacePolicyMembersResp) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m ReplacePolicyMembersRespMultiError) 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 ReplacePolicyMembersRespMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e ReplacePolicyMembersRespValidationError) 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 %sReplacePolicyMembersResp.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ReplacePolicyMembersRespValidationError{}

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

// Validate checks the field values on AddPolicyMembersReq 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 *AddPolicyMembersReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on AddPolicyMembersReq 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
// AddPolicyMembersReqMultiError, or nil if none found.
func (m *AddPolicyMembersReq) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	// no validation rules for Id

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

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

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

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

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

	}

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m AddPolicyMembersReqMultiError) 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 AddPolicyMembersReqMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e AddPolicyMembersReqValidationError) 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 %sAddPolicyMembersReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = AddPolicyMembersReqValidationError{}

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

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

// Validate checks the field values on AddPolicyMembersResp 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 *AddPolicyMembersResp) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on AddPolicyMembersResp 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
// AddPolicyMembersRespMultiError, or nil if none found.
func (m *AddPolicyMembersResp) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m AddPolicyMembersRespMultiError) 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 AddPolicyMembersRespMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e AddPolicyMembersRespValidationError) 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 %sAddPolicyMembersResp.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = AddPolicyMembersRespValidationError{}

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

// Validate checks the field values on Version 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 *Version) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on Version 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 VersionMultiError, or nil if none found.
func (m *Version) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	// no validation rules for Major

	// no validation rules for Minor

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m VersionMultiError) 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 VersionMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e VersionValidationError) 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 %sVersion.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = VersionValidationError{}

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

// Validate checks the field values on GetPolicyVersionReq 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 *GetPolicyVersionReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on GetPolicyVersionReq 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
// GetPolicyVersionReqMultiError, or nil if none found.
func (m *GetPolicyVersionReq) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m GetPolicyVersionReqMultiError) 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 GetPolicyVersionReqMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e GetPolicyVersionReqValidationError) 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 %sGetPolicyVersionReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = GetPolicyVersionReqValidationError{}

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

// Validate checks the field values on GetPolicyVersionResp 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 *GetPolicyVersionResp) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on GetPolicyVersionResp 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
// GetPolicyVersionRespMultiError, or nil if none found.
func (m *GetPolicyVersionResp) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	if all {
		switch v := interface{}(m.GetVersion()).(type) {
		case interface{ ValidateAll() error }:
			if err := v.ValidateAll(); err != nil {
				errors = append(errors, GetPolicyVersionRespValidationError{
					field:  "Version",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		case interface{ Validate() error }:
			if err := v.Validate(); err != nil {
				errors = append(errors, GetPolicyVersionRespValidationError{
					field:  "Version",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		}
	} else if v, ok := interface{}(m.GetVersion()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return GetPolicyVersionRespValidationError{
				field:  "Version",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m GetPolicyVersionRespMultiError) 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 GetPolicyVersionRespMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e GetPolicyVersionRespValidationError) 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 %sGetPolicyVersionResp.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = GetPolicyVersionRespValidationError{}

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

// Validate checks the field values on ListRolesReq 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 *ListRolesReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on ListRolesReq 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 ListRolesReqMultiError, or
// nil if none found.
func (m *ListRolesReq) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m ListRolesReqMultiError) 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 ListRolesReqMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e ListRolesReqValidationError) 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 %sListRolesReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ListRolesReqValidationError{}

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

// Validate checks the field values on ListRolesResp 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 *ListRolesResp) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on ListRolesResp 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 ListRolesRespMultiError, or
// nil if none found.
func (m *ListRolesResp) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

		if all {
			switch v := interface{}(item).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, ListRolesRespValidationError{
						field:  fmt.Sprintf("Roles[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, ListRolesRespValidationError{
						field:  fmt.Sprintf("Roles[%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 ListRolesRespValidationError{
					field:  fmt.Sprintf("Roles[%v]", idx),
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	}

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m ListRolesRespMultiError) 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 ListRolesRespMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e ListRolesRespValidationError) 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 %sListRolesResp.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ListRolesRespValidationError{}

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

// Validate checks the field values on DeleteRoleReq 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 *DeleteRoleReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on DeleteRoleReq 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 DeleteRoleReqMultiError, or
// nil if none found.
func (m *DeleteRoleReq) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	// no validation rules for Id

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m DeleteRoleReqMultiError) 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 DeleteRoleReqMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e DeleteRoleReqValidationError) 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 %sDeleteRoleReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = DeleteRoleReqValidationError{}

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

// Validate checks the field values on DeleteRoleResp 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 *DeleteRoleResp) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on DeleteRoleResp 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 DeleteRoleRespMultiError,
// or nil if none found.
func (m *DeleteRoleResp) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m DeleteRoleRespMultiError) 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 DeleteRoleRespMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e DeleteRoleRespValidationError) 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 %sDeleteRoleResp.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = DeleteRoleRespValidationError{}

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

// Validate checks the field values on UpdateRoleReq 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 *UpdateRoleReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on UpdateRoleReq 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 UpdateRoleReqMultiError, or
// nil if none found.
func (m *UpdateRoleReq) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	// no validation rules for Id

	// no validation rules for Name

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

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

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

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

		if !_UpdateRoleReq_Actions_Pattern.MatchString(item) {
			err := UpdateRoleReqValidationError{
				field:  fmt.Sprintf("Actions[%v]", idx),
				reason: "value does not match regex pattern \"^[*]$|^[*]:[a-z][-a-zA-Z]*$|^[a-z][a-zA-Z]*:[a-z][a-zA-Z]*:[a-z][a-zA-Z]*$|^[a-z][a-zA-Z]*:[*]$|^[a-z][a-zA-Z]*:[*]:[a-z][a-zA-Z]*$|^[a-z][a-zA-Z]*:[a-z][a-zA-Z]*:[*]$\"",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

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

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

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

		// no validation rules for Projects[idx]
	}

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m UpdateRoleReqMultiError) 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 UpdateRoleReqMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e UpdateRoleReqValidationError) 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 %sUpdateRoleReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = UpdateRoleReqValidationError{}

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

var _UpdateRoleReq_Actions_Pattern = regexp.MustCompile("^[*]$|^[*]:[a-z][-a-zA-Z]*$|^[a-z][a-zA-Z]*:[a-z][a-zA-Z]*:[a-z][a-zA-Z]*$|^[a-z][a-zA-Z]*:[*]$|^[a-z][a-zA-Z]*:[*]:[a-z][a-zA-Z]*$|^[a-z][a-zA-Z]*:[a-z][a-zA-Z]*:[*]$")

// Validate checks the field values on ListPolicyMembersReq 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 *ListPolicyMembersReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on ListPolicyMembersReq 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
// ListPolicyMembersReqMultiError, or nil if none found.
func (m *ListPolicyMembersReq) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	// no validation rules for Id

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m ListPolicyMembersReqMultiError) 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 ListPolicyMembersReqMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e ListPolicyMembersReqValidationError) 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 %sListPolicyMembersReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ListPolicyMembersReqValidationError{}

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

// Validate checks the field values on ListPolicyMembersResp 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 *ListPolicyMembersResp) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on ListPolicyMembersResp 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
// ListPolicyMembersRespMultiError, or nil if none found.
func (m *ListPolicyMembersResp) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m ListPolicyMembersRespMultiError) 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 ListPolicyMembersRespMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e ListPolicyMembersRespValidationError) 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 %sListPolicyMembersResp.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ListPolicyMembersRespValidationError{}

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

// Validate checks the field values on RemovePolicyMembersReq 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 *RemovePolicyMembersReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on RemovePolicyMembersReq 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
// RemovePolicyMembersReqMultiError, or nil if none found.
func (m *RemovePolicyMembersReq) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	// no validation rules for Id

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

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

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

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

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

	}

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m RemovePolicyMembersReqMultiError) 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 RemovePolicyMembersReqMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e RemovePolicyMembersReqValidationError) 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 %sRemovePolicyMembersReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = RemovePolicyMembersReqValidationError{}

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

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

// Validate checks the field values on RemovePolicyMembersResp 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 *RemovePolicyMembersResp) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on RemovePolicyMembersResp 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
// RemovePolicyMembersRespMultiError, or nil if none found.
func (m *RemovePolicyMembersResp) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m RemovePolicyMembersRespMultiError) 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 RemovePolicyMembersRespMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e RemovePolicyMembersRespValidationError) 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 %sRemovePolicyMembersResp.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = RemovePolicyMembersRespValidationError{}

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

// Validate checks the field values on MigrateToV2Req 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 *MigrateToV2Req) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on MigrateToV2Req 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 MigrateToV2ReqMultiError,
// or nil if none found.
func (m *MigrateToV2Req) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	// no validation rules for Flag

	// no validation rules for SkipV1Policies

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m MigrateToV2ReqMultiError) 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 MigrateToV2ReqMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e MigrateToV2ReqValidationError) 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 %sMigrateToV2Req.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = MigrateToV2ReqValidationError{}

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

// Validate checks the field values on MigrateToV2Resp 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 *MigrateToV2Resp) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on MigrateToV2Resp 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
// MigrateToV2RespMultiError, or nil if none found.
func (m *MigrateToV2Resp) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m MigrateToV2RespMultiError) 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 MigrateToV2RespMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e MigrateToV2RespValidationError) 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 %sMigrateToV2Resp.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = MigrateToV2RespValidationError{}

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

// Validate checks the field values on ResetToV1Req 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 *ResetToV1Req) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on ResetToV1Req 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 ResetToV1ReqMultiError, or
// nil if none found.
func (m *ResetToV1Req) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m ResetToV1ReqMultiError) 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 ResetToV1ReqMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e ResetToV1ReqValidationError) 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 %sResetToV1Req.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ResetToV1ReqValidationError{}

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

// Validate checks the field values on ResetToV1Resp 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 *ResetToV1Resp) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on ResetToV1Resp 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 ResetToV1RespMultiError, or
// nil if none found.
func (m *ResetToV1Resp) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m ResetToV1RespMultiError) 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 ResetToV1RespMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e ResetToV1RespValidationError) 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 %sResetToV1Resp.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ResetToV1RespValidationError{}

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

// Validate checks the field values on GetRoleReq 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 *GetRoleReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on GetRoleReq 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 GetRoleReqMultiError, or
// nil if none found.
func (m *GetRoleReq) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	// no validation rules for Id

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m GetRoleReqMultiError) 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 GetRoleReqMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e GetRoleReqValidationError) 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 %sGetRoleReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = GetRoleReqValidationError{}

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

// Validate checks the field values on CreateRoleReq 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 *CreateRoleReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on CreateRoleReq 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 CreateRoleReqMultiError, or
// nil if none found.
func (m *CreateRoleReq) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	if !_CreateRoleReq_Id_Pattern.MatchString(m.GetId()) {
		err := CreateRoleReqValidationError{
			field:  "Id",
			reason: "value does not match regex pattern \"^[a-z0-9-_]{1,64}$\"",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	// no validation rules for Name

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

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

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

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

		if !_CreateRoleReq_Actions_Pattern.MatchString(item) {
			err := CreateRoleReqValidationError{
				field:  fmt.Sprintf("Actions[%v]", idx),
				reason: "value does not match regex pattern \"^[*]$|^[*]:[a-z][-a-zA-Z]*$|^[a-z][a-zA-Z]*:[a-z][a-zA-Z]*:[a-z][a-zA-Z]*$|^[a-z][a-zA-Z]*:[*]$|^[a-z][a-zA-Z]*:[*]:[a-z][a-zA-Z]*$|^[a-z][a-zA-Z]*:[a-z][a-zA-Z]*:[*]$\"",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

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

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

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

		// no validation rules for Projects[idx]
	}

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m CreateRoleReqMultiError) 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 CreateRoleReqMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e CreateRoleReqValidationError) 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 %sCreateRoleReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = CreateRoleReqValidationError{}

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

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

var _CreateRoleReq_Actions_Pattern = regexp.MustCompile("^[*]$|^[*]:[a-z][-a-zA-Z]*$|^[a-z][a-zA-Z]*:[a-z][a-zA-Z]*:[a-z][a-zA-Z]*$|^[a-z][a-zA-Z]*:[*]$|^[a-z][a-zA-Z]*:[*]:[a-z][a-zA-Z]*$|^[a-z][a-zA-Z]*:[a-z][a-zA-Z]*:[*]$")

// Validate checks the field values on PurgeSubjectFromPoliciesReq 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 *PurgeSubjectFromPoliciesReq) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on PurgeSubjectFromPoliciesReq 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
// PurgeSubjectFromPoliciesReqMultiError, or nil if none found.
func (m *PurgeSubjectFromPoliciesReq) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	if !_PurgeSubjectFromPoliciesReq_Subject_Pattern.MatchString(m.GetSubject()) {
		err := PurgeSubjectFromPoliciesReqValidationError{
			field:  "Subject",
			reason: "value does not match regex pattern \"^(?:team|user):(?:local|ldap|saml):(?:[^:*]+|[*])$|^(?:(?:team|user|token|service):)?[*]$|^token:[^:*]+$|^tls:service:(?:[^:*]+:)?(?:[^:*]+|[*])$\"",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m PurgeSubjectFromPoliciesReqMultiError) 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 PurgeSubjectFromPoliciesReqMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e PurgeSubjectFromPoliciesReqValidationError) 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 %sPurgeSubjectFromPoliciesReq.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = PurgeSubjectFromPoliciesReqValidationError{}

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

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

// Validate checks the field values on PurgeSubjectFromPoliciesResp 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 *PurgeSubjectFromPoliciesResp) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on PurgeSubjectFromPoliciesResp 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
// PurgeSubjectFromPoliciesRespMultiError, or nil if none found.
func (m *PurgeSubjectFromPoliciesResp) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m PurgeSubjectFromPoliciesRespMultiError) 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 PurgeSubjectFromPoliciesRespMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e PurgeSubjectFromPoliciesRespValidationError) 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 %sPurgeSubjectFromPoliciesResp.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = PurgeSubjectFromPoliciesRespValidationError{}

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