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

package v1beta

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

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

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

	var errors []error

	// no validation rules for ClusterId

	if l := utf8.RuneCountInString(m.GetDisplayName()); l < 1 || l > 64 {
		err := CreateBranchRequestValidationError{
			field:  "DisplayName",
			reason: "value length must be between 1 and 64 runes, inclusive",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = CreateBranchRequestValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for ClusterId

	// no validation rules for BranchId

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = GetBranchRequestValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for ClusterId

	// no validation rules for BranchId

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DeleteBranchRequestValidationError{}

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

// 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.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

	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.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,
			}
		}
	}

	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

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

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

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

	var errors []error

	// 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 ListBranchesRequestMultiError(errors)
	}

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ListBranchesRequestValidationError{}

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

// 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 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{}
