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

package common

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

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

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

	var errors []error

	// no validation rules for Type

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

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

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

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

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

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

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

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = CloudStorageValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Uri

	// no validation rules for AuthType

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = GCSCloudStorageValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Uri

	// no validation rules for AuthType

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = AzureBlobCloudStorageValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Uri

	// no validation rules for AuthType

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

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

	case *S3CloudStorage_RoleArn:
		if v == nil {
			err := S3CloudStorageValidationError{
				field:  "Auth",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		// no validation rules for RoleArn
	default:
		_ = v // ensures v is used
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = S3CloudStorageValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Uri

	// no validation rules for AuthType

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

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

	case *OSSCloudStorage_RoleArn:
		if v == nil {
			err := OSSCloudStorageValidationError{
				field:  "Auth",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		// no validation rules for RoleArn
	default:
		_ = v // ensures v is used
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = OSSCloudStorageValidationError{}

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

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

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

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = CloudStorageTypeValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Id

	// no validation rules for Secret

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = S3CloudStorage_AccessKeyValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Id

	// no validation rules for Secret

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = OSSCloudStorage_AccessKeyValidationError{}

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