mirror of
https://github.com/trufflesecurity/trufflehog.git
synced 2024-11-15 01:17:34 +00:00
2978 lines
76 KiB
Go
2978 lines
76 KiB
Go
// Code generated by protoc-gen-validate. DO NOT EDIT.
|
|
// source: sources.proto
|
|
|
|
package sourcespb
|
|
|
|
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 AzureStorage 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 *AzureStorage) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on AzureStorage 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 AzureStorageMultiError, or
|
|
// nil if none found.
|
|
func (m *AzureStorage) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *AzureStorage) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch m.Credential.(type) {
|
|
|
|
case *AzureStorage_ConnectionString:
|
|
// no validation rules for ConnectionString
|
|
|
|
case *AzureStorage_BasicAuth:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetBasicAuth()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, AzureStorageValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, AzureStorageValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetBasicAuth()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return AzureStorageValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *AzureStorage_ClientCertificate:
|
|
// no validation rules for ClientCertificate
|
|
|
|
case *AzureStorage_Unauthenticated:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetUnauthenticated()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, AzureStorageValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, AzureStorageValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetUnauthenticated()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return AzureStorageValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return AzureStorageMultiError(errors)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// AzureStorageMultiError is an error wrapping multiple validation errors
|
|
// returned by AzureStorage.ValidateAll() if the designated constraints aren't met.
|
|
type AzureStorageMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m AzureStorageMultiError) 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 AzureStorageMultiError) AllErrors() []error { return m }
|
|
|
|
// AzureStorageValidationError is the validation error returned by
|
|
// AzureStorage.Validate if the designated constraints aren't met.
|
|
type AzureStorageValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e AzureStorageValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e AzureStorageValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e AzureStorageValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e AzureStorageValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e AzureStorageValidationError) ErrorName() string { return "AzureStorageValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e AzureStorageValidationError) 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 %sAzureStorage.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = AzureStorageValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = AzureStorageValidationError{}
|
|
|
|
// Validate checks the field values on Bitbucket 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 *Bitbucket) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on Bitbucket 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 BitbucketMultiError, or nil
|
|
// if none found.
|
|
func (m *Bitbucket) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *Bitbucket) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
if _, err := url.Parse(m.GetEndpoint()); err != nil {
|
|
err = BitbucketValidationError{
|
|
field: "Endpoint",
|
|
reason: "value must be a valid URI",
|
|
cause: err,
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
switch m.Credential.(type) {
|
|
|
|
case *Bitbucket_Token:
|
|
// no validation rules for Token
|
|
|
|
case *Bitbucket_Oauth:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetOauth()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, BitbucketValidationError{
|
|
field: "Oauth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, BitbucketValidationError{
|
|
field: "Oauth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetOauth()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return BitbucketValidationError{
|
|
field: "Oauth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *Bitbucket_BasicAuth:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetBasicAuth()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, BitbucketValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, BitbucketValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetBasicAuth()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return BitbucketValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return BitbucketMultiError(errors)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// BitbucketMultiError is an error wrapping multiple validation errors returned
|
|
// by Bitbucket.ValidateAll() if the designated constraints aren't met.
|
|
type BitbucketMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m BitbucketMultiError) 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 BitbucketMultiError) AllErrors() []error { return m }
|
|
|
|
// BitbucketValidationError is the validation error returned by
|
|
// Bitbucket.Validate if the designated constraints aren't met.
|
|
type BitbucketValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e BitbucketValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e BitbucketValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e BitbucketValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e BitbucketValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e BitbucketValidationError) ErrorName() string { return "BitbucketValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e BitbucketValidationError) 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 %sBitbucket.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = BitbucketValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = BitbucketValidationError{}
|
|
|
|
// Validate checks the field values on CircleCI 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 *CircleCI) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on CircleCI 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 CircleCIMultiError, or nil
|
|
// if none found.
|
|
func (m *CircleCI) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *CircleCI) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
if _, err := url.Parse(m.GetEndpoint()); err != nil {
|
|
err = CircleCIValidationError{
|
|
field: "Endpoint",
|
|
reason: "value must be a valid URI",
|
|
cause: err,
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
switch m.Credential.(type) {
|
|
|
|
case *CircleCI_Token:
|
|
// no validation rules for Token
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return CircleCIMultiError(errors)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// CircleCIMultiError is an error wrapping multiple validation errors returned
|
|
// by CircleCI.ValidateAll() if the designated constraints aren't met.
|
|
type CircleCIMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m CircleCIMultiError) 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 CircleCIMultiError) AllErrors() []error { return m }
|
|
|
|
// CircleCIValidationError is the validation error returned by
|
|
// CircleCI.Validate if the designated constraints aren't met.
|
|
type CircleCIValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e CircleCIValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e CircleCIValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e CircleCIValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e CircleCIValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e CircleCIValidationError) ErrorName() string { return "CircleCIValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e CircleCIValidationError) 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 %sCircleCI.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = CircleCIValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = CircleCIValidationError{}
|
|
|
|
// Validate checks the field values on Confluence 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 *Confluence) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on Confluence 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 ConfluenceMultiError, or
|
|
// nil if none found.
|
|
func (m *Confluence) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *Confluence) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
if _, err := url.Parse(m.GetEndpoint()); err != nil {
|
|
err = ConfluenceValidationError{
|
|
field: "Endpoint",
|
|
reason: "value must be a valid URI",
|
|
cause: err,
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
switch m.Credential.(type) {
|
|
|
|
case *Confluence_Unauthenticated:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetUnauthenticated()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, ConfluenceValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, ConfluenceValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetUnauthenticated()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return ConfluenceValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *Confluence_BasicAuth:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetBasicAuth()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, ConfluenceValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, ConfluenceValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetBasicAuth()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return ConfluenceValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *Confluence_Token:
|
|
// no validation rules for Token
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return ConfluenceMultiError(errors)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// ConfluenceMultiError is an error wrapping multiple validation errors
|
|
// returned by Confluence.ValidateAll() if the designated constraints aren't met.
|
|
type ConfluenceMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m ConfluenceMultiError) 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 ConfluenceMultiError) AllErrors() []error { return m }
|
|
|
|
// ConfluenceValidationError is the validation error returned by
|
|
// Confluence.Validate if the designated constraints aren't met.
|
|
type ConfluenceValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e ConfluenceValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e ConfluenceValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e ConfluenceValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e ConfluenceValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e ConfluenceValidationError) ErrorName() string { return "ConfluenceValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e ConfluenceValidationError) 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 %sConfluence.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = ConfluenceValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = ConfluenceValidationError{}
|
|
|
|
// Validate checks the field values on DockerHub 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 *DockerHub) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on DockerHub 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 DockerHubMultiError, or nil
|
|
// if none found.
|
|
func (m *DockerHub) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *DockerHub) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch m.Credential.(type) {
|
|
|
|
case *DockerHub_Unauthenticated:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetUnauthenticated()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, DockerHubValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, DockerHubValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetUnauthenticated()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return DockerHubValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return DockerHubMultiError(errors)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// DockerHubMultiError is an error wrapping multiple validation errors returned
|
|
// by DockerHub.ValidateAll() if the designated constraints aren't met.
|
|
type DockerHubMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m DockerHubMultiError) 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 DockerHubMultiError) AllErrors() []error { return m }
|
|
|
|
// DockerHubValidationError is the validation error returned by
|
|
// DockerHub.Validate if the designated constraints aren't met.
|
|
type DockerHubValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e DockerHubValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e DockerHubValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e DockerHubValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e DockerHubValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e DockerHubValidationError) ErrorName() string { return "DockerHubValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e DockerHubValidationError) 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 %sDockerHub.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = DockerHubValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = DockerHubValidationError{}
|
|
|
|
// Validate checks the field values on ECR 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 *ECR) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on ECR 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 ECRMultiError, or nil if none found.
|
|
func (m *ECR) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *ECR) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch m.Credential.(type) {
|
|
|
|
case *ECR_AccessKey:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetAccessKey()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, ECRValidationError{
|
|
field: "AccessKey",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, ECRValidationError{
|
|
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 ECRValidationError{
|
|
field: "AccessKey",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return ECRMultiError(errors)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// ECRMultiError is an error wrapping multiple validation errors returned by
|
|
// ECR.ValidateAll() if the designated constraints aren't met.
|
|
type ECRMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m ECRMultiError) 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 ECRMultiError) AllErrors() []error { return m }
|
|
|
|
// ECRValidationError is the validation error returned by ECR.Validate if the
|
|
// designated constraints aren't met.
|
|
type ECRValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e ECRValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e ECRValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e ECRValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e ECRValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e ECRValidationError) ErrorName() string { return "ECRValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e ECRValidationError) 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 %sECR.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = ECRValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = ECRValidationError{}
|
|
|
|
// Validate checks the field values on Filesystem 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 *Filesystem) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on Filesystem 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 FilesystemMultiError, or
|
|
// nil if none found.
|
|
func (m *Filesystem) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *Filesystem) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
if len(errors) > 0 {
|
|
return FilesystemMultiError(errors)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// FilesystemMultiError is an error wrapping multiple validation errors
|
|
// returned by Filesystem.ValidateAll() if the designated constraints aren't met.
|
|
type FilesystemMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m FilesystemMultiError) 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 FilesystemMultiError) AllErrors() []error { return m }
|
|
|
|
// FilesystemValidationError is the validation error returned by
|
|
// Filesystem.Validate if the designated constraints aren't met.
|
|
type FilesystemValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e FilesystemValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e FilesystemValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e FilesystemValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e FilesystemValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e FilesystemValidationError) ErrorName() string { return "FilesystemValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e FilesystemValidationError) 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 %sFilesystem.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = FilesystemValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = FilesystemValidationError{}
|
|
|
|
// Validate checks the field values on GCS 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 *GCS) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on GCS 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 GCSMultiError, or nil if none found.
|
|
func (m *GCS) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *GCS) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch m.Credential.(type) {
|
|
|
|
case *GCS_JsonSa:
|
|
// no validation rules for JsonSa
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return GCSMultiError(errors)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GCSMultiError is an error wrapping multiple validation errors returned by
|
|
// GCS.ValidateAll() if the designated constraints aren't met.
|
|
type GCSMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m GCSMultiError) 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 GCSMultiError) AllErrors() []error { return m }
|
|
|
|
// GCSValidationError is the validation error returned by GCS.Validate if the
|
|
// designated constraints aren't met.
|
|
type GCSValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e GCSValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e GCSValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e GCSValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e GCSValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e GCSValidationError) ErrorName() string { return "GCSValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e GCSValidationError) 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 %sGCS.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = GCSValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = GCSValidationError{}
|
|
|
|
// Validate checks the field values on Git 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 *Git) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on Git 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 GitMultiError, or nil if none found.
|
|
func (m *Git) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *Git) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch m.Credential.(type) {
|
|
|
|
case *Git_BasicAuth:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetBasicAuth()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, GitValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, GitValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetBasicAuth()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return GitValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *Git_Unauthenticated:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetUnauthenticated()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, GitValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, GitValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetUnauthenticated()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return GitValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return GitMultiError(errors)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GitMultiError is an error wrapping multiple validation errors returned by
|
|
// Git.ValidateAll() if the designated constraints aren't met.
|
|
type GitMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m GitMultiError) 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 GitMultiError) AllErrors() []error { return m }
|
|
|
|
// GitValidationError is the validation error returned by Git.Validate if the
|
|
// designated constraints aren't met.
|
|
type GitValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e GitValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e GitValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e GitValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e GitValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e GitValidationError) ErrorName() string { return "GitValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e GitValidationError) 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 %sGit.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = GitValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = GitValidationError{}
|
|
|
|
// Validate checks the field values on GitLab 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 *GitLab) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on GitLab 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 GitLabMultiError, or nil if none found.
|
|
func (m *GitLab) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *GitLab) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
if _, err := url.Parse(m.GetEndpoint()); err != nil {
|
|
err = GitLabValidationError{
|
|
field: "Endpoint",
|
|
reason: "value must be a valid URI",
|
|
cause: err,
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
switch m.Credential.(type) {
|
|
|
|
case *GitLab_Token:
|
|
// no validation rules for Token
|
|
|
|
case *GitLab_Oauth:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetOauth()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, GitLabValidationError{
|
|
field: "Oauth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, GitLabValidationError{
|
|
field: "Oauth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetOauth()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return GitLabValidationError{
|
|
field: "Oauth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *GitLab_BasicAuth:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetBasicAuth()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, GitLabValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, GitLabValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetBasicAuth()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return GitLabValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return GitLabMultiError(errors)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GitLabMultiError is an error wrapping multiple validation errors returned by
|
|
// GitLab.ValidateAll() if the designated constraints aren't met.
|
|
type GitLabMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m GitLabMultiError) 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 GitLabMultiError) AllErrors() []error { return m }
|
|
|
|
// GitLabValidationError is the validation error returned by GitLab.Validate if
|
|
// the designated constraints aren't met.
|
|
type GitLabValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e GitLabValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e GitLabValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e GitLabValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e GitLabValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e GitLabValidationError) ErrorName() string { return "GitLabValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e GitLabValidationError) 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 %sGitLab.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = GitLabValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = GitLabValidationError{}
|
|
|
|
// Validate checks the field values on GitHub 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 *GitHub) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on GitHub 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 GitHubMultiError, or nil if none found.
|
|
func (m *GitHub) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *GitHub) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
if _, err := url.Parse(m.GetEndpoint()); err != nil {
|
|
err = GitHubValidationError{
|
|
field: "Endpoint",
|
|
reason: "value must be a valid URI",
|
|
cause: err,
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
// no validation rules for ScanUsers
|
|
|
|
switch m.Credential.(type) {
|
|
|
|
case *GitHub_GithubApp:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetGithubApp()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, GitHubValidationError{
|
|
field: "GithubApp",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, GitHubValidationError{
|
|
field: "GithubApp",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetGithubApp()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return GitHubValidationError{
|
|
field: "GithubApp",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *GitHub_Token:
|
|
// no validation rules for Token
|
|
|
|
case *GitHub_Unauthenticated:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetUnauthenticated()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, GitHubValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, GitHubValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetUnauthenticated()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return GitHubValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return GitHubMultiError(errors)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GitHubMultiError is an error wrapping multiple validation errors returned by
|
|
// GitHub.ValidateAll() if the designated constraints aren't met.
|
|
type GitHubMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m GitHubMultiError) 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 GitHubMultiError) AllErrors() []error { return m }
|
|
|
|
// GitHubValidationError is the validation error returned by GitHub.Validate if
|
|
// the designated constraints aren't met.
|
|
type GitHubValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e GitHubValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e GitHubValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e GitHubValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e GitHubValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e GitHubValidationError) ErrorName() string { return "GitHubValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e GitHubValidationError) 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 %sGitHub.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = GitHubValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = GitHubValidationError{}
|
|
|
|
// Validate checks the field values on JIRA 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 *JIRA) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on JIRA 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 JIRAMultiError, or nil if none found.
|
|
func (m *JIRA) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *JIRA) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
if _, err := url.Parse(m.GetEndpoint()); err != nil {
|
|
err = JIRAValidationError{
|
|
field: "Endpoint",
|
|
reason: "value must be a valid URI",
|
|
cause: err,
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
switch m.Credential.(type) {
|
|
|
|
case *JIRA_BasicAuth:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetBasicAuth()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, JIRAValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, JIRAValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetBasicAuth()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return JIRAValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *JIRA_Unauthenticated:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetUnauthenticated()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, JIRAValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, JIRAValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetUnauthenticated()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return JIRAValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *JIRA_Oauth:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetOauth()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, JIRAValidationError{
|
|
field: "Oauth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, JIRAValidationError{
|
|
field: "Oauth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetOauth()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return JIRAValidationError{
|
|
field: "Oauth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return JIRAMultiError(errors)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// JIRAMultiError is an error wrapping multiple validation errors returned by
|
|
// JIRA.ValidateAll() if the designated constraints aren't met.
|
|
type JIRAMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m JIRAMultiError) 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 JIRAMultiError) AllErrors() []error { return m }
|
|
|
|
// JIRAValidationError is the validation error returned by JIRA.Validate if the
|
|
// designated constraints aren't met.
|
|
type JIRAValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e JIRAValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e JIRAValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e JIRAValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e JIRAValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e JIRAValidationError) ErrorName() string { return "JIRAValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e JIRAValidationError) 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 %sJIRA.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = JIRAValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = JIRAValidationError{}
|
|
|
|
// Validate checks the field values on NPMUnauthenticatedPackage 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 *NPMUnauthenticatedPackage) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on NPMUnauthenticatedPackage 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
|
|
// NPMUnauthenticatedPackageMultiError, or nil if none found.
|
|
func (m *NPMUnauthenticatedPackage) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *NPMUnauthenticatedPackage) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch m.Credential.(type) {
|
|
|
|
case *NPMUnauthenticatedPackage_Unauthenticated:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetUnauthenticated()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, NPMUnauthenticatedPackageValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, NPMUnauthenticatedPackageValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetUnauthenticated()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return NPMUnauthenticatedPackageValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return NPMUnauthenticatedPackageMultiError(errors)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// NPMUnauthenticatedPackageMultiError is an error wrapping multiple validation
|
|
// errors returned by NPMUnauthenticatedPackage.ValidateAll() if the
|
|
// designated constraints aren't met.
|
|
type NPMUnauthenticatedPackageMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m NPMUnauthenticatedPackageMultiError) 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 NPMUnauthenticatedPackageMultiError) AllErrors() []error { return m }
|
|
|
|
// NPMUnauthenticatedPackageValidationError is the validation error returned by
|
|
// NPMUnauthenticatedPackage.Validate if the designated constraints aren't met.
|
|
type NPMUnauthenticatedPackageValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e NPMUnauthenticatedPackageValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e NPMUnauthenticatedPackageValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e NPMUnauthenticatedPackageValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e NPMUnauthenticatedPackageValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e NPMUnauthenticatedPackageValidationError) ErrorName() string {
|
|
return "NPMUnauthenticatedPackageValidationError"
|
|
}
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e NPMUnauthenticatedPackageValidationError) 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 %sNPMUnauthenticatedPackage.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = NPMUnauthenticatedPackageValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = NPMUnauthenticatedPackageValidationError{}
|
|
|
|
// Validate checks the field values on PyPIUnauthenticatedPackage 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 *PyPIUnauthenticatedPackage) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on PyPIUnauthenticatedPackage 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
|
|
// PyPIUnauthenticatedPackageMultiError, or nil if none found.
|
|
func (m *PyPIUnauthenticatedPackage) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *PyPIUnauthenticatedPackage) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch m.Credential.(type) {
|
|
|
|
case *PyPIUnauthenticatedPackage_Unauthenticated:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetUnauthenticated()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, PyPIUnauthenticatedPackageValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, PyPIUnauthenticatedPackageValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetUnauthenticated()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return PyPIUnauthenticatedPackageValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return PyPIUnauthenticatedPackageMultiError(errors)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// PyPIUnauthenticatedPackageMultiError is an error wrapping multiple
|
|
// validation errors returned by PyPIUnauthenticatedPackage.ValidateAll() if
|
|
// the designated constraints aren't met.
|
|
type PyPIUnauthenticatedPackageMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m PyPIUnauthenticatedPackageMultiError) 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 PyPIUnauthenticatedPackageMultiError) AllErrors() []error { return m }
|
|
|
|
// PyPIUnauthenticatedPackageValidationError is the validation error returned
|
|
// by PyPIUnauthenticatedPackage.Validate if the designated constraints aren't met.
|
|
type PyPIUnauthenticatedPackageValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e PyPIUnauthenticatedPackageValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e PyPIUnauthenticatedPackageValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e PyPIUnauthenticatedPackageValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e PyPIUnauthenticatedPackageValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e PyPIUnauthenticatedPackageValidationError) ErrorName() string {
|
|
return "PyPIUnauthenticatedPackageValidationError"
|
|
}
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e PyPIUnauthenticatedPackageValidationError) 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 %sPyPIUnauthenticatedPackage.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = PyPIUnauthenticatedPackageValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = PyPIUnauthenticatedPackageValidationError{}
|
|
|
|
// Validate checks the field values on S3 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 *S3) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on S3 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 S3MultiError, or nil if none found.
|
|
func (m *S3) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *S3) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch m.Credential.(type) {
|
|
|
|
case *S3_AccessKey:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetAccessKey()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, S3ValidationError{
|
|
field: "AccessKey",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, S3ValidationError{
|
|
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 S3ValidationError{
|
|
field: "AccessKey",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *S3_Unauthenticated:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetUnauthenticated()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, S3ValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, S3ValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetUnauthenticated()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return S3ValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *S3_CloudEnvironment:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetCloudEnvironment()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, S3ValidationError{
|
|
field: "CloudEnvironment",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, S3ValidationError{
|
|
field: "CloudEnvironment",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetCloudEnvironment()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return S3ValidationError{
|
|
field: "CloudEnvironment",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return S3MultiError(errors)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// S3MultiError is an error wrapping multiple validation errors returned by
|
|
// S3.ValidateAll() if the designated constraints aren't met.
|
|
type S3MultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m S3MultiError) 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 S3MultiError) AllErrors() []error { return m }
|
|
|
|
// S3ValidationError is the validation error returned by S3.Validate if the
|
|
// designated constraints aren't met.
|
|
type S3ValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e S3ValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e S3ValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e S3ValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e S3ValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e S3ValidationError) ErrorName() string { return "S3ValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e S3ValidationError) 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 %sS3.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = S3ValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = S3ValidationError{}
|
|
|
|
// Validate checks the field values on Slack 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 *Slack) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on Slack 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 SlackMultiError, or nil if none found.
|
|
func (m *Slack) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *Slack) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
if _, err := url.Parse(m.GetEndpoint()); err != nil {
|
|
err = SlackValidationError{
|
|
field: "Endpoint",
|
|
reason: "value must be a valid URI",
|
|
cause: err,
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
switch m.Credential.(type) {
|
|
|
|
case *Slack_Token:
|
|
// no validation rules for Token
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return SlackMultiError(errors)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SlackMultiError is an error wrapping multiple validation errors returned by
|
|
// Slack.ValidateAll() if the designated constraints aren't met.
|
|
type SlackMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m SlackMultiError) 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 SlackMultiError) AllErrors() []error { return m }
|
|
|
|
// SlackValidationError is the validation error returned by Slack.Validate if
|
|
// the designated constraints aren't met.
|
|
type SlackValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e SlackValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e SlackValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e SlackValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e SlackValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e SlackValidationError) ErrorName() string { return "SlackValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e SlackValidationError) 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 %sSlack.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = SlackValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = SlackValidationError{}
|
|
|
|
// Validate checks the field values on Test 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 *Test) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on Test 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 TestMultiError, or nil if none found.
|
|
func (m *Test) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *Test) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
if len(errors) > 0 {
|
|
return TestMultiError(errors)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// TestMultiError is an error wrapping multiple validation errors returned by
|
|
// Test.ValidateAll() if the designated constraints aren't met.
|
|
type TestMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m TestMultiError) 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 TestMultiError) AllErrors() []error { return m }
|
|
|
|
// TestValidationError is the validation error returned by Test.Validate if the
|
|
// designated constraints aren't met.
|
|
type TestValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e TestValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e TestValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e TestValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e TestValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e TestValidationError) ErrorName() string { return "TestValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e TestValidationError) 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 %sTest.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = TestValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = TestValidationError{}
|
|
|
|
// Validate checks the field values on Buildkite 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 *Buildkite) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on Buildkite 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 BuildkiteMultiError, or nil
|
|
// if none found.
|
|
func (m *Buildkite) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *Buildkite) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch m.Credential.(type) {
|
|
|
|
case *Buildkite_Token:
|
|
// no validation rules for Token
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return BuildkiteMultiError(errors)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// BuildkiteMultiError is an error wrapping multiple validation errors returned
|
|
// by Buildkite.ValidateAll() if the designated constraints aren't met.
|
|
type BuildkiteMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m BuildkiteMultiError) 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 BuildkiteMultiError) AllErrors() []error { return m }
|
|
|
|
// BuildkiteValidationError is the validation error returned by
|
|
// Buildkite.Validate if the designated constraints aren't met.
|
|
type BuildkiteValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e BuildkiteValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e BuildkiteValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e BuildkiteValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e BuildkiteValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e BuildkiteValidationError) ErrorName() string { return "BuildkiteValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e BuildkiteValidationError) 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 %sBuildkite.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = BuildkiteValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = BuildkiteValidationError{}
|
|
|
|
// Validate checks the field values on Gerrit 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 *Gerrit) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on Gerrit 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 GerritMultiError, or nil if none found.
|
|
func (m *Gerrit) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *Gerrit) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
if _, err := url.Parse(m.GetEndpoint()); err != nil {
|
|
err = GerritValidationError{
|
|
field: "Endpoint",
|
|
reason: "value must be a valid URI",
|
|
cause: err,
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
switch m.Credential.(type) {
|
|
|
|
case *Gerrit_BasicAuth:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetBasicAuth()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, GerritValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, GerritValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetBasicAuth()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return GerritValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *Gerrit_Unauthenticated:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetUnauthenticated()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, GerritValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, GerritValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetUnauthenticated()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return GerritValidationError{
|
|
field: "Unauthenticated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return GerritMultiError(errors)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GerritMultiError is an error wrapping multiple validation errors returned by
|
|
// Gerrit.ValidateAll() if the designated constraints aren't met.
|
|
type GerritMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m GerritMultiError) 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 GerritMultiError) AllErrors() []error { return m }
|
|
|
|
// GerritValidationError is the validation error returned by Gerrit.Validate if
|
|
// the designated constraints aren't met.
|
|
type GerritValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e GerritValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e GerritValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e GerritValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e GerritValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e GerritValidationError) ErrorName() string { return "GerritValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e GerritValidationError) 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 %sGerrit.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = GerritValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = GerritValidationError{}
|
|
|
|
// Validate checks the field values on Jenkins 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 *Jenkins) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on Jenkins 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 JenkinsMultiError, or nil if none found.
|
|
func (m *Jenkins) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *Jenkins) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
if _, err := url.Parse(m.GetEndpoint()); err != nil {
|
|
err = JenkinsValidationError{
|
|
field: "Endpoint",
|
|
reason: "value must be a valid URI",
|
|
cause: err,
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
switch m.Credential.(type) {
|
|
|
|
case *Jenkins_BasicAuth:
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetBasicAuth()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, JenkinsValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, JenkinsValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetBasicAuth()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return JenkinsValidationError{
|
|
field: "BasicAuth",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return JenkinsMultiError(errors)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// JenkinsMultiError is an error wrapping multiple validation errors returned
|
|
// by Jenkins.ValidateAll() if the designated constraints aren't met.
|
|
type JenkinsMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m JenkinsMultiError) 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 JenkinsMultiError) AllErrors() []error { return m }
|
|
|
|
// JenkinsValidationError is the validation error returned by Jenkins.Validate
|
|
// if the designated constraints aren't met.
|
|
type JenkinsValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e JenkinsValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e JenkinsValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e JenkinsValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e JenkinsValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e JenkinsValidationError) ErrorName() string { return "JenkinsValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e JenkinsValidationError) 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 %sJenkins.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = JenkinsValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = JenkinsValidationError{}
|