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

package dataflow

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

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

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

	var errors []error

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

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

	if !_CreateConnProfileReq_Name_Pattern.MatchString(m.GetName()) {
		err := CreateConnProfileReqValidationError{
			field:  "Name",
			reason: "value does not match regex pattern \"^[A-Za-z][\\\\w-]{0,59}$\"",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if _, ok := _CreateConnProfileReq_Type_InLookup[m.GetType()]; !ok {
		err := CreateConnProfileReqValidationError{
			field:  "Type",
			reason: "value must be in list [mysql aws-aurora-mysql aws-rds-mysql google-cloud-mysql azure-flexible-mysql]",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if utf8.RuneCountInString(m.GetRegion()) > 64 {
		err := CreateConnProfileReqValidationError{
			field:  "Region",
			reason: "value length must be at most 64 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if _, ok := _CreateConnProfileReq_ConnMethod_InLookup[m.GetConnMethod()]; !ok {
		err := CreateConnProfileReqValidationError{
			field:  "ConnMethod",
			reason: "value must be in list [direct vpc-peering private-link]",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

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

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

	// no validation rules for SslCa

	// no validation rules for SslCert

	// no validation rules for SslKey

	// no validation rules for OrgId

	if m.EndpointServiceName != nil {

		if utf8.RuneCountInString(m.GetEndpointServiceName()) > 512 {
			err := CreateConnProfileReqValidationError{
				field:  "EndpointServiceName",
				reason: "value length must be at most 512 runes",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

		if !_CreateConnProfileReq_EndpointServiceName_Pattern.MatchString(m.GetEndpointServiceName()) {
			err := CreateConnProfileReqValidationError{
				field:  "EndpointServiceName",
				reason: "value does not match regex pattern \"^(com.amazonaws.vpce|/subscriptions/).*$\"",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

	if m.Host != nil {

		if utf8.RuneCountInString(m.GetHost()) > 256 {
			err := CreateConnProfileReqValidationError{
				field:  "Host",
				reason: "value length must be at most 256 runes",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

		if err := m._validateHostname(m.GetHost()); err != nil {
			if ip := net.ParseIP(m.GetHost()); ip == nil {
				err := CreateConnProfileReqValidationError{
					field:  "Host",
					reason: "value must be a valid hostname, or ip address",
				}
				if !all {
					return err
				}
				errors = append(errors, err)
			}
		}

	}

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

	return nil
}

func (m *CreateConnProfileReq) _validateHostname(host string) error {
	s := strings.ToLower(strings.TrimSuffix(host, "."))

	if len(host) > 253 {
		return errors.New("hostname cannot exceed 253 characters")
	}

	for _, part := range strings.Split(s, ".") {
		if l := len(part); l == 0 || l > 63 {
			return errors.New("hostname part must be non-empty and cannot exceed 63 characters")
		}

		if part[0] == '-' {
			return errors.New("hostname parts cannot begin with hyphens")
		}

		if part[len(part)-1] == '-' {
			return errors.New("hostname parts cannot end with hyphens")
		}

		for _, r := range part {
			if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' {
				return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r))
			}
		}
	}

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = CreateConnProfileReqValidationError{}

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

var _CreateConnProfileReq_Name_Pattern = regexp.MustCompile("^[A-Za-z][\\w-]{0,59}$")

var _CreateConnProfileReq_Type_InLookup = map[string]struct{}{
	"mysql":                {},
	"aws-aurora-mysql":     {},
	"aws-rds-mysql":        {},
	"google-cloud-mysql":   {},
	"azure-flexible-mysql": {},
}

var _CreateConnProfileReq_ConnMethod_InLookup = map[string]struct{}{
	"direct":       {},
	"vpc-peering":  {},
	"private-link": {},
}

var _CreateConnProfileReq_EndpointServiceName_Pattern = regexp.MustCompile("^(com.amazonaws.vpce|/subscriptions/).*$")

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

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

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

	var errors []error

	// no validation rules for Id

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = CreateConnProfileRespValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for ProjectId

	// no validation rules for ClusterId

	// no validation rules for OrgId

	if _, ok := _GetIPWhiteListReq_ConnMethod_InLookup[m.GetConnMethod()]; !ok {
		err := GetIPWhiteListReqValidationError{
			field:  "ConnMethod",
			reason: "value must be in list [direct vpc-peering]",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = GetIPWhiteListReqValidationError{}

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

var _GetIPWhiteListReq_ConnMethod_InLookup = map[string]struct{}{
	"direct":      {},
	"vpc-peering": {},
}

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

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

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = GetIPWhiteListRespValidationError{}

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

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

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

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

	var errors []error

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

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

	if utf8.RuneCountInString(m.GetEndpointServiceName()) > 512 {
		err := CreatePrivateLinkEndpointReqValidationError{
			field:  "EndpointServiceName",
			reason: "value length must be at most 512 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if !_CreatePrivateLinkEndpointReq_EndpointServiceName_Pattern.MatchString(m.GetEndpointServiceName()) {
		err := CreatePrivateLinkEndpointReqValidationError{
			field:  "EndpointServiceName",
			reason: "value does not match regex pattern \"^(com.amazonaws.vpce|/subscriptions/).*$\"",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	// no validation rules for OrgId

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = CreatePrivateLinkEndpointReqValidationError{}

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

var _CreatePrivateLinkEndpointReq_EndpointServiceName_Pattern = regexp.MustCompile("^(com.amazonaws.vpce|/subscriptions/).*$")

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

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

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

	var errors []error

	// no validation rules for Id

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = CreatePrivateLinkEndpointRespValidationError{}

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

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

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

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

	var errors []error

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

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

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

	// no validation rules for OrgId

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = GetPrivateLinkEndpointReqValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Phase

	// no validation rules for Message

	// no validation rules for EndpointId

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = GetPrivateLinkEndpointRespValidationError{}

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

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

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

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

	var errors []error

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

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

	if _, ok := _ValidateRemoteDBConnectivityReq_ConnMethod_InLookup[m.GetConnMethod()]; !ok {
		err := ValidateRemoteDBConnectivityReqValidationError{
			field:  "ConnMethod",
			reason: "value must be in list [direct vpc-peering private-link]",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

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

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

	// no validation rules for SslCa

	// no validation rules for SslCert

	// no validation rules for SslKey

	if _, ok := _ValidateRemoteDBConnectivityReq_Type_InLookup[m.GetType()]; !ok {
		err := ValidateRemoteDBConnectivityReqValidationError{
			field:  "Type",
			reason: "value must be in list [mysql aws-aurora-mysql aws-rds-mysql google-cloud-mysql azure-flexible-mysql]",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	// no validation rules for OrgId

	if m.EndpointServiceName != nil {

		if utf8.RuneCountInString(m.GetEndpointServiceName()) > 512 {
			err := ValidateRemoteDBConnectivityReqValidationError{
				field:  "EndpointServiceName",
				reason: "value length must be at most 512 runes",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

		if !_ValidateRemoteDBConnectivityReq_EndpointServiceName_Pattern.MatchString(m.GetEndpointServiceName()) {
			err := ValidateRemoteDBConnectivityReqValidationError{
				field:  "EndpointServiceName",
				reason: "value does not match regex pattern \"^(com.amazonaws.vpce|/subscriptions/).*$\"",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

	if m.Host != nil {

		if utf8.RuneCountInString(m.GetHost()) > 256 {
			err := ValidateRemoteDBConnectivityReqValidationError{
				field:  "Host",
				reason: "value length must be at most 256 runes",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

		if err := m._validateHostname(m.GetHost()); err != nil {
			if ip := net.ParseIP(m.GetHost()); ip == nil {
				err := ValidateRemoteDBConnectivityReqValidationError{
					field:  "Host",
					reason: "value must be a valid hostname, or ip address",
				}
				if !all {
					return err
				}
				errors = append(errors, err)
			}
		}

	}

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

	return nil
}

func (m *ValidateRemoteDBConnectivityReq) _validateHostname(host string) error {
	s := strings.ToLower(strings.TrimSuffix(host, "."))

	if len(host) > 253 {
		return errors.New("hostname cannot exceed 253 characters")
	}

	for _, part := range strings.Split(s, ".") {
		if l := len(part); l == 0 || l > 63 {
			return errors.New("hostname part must be non-empty and cannot exceed 63 characters")
		}

		if part[0] == '-' {
			return errors.New("hostname parts cannot begin with hyphens")
		}

		if part[len(part)-1] == '-' {
			return errors.New("hostname parts cannot end with hyphens")
		}

		for _, r := range part {
			if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' {
				return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r))
			}
		}
	}

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ValidateRemoteDBConnectivityReqValidationError{}

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

var _ValidateRemoteDBConnectivityReq_ConnMethod_InLookup = map[string]struct{}{
	"direct":       {},
	"vpc-peering":  {},
	"private-link": {},
}

var _ValidateRemoteDBConnectivityReq_EndpointServiceName_Pattern = regexp.MustCompile("^(com.amazonaws.vpce|/subscriptions/).*$")

var _ValidateRemoteDBConnectivityReq_Type_InLookup = map[string]struct{}{
	"mysql":                {},
	"aws-aurora-mysql":     {},
	"aws-rds-mysql":        {},
	"google-cloud-mysql":   {},
	"azure-flexible-mysql": {},
}

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

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

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

	var errors []error

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

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

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

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

	// no validation rules for OrgId

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ValidateClusterConnectivityReqValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for DbVersion

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ValidateRemoteDBConnectivityRespValidationError{}

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

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

	// no validation rules for Name

	// no validation rules for Type

	// no validation rules for Version

	// no validation rules for Region

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

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

	if _, ok := _ConnProfile_ConnMethod_InLookup[m.GetConnMethod()]; !ok {
		err := ConnProfileValidationError{
			field:  "ConnMethod",
			reason: "value must be in list [direct vpc-peering private-link]",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	// no validation rules for SslCa

	// no validation rules for SslCert

	// no validation rules for SslKey

	if m.Host != nil {

		if utf8.RuneCountInString(m.GetHost()) > 256 {
			err := ConnProfileValidationError{
				field:  "Host",
				reason: "value length must be at most 256 runes",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

		if err := m._validateHostname(m.GetHost()); err != nil {
			if ip := net.ParseIP(m.GetHost()); ip == nil {
				err := ConnProfileValidationError{
					field:  "Host",
					reason: "value must be a valid hostname, or ip address",
				}
				if !all {
					return err
				}
				errors = append(errors, err)
			}
		}

	}

	if m.EndpointServiceName != nil {

		if utf8.RuneCountInString(m.GetEndpointServiceName()) > 512 {
			err := ConnProfileValidationError{
				field:  "EndpointServiceName",
				reason: "value length must be at most 512 runes",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

		if !_ConnProfile_EndpointServiceName_Pattern.MatchString(m.GetEndpointServiceName()) {
			err := ConnProfileValidationError{
				field:  "EndpointServiceName",
				reason: "value does not match regex pattern \"^(com.amazonaws.vpce|/subscriptions/).*$\"",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

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

	return nil
}

func (m *ConnProfile) _validateHostname(host string) error {
	s := strings.ToLower(strings.TrimSuffix(host, "."))

	if len(host) > 253 {
		return errors.New("hostname cannot exceed 253 characters")
	}

	for _, part := range strings.Split(s, ".") {
		if l := len(part); l == 0 || l > 63 {
			return errors.New("hostname part must be non-empty and cannot exceed 63 characters")
		}

		if part[0] == '-' {
			return errors.New("hostname parts cannot begin with hyphens")
		}

		if part[len(part)-1] == '-' {
			return errors.New("hostname parts cannot end with hyphens")
		}

		for _, r := range part {
			if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' {
				return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r))
			}
		}
	}

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

var _ConnProfile_ConnMethod_InLookup = map[string]struct{}{
	"direct":       {},
	"vpc-peering":  {},
	"private-link": {},
}

var _ConnProfile_EndpointServiceName_Pattern = regexp.MustCompile("^(com.amazonaws.vpce|/subscriptions/).*$")
