// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: v1beta1/dm.proto

package v1beta1

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

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

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

	var errors []error

	// no validation rules for ClusterId

	// no validation rules for PrecheckId

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = GetMigrationPrecheckReqValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for ClusterId

	// no validation rules for PrecheckId

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = CancelMigrationPrecheckReqValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for PrecheckId

	// no validation rules for Total

	// no validation rules for FailedCnt

	// no validation rules for WarnCnt

	// no validation rules for SuccessCnt

	// no validation rules for Status

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

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

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = MigrationPrecheckValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for PrecheckId

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = CreateMigrationPrecheckRespValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Description

	// no validation rules for Status

	// no validation rules for Solution

	// no validation rules for Reason

	// no validation rules for SolutionDocUrl

	// no validation rules for Type

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = PrecheckItemValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for ClusterId

	// no validation rules for DisplayName

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

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

	}

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

	// no validation rules for Mode

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = CreateMigrationReqValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for User

	// no validation rules for Password

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = TargetValidationError{}

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

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

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

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

	var errors []error

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = MigrationRuleValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for MigrationId

	// no validation rules for DisplayName

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

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

	}

	// no validation rules for TargetUser

	if all {
		switch v := interface{}(m.GetCreateTime()).(type) {
		case interface{ ValidateAll() error }:
			if err := v.ValidateAll(); err != nil {
				errors = append(errors, MigrationValidationError{
					field:  "CreateTime",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		case interface{ Validate() error }:
			if err := v.Validate(); err != nil {
				errors = append(errors, MigrationValidationError{
					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 MigrationValidationError{
				field:  "CreateTime",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

	// no validation rules for Mode

	// no validation rules for State

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = MigrationValidationError{}

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

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

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

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

	var errors []error

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

	// no validation rules for CurrentStep

	// no validation rules for Stage

	if m.DumpDetail != nil {

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

	}

	if m.LoadDetail != nil {

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

	}

	if m.SyncDetail != nil {

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

	}

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = SubTaskValidationError{}

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

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

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

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

	var errors []error

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

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

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

	}

	// no validation rules for SourceType

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

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = SourceValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Bps

	// no validation rules for Progress

	// no validation rules for TotalTables

	// no validation rules for CompletedTables

	// no validation rules for FinishedBytes

	// no validation rules for FinishedRows

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DumpDetailValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Bps

	// no validation rules for Progress

	// no validation rules for FinishedBytes

	// no validation rules for TotalBytes

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = LoadDetailValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Rps

	// no validation rules for Latency

	// no validation rules for Checkpoint

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = SyncDetailValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for ConnType

	// no validation rules for Port

	// no validation rules for User

	// no validation rules for Password

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

	switch v := m.Endpoint.(type) {
	case *ConnProfile_EndpointId:
		if v == nil {
			err := ConnProfileValidationError{
				field:  "Endpoint",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		// no validation rules for EndpointId
	case *ConnProfile_Host:
		if v == nil {
			err := ConnProfileValidationError{
				field:  "Endpoint",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		// no validation rules for Host
	default:
		_ = v // ensures v is used
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ConnProfileValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for SslCaContent

	// no validation rules for SslCertContent

	// no validation rules for SslKeyContent

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = SecurityValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for ClusterId

	// no validation rules for MigrationId

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = GetMigrationReqValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for ClusterId

	// no validation rules for PageToken

	// no validation rules for PageSize

	// no validation rules for OrderBy

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ListMigrationsReqValidationError{}

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

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

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

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

	var errors []error

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

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

	}

	// no validation rules for TotalSize

	// no validation rules for NextPageToken

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ListMigrationsRespValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for ClusterId

	// no validation rules for MigrationId

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DeleteMigrationReqValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for ClusterId

	// no validation rules for MigrationId

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = PauseMigrationReqValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for ClusterId

	// no validation rules for MigrationId

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ResumeMigrationReqValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for SchemaPattern

	// no validation rules for TablePattern

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = MigrationRule_SourceValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Schema

	// no validation rules for Table

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = MigrationRule_TableValidationError{}

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