// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: console/branch.proto

package console

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 ChangeBranchPasswordReq 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 *ChangeBranchPasswordReq) Validate() error {
	return m.validate(false)
}

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

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

	var errors []error

	// no validation rules for OrgId

	// no validation rules for ProjectId

	// no validation rules for ClusterId

	// no validation rules for BranchId

	// no validation rules for Password

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = ChangeBranchPasswordReqValidationError{}

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

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

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

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

	var errors []error

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = DefaultRespValidationError{}

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

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

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

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

	var errors []error

	if m.GetOrgId() <= 0 {
		err := CreateBranchReqValidationError{
			field:  "OrgId",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if m.GetProjectId() <= 0 {
		err := CreateBranchReqValidationError{
			field:  "ProjectId",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	// no validation rules for ClusterId

	// no validation rules for DisplayName

	// no validation rules for ParentId

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = CreateBranchReqValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Id

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = CreateBranchRespValidationError{}

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

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

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

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

	var errors []error

	if m.GetOrgId() <= 0 {
		err := GetBranchReqValidationError{
			field:  "OrgId",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if m.GetProjectId() <= 0 {
		err := GetBranchReqValidationError{
			field:  "ProjectId",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	// no validation rules for ClusterId

	// no validation rules for BranchId

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = GetBranchReqValidationError{}

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

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

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

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

	var errors []error

	if m.GetOrgId() <= 0 {
		err := DeleteBranchReqValidationError{
			field:  "OrgId",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if m.GetProjectId() <= 0 {
		err := DeleteBranchReqValidationError{
			field:  "ProjectId",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	// no validation rules for ClusterId

	// no validation rules for BranchId

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = DeleteBranchReqValidationError{}

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

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

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

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

	var errors []error

	if m.GetOrgId() <= 0 {
		err := ResetBranchReqValidationError{
			field:  "OrgId",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if m.GetProjectId() <= 0 {
		err := ResetBranchReqValidationError{
			field:  "ProjectId",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	// no validation rules for ClusterId

	// no validation rules for BranchId

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = ResetBranchReqValidationError{}

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

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

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

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

	var errors []error

	if m.GetOrgId() <= 0 {
		err := UpdateBranchReqValidationError{
			field:  "OrgId",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if m.GetProjectId() <= 0 {
		err := UpdateBranchReqValidationError{
			field:  "ProjectId",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	// no validation rules for ClusterId

	// no validation rules for BranchId

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = UpdateBranchReqValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Id

	// no validation rules for Name

	// no validation rules for DisplayName

	// no validation rules for ClusterId

	// no validation rules for ParentId

	// no validation rules for State

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

	// no validation rules for UserPrefix

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

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

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

	// no validation rules for Annotations

	// no validation rules for HasSetPwd

	// no validation rules for ParentDisplayName

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = BranchValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Id

	// no validation rules for Name

	// no validation rules for DisplayName

	// no validation rules for ClusterId

	// no validation rules for ParentId

	// no validation rules for State

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

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

	// no validation rules for UserPrefix

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

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

	// no validation rules for HasSetPwd

	// no validation rules for ParentDisplayName

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = BasicBranchValidationError{}

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

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

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

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

	var errors []error

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = EndpointsValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Host

	// no validation rules for Port

	// no validation rules for Disabled

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

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

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = PublicEndpointValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for DisplayName

	// no validation rules for StartIpAddress

	// no validation rules for EndIpAddress

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = AuthorizedNetworkValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Host

	// no validation rules for Port

	// no validation rules for Disabled

	switch v := m.Provider.(type) {
	case *PrivateEndpoint_Aws:
		if v == nil {
			err := PrivateEndpointValidationError{
				field:  "Provider",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

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

	case *PrivateEndpoint_Gcp:
		if v == nil {
			err := PrivateEndpointValidationError{
				field:  "Provider",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

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

	default:
		_ = v // ensures v is used
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = PrivateEndpointValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for ServiceMame

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = PrivateEndpointAwsValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for TargetServiceAttachment

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = PrivateEndpointGcpValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for RequestUnit

	// no validation rules for RowStorage

	// no validation rules for ColumnStorage

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = UsagesValidationError{}

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

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

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

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

	var errors []error

	if m.GetOrgId() <= 0 {
		err := ListBranchesReqValidationError{
			field:  "OrgId",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if m.GetProjectId() <= 0 {
		err := ListBranchesReqValidationError{
			field:  "ProjectId",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	// no validation rules for ClusterId

	if m.PageToken != nil {
		// no validation rules for PageToken
	}

	if m.PageSize != nil {
		// no validation rules for PageSize
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = ListBranchesReqValidationError{}

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

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

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

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

	var errors []error

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

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

	}

	// no validation rules for Total

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = ListBranchesRespValidationError{}

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

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

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

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

	var errors []error

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = DeleteBranchRespValidationError{}

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

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

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

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

	var errors []error

	if m.GetOrgId() <= 0 {
		err := BranchListDatabasesReqValidationError{
			field:  "OrgId",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if m.GetProjectId() <= 0 {
		err := BranchListDatabasesReqValidationError{
			field:  "ProjectId",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	// no validation rules for ClusterId

	// no validation rules for BranchId

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = BranchListDatabasesReqValidationError{}

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

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

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

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

	var errors []error

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = BranchListDatabasesRespValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for DisplayName

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = UpdateBranchReq_BranchValidationError{}

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