diff --git a/.gitignore b/.gitignore index a0f304c9..8e3458a8 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,6 @@ bin/air tmp dist/ siren -!siren/ \ No newline at end of file +!siren/ + +third_party/ \ No newline at end of file diff --git a/Makefile b/Makefile index b60e94fd..dc13a49b 100644 --- a/Makefile +++ b/Makefile @@ -1,36 +1,45 @@ NAME="github.com/odpf/siren" -VERSION=$(shell git describe --always --tags 2>/dev/null) -COVERFILE="/tmp/siren.coverprofile" +LAST_COMMIT := $(shell git rev-parse --short HEAD) +LAST_TAG := "$(shell git rev-list --tags --max-count=1)" +APP_VERSION := "$(shell git describe --tags ${LAST_TAG})-next" +PROTON_COMMIT := "ef83b9e9248e064a1c366da4fe07b3068266fe59" -.PHONY: all build clean +.PHONY: all build test clean dist vet proto install all: build -build: - go build -ldflags "-X main.Version=${VERSION}" ${NAME} +build: ## Build the siren binary + @echo " > building siren version ${APP_VERSION}" + go build -ldflags "-X main.Version=${APP_VERSION}" ${NAME} + @echo " - build complete" -clean: - rm -rf siren dist/ - -test: +test: ## Run the tests go test ./... -coverprofile=coverage.out -test-coverage: test - go tool cover -html=coverage.out - -dist: - @bash ./scripts/build.sh - -check-swagger: - which swagger || (GO111MODULE=off go get -u github.com/go-swagger/go-swagger/cmd/swagger) - -swagger: check-swagger - GO111MODULE=on go mod vendor && swagger generate spec -o ./api/handlers/swagger.yaml --scan-models +coverage: ## Print code coverage + go test -race -coverprofile coverage.txt -covermode=atomic ./... & go tool cover -html=coverage.out -swagger-serve: check-swagger - swagger serve -F=swagger api/handlers/swagger.yaml - -generate-proto: ## regenerate protos +proto: ## Generate the protobuf files @echo " > generating protobuf from odpf/proton" - @buf generate --template buf.gen.yaml https://github.com/odpf/proton.git --path odpf/siren + @echo " > [info] make sure correct version of dependencies are installed using 'make install'" + @buf generate https://github.com/odpf/proton/archive/${PROTON_COMMIT}.zip#strip_components=1 --template buf.gen.yaml --path odpf/siren @echo " > protobuf compilation finished" + +clean: ## Clean the build artifacts + rm -rf siren dist/ + +install: ## install required dependencies + @echo "> installing dependencies" + go mod tidy + go get -d google.golang.org/protobuf/cmd/protoc-gen-go@v1.27.1 + go get github.com/golang/protobuf/proto@v1.5.2 + go get -d github.com/golang/protobuf/protoc-gen-go@v1.5.2 + go get google.golang.org/grpc@v1.40.0 + go get -d google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1.0 + go get -d github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@v2.5.0 + go get -d github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@v2.5.0 + go get -d github.com/bufbuild/buf/cmd/buf@v0.54.1 + go get github.com/envoyproxy/protoc-gen-validate + +help: ## Display this help message + @cat $(MAKEFILE_LIST) | grep -e "^[a-zA-Z_\-]*: *.*## *" | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' \ No newline at end of file diff --git a/api/proto/odpf/siren/v1beta1/siren.pb.go b/api/proto/odpf/siren/v1beta1/siren.pb.go index 76107c8c..3f0b0aff 100644 --- a/api/proto/odpf/siren/v1beta1/siren.pb.go +++ b/api/proto/odpf/siren/v1beta1/siren.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc (unknown) // source: odpf/siren/v1beta1/siren.proto package sirenv1beta1 diff --git a/api/proto/odpf/siren/v1beta1/siren.pb.validate.go b/api/proto/odpf/siren/v1beta1/siren.pb.validate.go index e762769a..93b191c0 100644 --- a/api/proto/odpf/siren/v1beta1/siren.pb.validate.go +++ b/api/proto/odpf/siren/v1beta1/siren.pb.validate.go @@ -11,6 +11,7 @@ import ( "net/mail" "net/url" "regexp" + "sort" "strings" "time" "unicode/utf8" @@ -31,19 +32,53 @@ var ( _ = (*url.URL)(nil) _ = (*mail.Address)(nil) _ = anypb.Any{} + _ = sort.Sort ) // Validate checks the field values on PingRequest with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. +// 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 *PingRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on PingRequest 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 PingRequestMultiError, or +// nil if none found. +func (m *PingRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *PingRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + + if len(errors) > 0 { + return PingRequestMultiError(errors) + } return nil } +// PingRequestMultiError is an error wrapping multiple validation errors +// returned by PingRequest.ValidateAll() if the designated constraints aren't met. +type PingRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m PingRequestMultiError) 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 PingRequestMultiError) AllErrors() []error { return m } + // PingRequestValidationError is the validation error returned by // PingRequest.Validate if the designated constraints aren't met. type PingRequestValidationError struct { @@ -99,18 +134,51 @@ var _ interface { } = PingRequestValidationError{} // Validate checks the field values on PingResponse with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. +// 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 *PingResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on PingResponse 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 PingResponseMultiError, or +// nil if none found. +func (m *PingResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *PingResponse) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Message + if len(errors) > 0 { + return PingResponseMultiError(errors) + } return nil } +// PingResponseMultiError is an error wrapping multiple validation errors +// returned by PingResponse.ValidateAll() if the designated constraints aren't met. +type PingResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m PingResponseMultiError) 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 PingResponseMultiError) AllErrors() []error { return m } + // PingResponseValidationError is the validation error returned by // PingResponse.Validate if the designated constraints aren't met. type PingResponseValidationError struct { @@ -166,12 +234,27 @@ var _ interface { } = PingResponseValidationError{} // Validate checks the field values on Provider with the rules defined in the -// proto definition for this message. If any rules are violated, an error is returned. +// 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 *Provider) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Provider 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 ProviderMultiError, or nil +// if none found. +func (m *Provider) ValidateAll() error { + return m.validate(true) +} + +func (m *Provider) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id // no validation rules for Host @@ -181,13 +264,36 @@ func (m *Provider) Validate() error { // no validation rules for Name if _, ok := _Provider_Type_InLookup[m.GetType()]; !ok { - return ProviderValidationError{ + err := ProviderValidationError{ field: "Type", reason: "value must be in list [cortex]", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(m.GetCredentials()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetCredentials()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ProviderValidationError{ + field: "Credentials", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ProviderValidationError{ + field: "Credentials", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCredentials()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ProviderValidationError{ field: "Credentials", @@ -199,7 +305,26 @@ func (m *Provider) Validate() error { // no validation rules for Labels - if v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetCreatedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ProviderValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ProviderValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ProviderValidationError{ field: "CreatedAt", @@ -209,7 +334,26 @@ func (m *Provider) Validate() error { } } - if v, ok := interface{}(m.GetUpdatedAt()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetUpdatedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ProviderValidationError{ + field: "UpdatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ProviderValidationError{ + field: "UpdatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUpdatedAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ProviderValidationError{ field: "UpdatedAt", @@ -219,9 +363,28 @@ func (m *Provider) Validate() error { } } + if len(errors) > 0 { + return ProviderMultiError(errors) + } return nil } +// ProviderMultiError is an error wrapping multiple validation errors returned +// by Provider.ValidateAll() if the designated constraints aren't met. +type ProviderMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ProviderMultiError) 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 ProviderMultiError) AllErrors() []error { return m } + // ProviderValidationError is the validation error returned by // Provider.Validate if the designated constraints aren't met. type ProviderValidationError struct { @@ -282,19 +445,53 @@ var _Provider_Type_InLookup = map[string]struct{}{ // Validate checks the field values on ListProvidersRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *ListProvidersRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListProvidersRequest 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 +// ListProvidersRequestMultiError, or nil if none found. +func (m *ListProvidersRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *ListProvidersRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Urn // no validation rules for Type + if len(errors) > 0 { + return ListProvidersRequestMultiError(errors) + } return nil } +// ListProvidersRequestMultiError is an error wrapping multiple validation +// errors returned by ListProvidersRequest.ValidateAll() if the designated +// constraints aren't met. +type ListProvidersRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListProvidersRequestMultiError) 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 ListProvidersRequestMultiError) AllErrors() []error { return m } + // ListProvidersRequestValidationError is the validation error returned by // ListProvidersRequest.Validate if the designated constraints aren't met. type ListProvidersRequestValidationError struct { @@ -353,16 +550,49 @@ var _ interface { // Validate checks the field values on ListProvidersResponse with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *ListProvidersResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListProvidersResponse 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 +// ListProvidersResponseMultiError, or nil if none found. +func (m *ListProvidersResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *ListProvidersResponse) validate(all bool) error { if m == nil { return nil } + var errors []error + for idx, item := range m.GetProviders() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ListProvidersResponseValidationError{ + field: fmt.Sprintf("Providers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ListProvidersResponseValidationError{ + field: fmt.Sprintf("Providers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ListProvidersResponseValidationError{ field: fmt.Sprintf("Providers[%v]", idx), @@ -374,9 +604,29 @@ func (m *ListProvidersResponse) Validate() error { } + if len(errors) > 0 { + return ListProvidersResponseMultiError(errors) + } return nil } +// ListProvidersResponseMultiError is an error wrapping multiple validation +// errors returned by ListProvidersResponse.ValidateAll() if the designated +// constraints aren't met. +type ListProvidersResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListProvidersResponseMultiError) 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 ListProvidersResponseMultiError) AllErrors() []error { return m } + // ListProvidersResponseValidationError is the validation error returned by // ListProvidersResponse.Validate if the designated constraints aren't met. type ListProvidersResponseValidationError struct { @@ -435,47 +685,100 @@ var _ interface { // Validate checks the field values on CreateProviderRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *CreateProviderRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CreateProviderRequest 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 +// CreateProviderRequestMultiError, or nil if none found. +func (m *CreateProviderRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *CreateProviderRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + if uri, err := url.Parse(m.GetHost()); err != nil { - return CreateProviderRequestValidationError{ + err = CreateProviderRequestValidationError{ field: "Host", reason: "value must be a valid URI", cause: err, } + if !all { + return err + } + errors = append(errors, err) } else if !uri.IsAbs() { - return CreateProviderRequestValidationError{ + err := CreateProviderRequestValidationError{ field: "Host", reason: "value must be absolute", } + if !all { + return err + } + errors = append(errors, err) } if !_CreateProviderRequest_Urn_Pattern.MatchString(m.GetUrn()) { - return CreateProviderRequestValidationError{ + err := CreateProviderRequestValidationError{ field: "Urn", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } if !_CreateProviderRequest_Name_Pattern.MatchString(m.GetName()) { - return CreateProviderRequestValidationError{ + err := CreateProviderRequestValidationError{ field: "Name", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } if _, ok := _CreateProviderRequest_Type_InLookup[m.GetType()]; !ok { - return CreateProviderRequestValidationError{ + err := CreateProviderRequestValidationError{ field: "Type", reason: "value must be in list [cortex]", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(m.GetCredentials()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetCredentials()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CreateProviderRequestValidationError{ + field: "Credentials", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CreateProviderRequestValidationError{ + field: "Credentials", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCredentials()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return CreateProviderRequestValidationError{ field: "Credentials", @@ -487,9 +790,29 @@ func (m *CreateProviderRequest) Validate() error { // no validation rules for Labels + if len(errors) > 0 { + return CreateProviderRequestMultiError(errors) + } return nil } +// CreateProviderRequestMultiError is an error wrapping multiple validation +// errors returned by CreateProviderRequest.ValidateAll() if the designated +// constraints aren't met. +type CreateProviderRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CreateProviderRequestMultiError) 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 CreateProviderRequestMultiError) AllErrors() []error { return m } + // CreateProviderRequestValidationError is the validation error returned by // CreateProviderRequest.Validate if the designated constraints aren't met. type CreateProviderRequestValidationError struct { @@ -556,17 +879,51 @@ var _CreateProviderRequest_Type_InLookup = map[string]struct{}{ // Validate checks the field values on GetProviderRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *GetProviderRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GetProviderRequest 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 +// GetProviderRequestMultiError, or nil if none found. +func (m *GetProviderRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *GetProviderRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id + if len(errors) > 0 { + return GetProviderRequestMultiError(errors) + } return nil } +// GetProviderRequestMultiError is an error wrapping multiple validation errors +// returned by GetProviderRequest.ValidateAll() if the designated constraints +// aren't met. +type GetProviderRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GetProviderRequestMultiError) 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 GetProviderRequestMultiError) AllErrors() []error { return m } + // GetProviderRequestValidationError is the validation error returned by // GetProviderRequest.Validate if the designated constraints aren't met. type GetProviderRequestValidationError struct { @@ -625,42 +982,91 @@ var _ interface { // Validate checks the field values on UpdateProviderRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *UpdateProviderRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on UpdateProviderRequest 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 +// UpdateProviderRequestMultiError, or nil if none found. +func (m *UpdateProviderRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *UpdateProviderRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id if uri, err := url.Parse(m.GetHost()); err != nil { - return UpdateProviderRequestValidationError{ + err = UpdateProviderRequestValidationError{ field: "Host", reason: "value must be a valid URI", cause: err, } + if !all { + return err + } + errors = append(errors, err) } else if !uri.IsAbs() { - return UpdateProviderRequestValidationError{ + err := UpdateProviderRequestValidationError{ field: "Host", reason: "value must be absolute", } + if !all { + return err + } + errors = append(errors, err) } if !_UpdateProviderRequest_Name_Pattern.MatchString(m.GetName()) { - return UpdateProviderRequestValidationError{ + err := UpdateProviderRequestValidationError{ field: "Name", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } if _, ok := _UpdateProviderRequest_Type_InLookup[m.GetType()]; !ok { - return UpdateProviderRequestValidationError{ + err := UpdateProviderRequestValidationError{ field: "Type", reason: "value must be in list [cortex]", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(m.GetCredentials()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetCredentials()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, UpdateProviderRequestValidationError{ + field: "Credentials", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, UpdateProviderRequestValidationError{ + field: "Credentials", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCredentials()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return UpdateProviderRequestValidationError{ field: "Credentials", @@ -672,9 +1078,29 @@ func (m *UpdateProviderRequest) Validate() error { // no validation rules for Labels + if len(errors) > 0 { + return UpdateProviderRequestMultiError(errors) + } return nil } +// UpdateProviderRequestMultiError is an error wrapping multiple validation +// errors returned by UpdateProviderRequest.ValidateAll() if the designated +// constraints aren't met. +type UpdateProviderRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m UpdateProviderRequestMultiError) 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 UpdateProviderRequestMultiError) AllErrors() []error { return m } + // UpdateProviderRequestValidationError is the validation error returned by // UpdateProviderRequest.Validate if the designated constraints aren't met. type UpdateProviderRequestValidationError struct { @@ -739,17 +1165,51 @@ var _UpdateProviderRequest_Type_InLookup = map[string]struct{}{ // Validate checks the field values on DeleteProviderRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *DeleteProviderRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on DeleteProviderRequest 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 +// DeleteProviderRequestMultiError, or nil if none found. +func (m *DeleteProviderRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *DeleteProviderRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id + if len(errors) > 0 { + return DeleteProviderRequestMultiError(errors) + } return nil } +// DeleteProviderRequestMultiError is an error wrapping multiple validation +// errors returned by DeleteProviderRequest.ValidateAll() if the designated +// constraints aren't met. +type DeleteProviderRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m DeleteProviderRequestMultiError) 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 DeleteProviderRequestMultiError) AllErrors() []error { return m } + // DeleteProviderRequestValidationError is the validation error returned by // DeleteProviderRequest.Validate if the designated constraints aren't met. type DeleteProviderRequestValidationError struct { @@ -807,12 +1267,27 @@ var _ interface { } = DeleteProviderRequestValidationError{} // Validate checks the field values on Namespace with the rules defined in the -// proto definition for this message. If any rules are violated, an error is returned. +// 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 *Namespace) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Namespace 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 NamespaceMultiError, or nil +// if none found. +func (m *Namespace) ValidateAll() error { + return m.validate(true) +} + +func (m *Namespace) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id // no validation rules for Urn @@ -821,7 +1296,26 @@ func (m *Namespace) Validate() error { // no validation rules for Provider - if v, ok := interface{}(m.GetCredentials()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetCredentials()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, NamespaceValidationError{ + field: "Credentials", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, NamespaceValidationError{ + field: "Credentials", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCredentials()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return NamespaceValidationError{ field: "Credentials", @@ -833,7 +1327,26 @@ func (m *Namespace) Validate() error { // no validation rules for Labels - if v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetCreatedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, NamespaceValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, NamespaceValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return NamespaceValidationError{ field: "CreatedAt", @@ -843,7 +1356,26 @@ func (m *Namespace) Validate() error { } } - if v, ok := interface{}(m.GetUpdatedAt()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetUpdatedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, NamespaceValidationError{ + field: "UpdatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, NamespaceValidationError{ + field: "UpdatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUpdatedAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return NamespaceValidationError{ field: "UpdatedAt", @@ -853,9 +1385,28 @@ func (m *Namespace) Validate() error { } } + if len(errors) > 0 { + return NamespaceMultiError(errors) + } return nil } +// NamespaceMultiError is an error wrapping multiple validation errors returned +// by Namespace.ValidateAll() if the designated constraints aren't met. +type NamespaceMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m NamespaceMultiError) 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 NamespaceMultiError) AllErrors() []error { return m } + // NamespaceValidationError is the validation error returned by // Namespace.Validate if the designated constraints aren't met. type NamespaceValidationError struct { @@ -912,16 +1463,49 @@ var _ interface { // Validate checks the field values on ListNamespacesResponse with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *ListNamespacesResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListNamespacesResponse 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 +// ListNamespacesResponseMultiError, or nil if none found. +func (m *ListNamespacesResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *ListNamespacesResponse) validate(all bool) error { if m == nil { return nil } + var errors []error + for idx, item := range m.GetNamespaces() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ListNamespacesResponseValidationError{ + field: fmt.Sprintf("Namespaces[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ListNamespacesResponseValidationError{ + field: fmt.Sprintf("Namespaces[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ListNamespacesResponseValidationError{ field: fmt.Sprintf("Namespaces[%v]", idx), @@ -933,9 +1517,29 @@ func (m *ListNamespacesResponse) Validate() error { } + if len(errors) > 0 { + return ListNamespacesResponseMultiError(errors) + } return nil } +// ListNamespacesResponseMultiError is an error wrapping multiple validation +// errors returned by ListNamespacesResponse.ValidateAll() if the designated +// constraints aren't met. +type ListNamespacesResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListNamespacesResponseMultiError) 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 ListNamespacesResponseMultiError) AllErrors() []error { return m } + // ListNamespacesResponseValidationError is the validation error returned by // ListNamespacesResponse.Validate if the designated constraints aren't met. type ListNamespacesResponseValidationError struct { @@ -994,29 +1598,70 @@ var _ interface { // Validate checks the field values on CreateNamespaceRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *CreateNamespaceRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CreateNamespaceRequest 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 +// CreateNamespaceRequestMultiError, or nil if none found. +func (m *CreateNamespaceRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *CreateNamespaceRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + if !_CreateNamespaceRequest_Name_Pattern.MatchString(m.GetName()) { - return CreateNamespaceRequestValidationError{ + err := CreateNamespaceRequestValidationError{ field: "Name", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } if !_CreateNamespaceRequest_Urn_Pattern.MatchString(m.GetUrn()) { - return CreateNamespaceRequestValidationError{ + err := CreateNamespaceRequestValidationError{ field: "Urn", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } // no validation rules for Provider - if v, ok := interface{}(m.GetCredentials()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetCredentials()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CreateNamespaceRequestValidationError{ + field: "Credentials", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CreateNamespaceRequestValidationError{ + field: "Credentials", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCredentials()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return CreateNamespaceRequestValidationError{ field: "Credentials", @@ -1028,7 +1673,26 @@ func (m *CreateNamespaceRequest) Validate() error { // no validation rules for Labels - if v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetCreatedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CreateNamespaceRequestValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CreateNamespaceRequestValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return CreateNamespaceRequestValidationError{ field: "CreatedAt", @@ -1038,7 +1702,26 @@ func (m *CreateNamespaceRequest) Validate() error { } } - if v, ok := interface{}(m.GetUpdatedAt()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetUpdatedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CreateNamespaceRequestValidationError{ + field: "UpdatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CreateNamespaceRequestValidationError{ + field: "UpdatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUpdatedAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return CreateNamespaceRequestValidationError{ field: "UpdatedAt", @@ -1048,9 +1731,29 @@ func (m *CreateNamespaceRequest) Validate() error { } } + if len(errors) > 0 { + return CreateNamespaceRequestMultiError(errors) + } return nil } +// CreateNamespaceRequestMultiError is an error wrapping multiple validation +// errors returned by CreateNamespaceRequest.ValidateAll() if the designated +// constraints aren't met. +type CreateNamespaceRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CreateNamespaceRequestMultiError) 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 CreateNamespaceRequestMultiError) AllErrors() []error { return m } + // CreateNamespaceRequestValidationError is the validation error returned by // CreateNamespaceRequest.Validate if the designated constraints aren't met. type CreateNamespaceRequestValidationError struct { @@ -1113,17 +1816,51 @@ var _CreateNamespaceRequest_Urn_Pattern = regexp.MustCompile("^[A-Za-z0-9_-]+$") // Validate checks the field values on GetNamespaceRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *GetNamespaceRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GetNamespaceRequest 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 +// GetNamespaceRequestMultiError, or nil if none found. +func (m *GetNamespaceRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *GetNamespaceRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id + if len(errors) > 0 { + return GetNamespaceRequestMultiError(errors) + } return nil } +// GetNamespaceRequestMultiError is an error wrapping multiple validation +// errors returned by GetNamespaceRequest.ValidateAll() if the designated +// constraints aren't met. +type GetNamespaceRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GetNamespaceRequestMultiError) 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 GetNamespaceRequestMultiError) AllErrors() []error { return m } + // GetNamespaceRequestValidationError is the validation error returned by // GetNamespaceRequest.Validate if the designated constraints aren't met. type GetNamespaceRequestValidationError struct { @@ -1182,24 +1919,61 @@ var _ interface { // Validate checks the field values on UpdateNamespaceRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *UpdateNamespaceRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on UpdateNamespaceRequest 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 +// UpdateNamespaceRequestMultiError, or nil if none found. +func (m *UpdateNamespaceRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *UpdateNamespaceRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id if !_UpdateNamespaceRequest_Name_Pattern.MatchString(m.GetName()) { - return UpdateNamespaceRequestValidationError{ + err := UpdateNamespaceRequestValidationError{ field: "Name", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } // no validation rules for Provider - if v, ok := interface{}(m.GetCredentials()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetCredentials()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, UpdateNamespaceRequestValidationError{ + field: "Credentials", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, UpdateNamespaceRequestValidationError{ + field: "Credentials", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCredentials()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return UpdateNamespaceRequestValidationError{ field: "Credentials", @@ -1211,9 +1985,29 @@ func (m *UpdateNamespaceRequest) Validate() error { // no validation rules for Labels + if len(errors) > 0 { + return UpdateNamespaceRequestMultiError(errors) + } return nil } +// UpdateNamespaceRequestMultiError is an error wrapping multiple validation +// errors returned by UpdateNamespaceRequest.ValidateAll() if the designated +// constraints aren't met. +type UpdateNamespaceRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m UpdateNamespaceRequestMultiError) 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 UpdateNamespaceRequestMultiError) AllErrors() []error { return m } + // UpdateNamespaceRequestValidationError is the validation error returned by // UpdateNamespaceRequest.Validate if the designated constraints aren't met. type UpdateNamespaceRequestValidationError struct { @@ -1274,17 +2068,51 @@ var _UpdateNamespaceRequest_Name_Pattern = regexp.MustCompile("^[A-Za-z0-9_-]+$" // Validate checks the field values on DeleteNamespaceRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *DeleteNamespaceRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on DeleteNamespaceRequest 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 +// DeleteNamespaceRequestMultiError, or nil if none found. +func (m *DeleteNamespaceRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *DeleteNamespaceRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id + if len(errors) > 0 { + return DeleteNamespaceRequestMultiError(errors) + } return nil } +// DeleteNamespaceRequestMultiError is an error wrapping multiple validation +// errors returned by DeleteNamespaceRequest.ValidateAll() if the designated +// constraints aren't met. +type DeleteNamespaceRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m DeleteNamespaceRequestMultiError) 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 DeleteNamespaceRequestMultiError) AllErrors() []error { return m } + // DeleteNamespaceRequestValidationError is the validation error returned by // DeleteNamespaceRequest.Validate if the designated constraints aren't met. type DeleteNamespaceRequestValidationError struct { @@ -1342,20 +2170,54 @@ var _ interface { } = DeleteNamespaceRequestValidationError{} // Validate checks the field values on ReceiverMetadata with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. +// 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 *ReceiverMetadata) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ReceiverMetadata 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 +// ReceiverMetadataMultiError, or nil if none found. +func (m *ReceiverMetadata) ValidateAll() error { + return m.validate(true) +} + +func (m *ReceiverMetadata) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id // no validation rules for Configuration + if len(errors) > 0 { + return ReceiverMetadataMultiError(errors) + } return nil } +// ReceiverMetadataMultiError is an error wrapping multiple validation errors +// returned by ReceiverMetadata.ValidateAll() if the designated constraints +// aren't met. +type ReceiverMetadataMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ReceiverMetadataMultiError) 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 ReceiverMetadataMultiError) AllErrors() []error { return m } + // ReceiverMetadataValidationError is the validation error returned by // ReceiverMetadata.Validate if the designated constraints aren't met. type ReceiverMetadataValidationError struct { @@ -1411,20 +2273,38 @@ var _ interface { } = ReceiverMetadataValidationError{} // Validate checks the field values on Subscription with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. +// 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 *Subscription) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Subscription 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 SubscriptionMultiError, or +// nil if none found. +func (m *Subscription) ValidateAll() error { + return m.validate(true) +} + +func (m *Subscription) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id if !_Subscription_Urn_Pattern.MatchString(m.GetUrn()) { - return SubscriptionValidationError{ + err := SubscriptionValidationError{ field: "Urn", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } // no validation rules for Namespace @@ -1432,7 +2312,26 @@ func (m *Subscription) Validate() error { for idx, item := range m.GetReceivers() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SubscriptionValidationError{ + field: fmt.Sprintf("Receivers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SubscriptionValidationError{ + field: fmt.Sprintf("Receivers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return SubscriptionValidationError{ field: fmt.Sprintf("Receivers[%v]", idx), @@ -1446,7 +2345,26 @@ func (m *Subscription) Validate() error { // no validation rules for Match - if v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetCreatedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SubscriptionValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SubscriptionValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return SubscriptionValidationError{ field: "CreatedAt", @@ -1456,7 +2374,26 @@ func (m *Subscription) Validate() error { } } - if v, ok := interface{}(m.GetUpdatedAt()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetUpdatedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SubscriptionValidationError{ + field: "UpdatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SubscriptionValidationError{ + field: "UpdatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUpdatedAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return SubscriptionValidationError{ field: "UpdatedAt", @@ -1466,9 +2403,28 @@ func (m *Subscription) Validate() error { } } + if len(errors) > 0 { + return SubscriptionMultiError(errors) + } return nil } +// SubscriptionMultiError is an error wrapping multiple validation errors +// returned by Subscription.ValidateAll() if the designated constraints aren't met. +type SubscriptionMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SubscriptionMultiError) 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 SubscriptionMultiError) AllErrors() []error { return m } + // SubscriptionValidationError is the validation error returned by // Subscription.Validate if the designated constraints aren't met. type SubscriptionValidationError struct { @@ -1527,16 +2483,49 @@ var _Subscription_Urn_Pattern = regexp.MustCompile("^[A-Za-z0-9_-]+$") // Validate checks the field values on ListSubscriptionsResponse with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *ListSubscriptionsResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListSubscriptionsResponse 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 +// ListSubscriptionsResponseMultiError, or nil if none found. +func (m *ListSubscriptionsResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *ListSubscriptionsResponse) validate(all bool) error { if m == nil { return nil } + var errors []error + for idx, item := range m.GetSubscriptions() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ListSubscriptionsResponseValidationError{ + field: fmt.Sprintf("Subscriptions[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ListSubscriptionsResponseValidationError{ + field: fmt.Sprintf("Subscriptions[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ListSubscriptionsResponseValidationError{ field: fmt.Sprintf("Subscriptions[%v]", idx), @@ -1548,9 +2537,29 @@ func (m *ListSubscriptionsResponse) Validate() error { } + if len(errors) > 0 { + return ListSubscriptionsResponseMultiError(errors) + } return nil } +// ListSubscriptionsResponseMultiError is an error wrapping multiple validation +// errors returned by ListSubscriptionsResponse.ValidateAll() if the +// designated constraints aren't met. +type ListSubscriptionsResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListSubscriptionsResponseMultiError) 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 ListSubscriptionsResponseMultiError) AllErrors() []error { return m } + // ListSubscriptionsResponseValidationError is the validation error returned by // ListSubscriptionsResponse.Validate if the designated constraints aren't met. type ListSubscriptionsResponseValidationError struct { @@ -1609,17 +2618,35 @@ var _ interface { // Validate checks the field values on CreateSubscriptionRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *CreateSubscriptionRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CreateSubscriptionRequest 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 +// CreateSubscriptionRequestMultiError, or nil if none found. +func (m *CreateSubscriptionRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *CreateSubscriptionRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + if !_CreateSubscriptionRequest_Urn_Pattern.MatchString(m.GetUrn()) { - return CreateSubscriptionRequestValidationError{ + err := CreateSubscriptionRequestValidationError{ field: "Urn", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } // no validation rules for Namespace @@ -1627,7 +2654,26 @@ func (m *CreateSubscriptionRequest) Validate() error { for idx, item := range m.GetReceivers() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CreateSubscriptionRequestValidationError{ + field: fmt.Sprintf("Receivers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CreateSubscriptionRequestValidationError{ + field: fmt.Sprintf("Receivers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return CreateSubscriptionRequestValidationError{ field: fmt.Sprintf("Receivers[%v]", idx), @@ -1641,9 +2687,29 @@ func (m *CreateSubscriptionRequest) Validate() error { // no validation rules for Match + if len(errors) > 0 { + return CreateSubscriptionRequestMultiError(errors) + } return nil } +// CreateSubscriptionRequestMultiError is an error wrapping multiple validation +// errors returned by CreateSubscriptionRequest.ValidateAll() if the +// designated constraints aren't met. +type CreateSubscriptionRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CreateSubscriptionRequestMultiError) 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 CreateSubscriptionRequestMultiError) AllErrors() []error { return m } + // CreateSubscriptionRequestValidationError is the validation error returned by // CreateSubscriptionRequest.Validate if the designated constraints aren't met. type CreateSubscriptionRequestValidationError struct { @@ -1704,17 +2770,51 @@ var _CreateSubscriptionRequest_Urn_Pattern = regexp.MustCompile("^[A-Za-z0-9_-]+ // Validate checks the field values on GetSubscriptionRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *GetSubscriptionRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GetSubscriptionRequest 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 +// GetSubscriptionRequestMultiError, or nil if none found. +func (m *GetSubscriptionRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *GetSubscriptionRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id + if len(errors) > 0 { + return GetSubscriptionRequestMultiError(errors) + } return nil } +// GetSubscriptionRequestMultiError is an error wrapping multiple validation +// errors returned by GetSubscriptionRequest.ValidateAll() if the designated +// constraints aren't met. +type GetSubscriptionRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GetSubscriptionRequestMultiError) 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 GetSubscriptionRequestMultiError) AllErrors() []error { return m } + // GetSubscriptionRequestValidationError is the validation error returned by // GetSubscriptionRequest.Validate if the designated constraints aren't met. type GetSubscriptionRequestValidationError struct { @@ -1773,19 +2873,37 @@ var _ interface { // Validate checks the field values on UpdateSubscriptionRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *UpdateSubscriptionRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on UpdateSubscriptionRequest 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 +// UpdateSubscriptionRequestMultiError, or nil if none found. +func (m *UpdateSubscriptionRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *UpdateSubscriptionRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id if !_UpdateSubscriptionRequest_Urn_Pattern.MatchString(m.GetUrn()) { - return UpdateSubscriptionRequestValidationError{ + err := UpdateSubscriptionRequestValidationError{ field: "Urn", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } // no validation rules for Namespace @@ -1793,7 +2911,26 @@ func (m *UpdateSubscriptionRequest) Validate() error { for idx, item := range m.GetReceivers() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, UpdateSubscriptionRequestValidationError{ + field: fmt.Sprintf("Receivers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, UpdateSubscriptionRequestValidationError{ + field: fmt.Sprintf("Receivers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return UpdateSubscriptionRequestValidationError{ field: fmt.Sprintf("Receivers[%v]", idx), @@ -1807,9 +2944,29 @@ func (m *UpdateSubscriptionRequest) Validate() error { // no validation rules for Match + if len(errors) > 0 { + return UpdateSubscriptionRequestMultiError(errors) + } return nil } +// UpdateSubscriptionRequestMultiError is an error wrapping multiple validation +// errors returned by UpdateSubscriptionRequest.ValidateAll() if the +// designated constraints aren't met. +type UpdateSubscriptionRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m UpdateSubscriptionRequestMultiError) 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 UpdateSubscriptionRequestMultiError) AllErrors() []error { return m } + // UpdateSubscriptionRequestValidationError is the validation error returned by // UpdateSubscriptionRequest.Validate if the designated constraints aren't met. type UpdateSubscriptionRequestValidationError struct { @@ -1870,17 +3027,51 @@ var _UpdateSubscriptionRequest_Urn_Pattern = regexp.MustCompile("^[A-Za-z0-9_-]+ // Validate checks the field values on DeleteSubscriptionRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *DeleteSubscriptionRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on DeleteSubscriptionRequest 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 +// DeleteSubscriptionRequestMultiError, or nil if none found. +func (m *DeleteSubscriptionRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *DeleteSubscriptionRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id + if len(errors) > 0 { + return DeleteSubscriptionRequestMultiError(errors) + } return nil } +// DeleteSubscriptionRequestMultiError is an error wrapping multiple validation +// errors returned by DeleteSubscriptionRequest.ValidateAll() if the +// designated constraints aren't met. +type DeleteSubscriptionRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m DeleteSubscriptionRequestMultiError) 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 DeleteSubscriptionRequestMultiError) AllErrors() []error { return m } + // DeleteSubscriptionRequestValidationError is the validation error returned by // DeleteSubscriptionRequest.Validate if the designated constraints aren't met. type DeleteSubscriptionRequestValidationError struct { @@ -1938,26 +3129,64 @@ var _ interface { } = DeleteSubscriptionRequestValidationError{} // Validate checks the field values on Receiver with the rules defined in the -// proto definition for this message. If any rules are violated, an error is returned. +// 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 *Receiver) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Receiver 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 ReceiverMultiError, or nil +// if none found. +func (m *Receiver) ValidateAll() error { + return m.validate(true) +} + +func (m *Receiver) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id // no validation rules for Name if _, ok := _Receiver_Type_InLookup[m.GetType()]; !ok { - return ReceiverValidationError{ + err := ReceiverValidationError{ field: "Type", reason: "value must be in list [slack pagerduty http]", } + if !all { + return err + } + errors = append(errors, err) } // no validation rules for Labels - if v, ok := interface{}(m.GetConfigurations()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetConfigurations()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ReceiverValidationError{ + field: "Configurations", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ReceiverValidationError{ + field: "Configurations", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetConfigurations()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ReceiverValidationError{ field: "Configurations", @@ -1967,7 +3196,26 @@ func (m *Receiver) Validate() error { } } - if v, ok := interface{}(m.GetData()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetData()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ReceiverValidationError{ + field: "Data", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ReceiverValidationError{ + field: "Data", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetData()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ReceiverValidationError{ field: "Data", @@ -1977,7 +3225,26 @@ func (m *Receiver) Validate() error { } } - if v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetCreatedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ReceiverValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ReceiverValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ReceiverValidationError{ field: "CreatedAt", @@ -1987,7 +3254,26 @@ func (m *Receiver) Validate() error { } } - if v, ok := interface{}(m.GetUpdatedAt()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetUpdatedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ReceiverValidationError{ + field: "UpdatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ReceiverValidationError{ + field: "UpdatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUpdatedAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ReceiverValidationError{ field: "UpdatedAt", @@ -1997,9 +3283,28 @@ func (m *Receiver) Validate() error { } } + if len(errors) > 0 { + return ReceiverMultiError(errors) + } return nil } +// ReceiverMultiError is an error wrapping multiple validation errors returned +// by Receiver.ValidateAll() if the designated constraints aren't met. +type ReceiverMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ReceiverMultiError) 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 ReceiverMultiError) AllErrors() []error { return m } + // ReceiverValidationError is the validation error returned by // Receiver.Validate if the designated constraints aren't met. type ReceiverValidationError struct { @@ -2062,16 +3367,49 @@ var _Receiver_Type_InLookup = map[string]struct{}{ // Validate checks the field values on ListReceiversResponse with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *ListReceiversResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListReceiversResponse 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 +// ListReceiversResponseMultiError, or nil if none found. +func (m *ListReceiversResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *ListReceiversResponse) validate(all bool) error { if m == nil { return nil } + var errors []error + for idx, item := range m.GetReceivers() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ListReceiversResponseValidationError{ + field: fmt.Sprintf("Receivers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ListReceiversResponseValidationError{ + field: fmt.Sprintf("Receivers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ListReceiversResponseValidationError{ field: fmt.Sprintf("Receivers[%v]", idx), @@ -2083,9 +3421,29 @@ func (m *ListReceiversResponse) Validate() error { } + if len(errors) > 0 { + return ListReceiversResponseMultiError(errors) + } return nil } +// ListReceiversResponseMultiError is an error wrapping multiple validation +// errors returned by ListReceiversResponse.ValidateAll() if the designated +// constraints aren't met. +type ListReceiversResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListReceiversResponseMultiError) 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 ListReceiversResponseMultiError) AllErrors() []error { return m } + // ListReceiversResponseValidationError is the validation error returned by // ListReceiversResponse.Validate if the designated constraints aren't met. type ListReceiversResponseValidationError struct { @@ -2144,29 +3502,70 @@ var _ interface { // Validate checks the field values on CreateReceiverRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *CreateReceiverRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CreateReceiverRequest 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 +// CreateReceiverRequestMultiError, or nil if none found. +func (m *CreateReceiverRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *CreateReceiverRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + if !_CreateReceiverRequest_Name_Pattern.MatchString(m.GetName()) { - return CreateReceiverRequestValidationError{ + err := CreateReceiverRequestValidationError{ field: "Name", reason: "value does not match regex pattern \"^[A-Za-z0-9_.-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } if _, ok := _CreateReceiverRequest_Type_InLookup[m.GetType()]; !ok { - return CreateReceiverRequestValidationError{ + err := CreateReceiverRequestValidationError{ field: "Type", reason: "value must be in list [slack pagerduty http]", } + if !all { + return err + } + errors = append(errors, err) } // no validation rules for Labels - if v, ok := interface{}(m.GetConfigurations()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetConfigurations()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CreateReceiverRequestValidationError{ + field: "Configurations", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CreateReceiverRequestValidationError{ + field: "Configurations", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetConfigurations()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return CreateReceiverRequestValidationError{ field: "Configurations", @@ -2176,9 +3575,29 @@ func (m *CreateReceiverRequest) Validate() error { } } + if len(errors) > 0 { + return CreateReceiverRequestMultiError(errors) + } return nil } +// CreateReceiverRequestMultiError is an error wrapping multiple validation +// errors returned by CreateReceiverRequest.ValidateAll() if the designated +// constraints aren't met. +type CreateReceiverRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CreateReceiverRequestMultiError) 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 CreateReceiverRequestMultiError) AllErrors() []error { return m } + // CreateReceiverRequestValidationError is the validation error returned by // CreateReceiverRequest.Validate if the designated constraints aren't met. type CreateReceiverRequestValidationError struct { @@ -2245,17 +3664,51 @@ var _CreateReceiverRequest_Type_InLookup = map[string]struct{}{ // Validate checks the field values on GetReceiverRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *GetReceiverRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GetReceiverRequest 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 +// GetReceiverRequestMultiError, or nil if none found. +func (m *GetReceiverRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *GetReceiverRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id + if len(errors) > 0 { + return GetReceiverRequestMultiError(errors) + } return nil } +// GetReceiverRequestMultiError is an error wrapping multiple validation errors +// returned by GetReceiverRequest.ValidateAll() if the designated constraints +// aren't met. +type GetReceiverRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GetReceiverRequestMultiError) 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 GetReceiverRequestMultiError) AllErrors() []error { return m } + // GetReceiverRequestValidationError is the validation error returned by // GetReceiverRequest.Validate if the designated constraints aren't met. type GetReceiverRequestValidationError struct { @@ -2314,31 +3767,72 @@ var _ interface { // Validate checks the field values on UpdateReceiverRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *UpdateReceiverRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on UpdateReceiverRequest 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 +// UpdateReceiverRequestMultiError, or nil if none found. +func (m *UpdateReceiverRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *UpdateReceiverRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id if !_UpdateReceiverRequest_Name_Pattern.MatchString(m.GetName()) { - return UpdateReceiverRequestValidationError{ + err := UpdateReceiverRequestValidationError{ field: "Name", reason: "value does not match regex pattern \"^[A-Za-z0-9_.-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } if _, ok := _UpdateReceiverRequest_Type_InLookup[m.GetType()]; !ok { - return UpdateReceiverRequestValidationError{ + err := UpdateReceiverRequestValidationError{ field: "Type", reason: "value must be in list [slack pagerduty http]", } + if !all { + return err + } + errors = append(errors, err) } // no validation rules for Labels - if v, ok := interface{}(m.GetConfigurations()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetConfigurations()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, UpdateReceiverRequestValidationError{ + field: "Configurations", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, UpdateReceiverRequestValidationError{ + field: "Configurations", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetConfigurations()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return UpdateReceiverRequestValidationError{ field: "Configurations", @@ -2348,9 +3842,29 @@ func (m *UpdateReceiverRequest) Validate() error { } } + if len(errors) > 0 { + return UpdateReceiverRequestMultiError(errors) + } return nil } +// UpdateReceiverRequestMultiError is an error wrapping multiple validation +// errors returned by UpdateReceiverRequest.ValidateAll() if the designated +// constraints aren't met. +type UpdateReceiverRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m UpdateReceiverRequestMultiError) 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 UpdateReceiverRequestMultiError) AllErrors() []error { return m } + // UpdateReceiverRequestValidationError is the validation error returned by // UpdateReceiverRequest.Validate if the designated constraints aren't met. type UpdateReceiverRequestValidationError struct { @@ -2417,17 +3931,51 @@ var _UpdateReceiverRequest_Type_InLookup = map[string]struct{}{ // Validate checks the field values on DeleteReceiverRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *DeleteReceiverRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on DeleteReceiverRequest 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 +// DeleteReceiverRequestMultiError, or nil if none found. +func (m *DeleteReceiverRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *DeleteReceiverRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id + if len(errors) > 0 { + return DeleteReceiverRequestMultiError(errors) + } return nil } +// DeleteReceiverRequestMultiError is an error wrapping multiple validation +// errors returned by DeleteReceiverRequest.ValidateAll() if the designated +// constraints aren't met. +type DeleteReceiverRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m DeleteReceiverRequestMultiError) 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 DeleteReceiverRequestMultiError) AllErrors() []error { return m } + // DeleteReceiverRequestValidationError is the validation error returned by // DeleteReceiverRequest.Validate if the designated constraints aren't met. type DeleteReceiverRequestValidationError struct { @@ -2486,19 +4034,52 @@ var _ interface { // Validate checks the field values on SendReceiverNotificationRequest with the // rules defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *SendReceiverNotificationRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on SendReceiverNotificationRequest 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 +// SendReceiverNotificationRequestMultiError, or nil if none found. +func (m *SendReceiverNotificationRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *SendReceiverNotificationRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id switch m.Data.(type) { case *SendReceiverNotificationRequest_Slack: - if v, ok := interface{}(m.GetSlack()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetSlack()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SendReceiverNotificationRequestValidationError{ + field: "Slack", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SendReceiverNotificationRequestValidationError{ + field: "Slack", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetSlack()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return SendReceiverNotificationRequestValidationError{ field: "Slack", @@ -2510,9 +4091,29 @@ func (m *SendReceiverNotificationRequest) Validate() error { } + if len(errors) > 0 { + return SendReceiverNotificationRequestMultiError(errors) + } return nil } +// SendReceiverNotificationRequestMultiError is an error wrapping multiple +// validation errors returned by SendReceiverNotificationRequest.ValidateAll() +// if the designated constraints aren't met. +type SendReceiverNotificationRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SendReceiverNotificationRequestMultiError) 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 SendReceiverNotificationRequestMultiError) AllErrors() []error { return m } + // SendReceiverNotificationRequestValidationError is the validation error // returned by SendReceiverNotificationRequest.Validate if the designated // constraints aren't met. @@ -2572,17 +4173,53 @@ var _ interface { // Validate checks the field values on SendReceiverNotificationResponse with // the rules defined in the proto definition for this message. If any rules -// are violated, an error is returned. +// are violated, the first error encountered is returned, or nil if there are +// no violations. func (m *SendReceiverNotificationResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on SendReceiverNotificationResponse 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 +// SendReceiverNotificationResponseMultiError, or nil if none found. +func (m *SendReceiverNotificationResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *SendReceiverNotificationResponse) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Ok + if len(errors) > 0 { + return SendReceiverNotificationResponseMultiError(errors) + } return nil } +// SendReceiverNotificationResponseMultiError is an error wrapping multiple +// validation errors returned by +// SendReceiverNotificationResponse.ValidateAll() if the designated +// constraints aren't met. +type SendReceiverNotificationResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SendReceiverNotificationResponseMultiError) 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 SendReceiverNotificationResponseMultiError) AllErrors() []error { return m } + // SendReceiverNotificationResponseValidationError is the validation error // returned by SendReceiverNotificationResponse.Validate if the designated // constraints aren't met. @@ -2641,36 +4278,78 @@ var _ interface { } = SendReceiverNotificationResponseValidationError{} // Validate checks the field values on ListAlertsRequest with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. +// 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 *ListAlertsRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListAlertsRequest 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 +// ListAlertsRequestMultiError, or nil if none found. +func (m *ListAlertsRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *ListAlertsRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + if _, ok := _ListAlertsRequest_ProviderName_InLookup[m.GetProviderName()]; !ok { - return ListAlertsRequestValidationError{ + err := ListAlertsRequestValidationError{ field: "ProviderName", reason: "value must be in list [cortex]", } + if !all { + return err + } + errors = append(errors, err) } // no validation rules for ProviderId if !_ListAlertsRequest_ResourceName_Pattern.MatchString(m.GetResourceName()) { - return ListAlertsRequestValidationError{ + err := ListAlertsRequestValidationError{ field: "ResourceName", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } // no validation rules for StartTime // no validation rules for EndTime + if len(errors) > 0 { + return ListAlertsRequestMultiError(errors) + } return nil } +// ListAlertsRequestMultiError is an error wrapping multiple validation errors +// returned by ListAlertsRequest.ValidateAll() if the designated constraints +// aren't met. +type ListAlertsRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListAlertsRequestMultiError) 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 ListAlertsRequestMultiError) AllErrors() []error { return m } + // ListAlertsRequestValidationError is the validation error returned by // ListAlertsRequest.Validate if the designated constraints aren't met. type ListAlertsRequestValidationError struct { @@ -2734,16 +4413,49 @@ var _ListAlertsRequest_ProviderName_InLookup = map[string]struct{}{ var _ListAlertsRequest_ResourceName_Pattern = regexp.MustCompile("^[A-Za-z0-9_-]+$") // Validate checks the field values on Alerts with the rules defined in the -// proto definition for this message. If any rules are violated, an error is returned. +// 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 *Alerts) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Alerts 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 AlertsMultiError, or nil if none found. +func (m *Alerts) ValidateAll() error { + return m.validate(true) +} + +func (m *Alerts) validate(all bool) error { if m == nil { return nil } + var errors []error + for idx, item := range m.GetAlerts() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, AlertsValidationError{ + field: fmt.Sprintf("Alerts[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, AlertsValidationError{ + field: fmt.Sprintf("Alerts[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AlertsValidationError{ field: fmt.Sprintf("Alerts[%v]", idx), @@ -2755,9 +4467,28 @@ func (m *Alerts) Validate() error { } + if len(errors) > 0 { + return AlertsMultiError(errors) + } return nil } +// AlertsMultiError is an error wrapping multiple validation errors returned by +// Alerts.ValidateAll() if the designated constraints aren't met. +type AlertsMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m AlertsMultiError) 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 AlertsMultiError) AllErrors() []error { return m } + // AlertsValidationError is the validation error returned by Alerts.Validate if // the designated constraints aren't met. type AlertsValidationError struct { @@ -2813,12 +4544,26 @@ var _ interface { } = AlertsValidationError{} // Validate checks the field values on Alert with the rules defined in the -// proto definition for this message. If any rules are violated, an error is returned. +// 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 *Alert) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Alert 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 AlertMultiError, or nil if none found. +func (m *Alert) ValidateAll() error { + return m.validate(true) +} + +func (m *Alert) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id // no validation rules for ProviderId @@ -2833,7 +4578,26 @@ func (m *Alert) Validate() error { // no validation rules for Rule - if v, ok := interface{}(m.GetTriggeredAt()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetTriggeredAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, AlertValidationError{ + field: "TriggeredAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, AlertValidationError{ + field: "TriggeredAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetTriggeredAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AlertValidationError{ field: "TriggeredAt", @@ -2843,9 +4607,28 @@ func (m *Alert) Validate() error { } } + if len(errors) > 0 { + return AlertMultiError(errors) + } return nil } +// AlertMultiError is an error wrapping multiple validation errors returned by +// Alert.ValidateAll() if the designated constraints aren't met. +type AlertMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m AlertMultiError) 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 AlertMultiError) AllErrors() []error { return m } + // AlertValidationError is the validation error returned by Alert.Validate if // the designated constraints aren't met. type AlertValidationError struct { @@ -2902,18 +4685,51 @@ var _ interface { // Validate checks the field values on CreateCortexAlertsRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *CreateCortexAlertsRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CreateCortexAlertsRequest 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 +// CreateCortexAlertsRequestMultiError, or nil if none found. +func (m *CreateCortexAlertsRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *CreateCortexAlertsRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for ProviderId for idx, item := range m.GetAlerts() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CreateCortexAlertsRequestValidationError{ + field: fmt.Sprintf("Alerts[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CreateCortexAlertsRequestValidationError{ + field: fmt.Sprintf("Alerts[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return CreateCortexAlertsRequestValidationError{ field: fmt.Sprintf("Alerts[%v]", idx), @@ -2925,9 +4741,29 @@ func (m *CreateCortexAlertsRequest) Validate() error { } + if len(errors) > 0 { + return CreateCortexAlertsRequestMultiError(errors) + } return nil } +// CreateCortexAlertsRequestMultiError is an error wrapping multiple validation +// errors returned by CreateCortexAlertsRequest.ValidateAll() if the +// designated constraints aren't met. +type CreateCortexAlertsRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CreateCortexAlertsRequestMultiError) 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 CreateCortexAlertsRequestMultiError) AllErrors() []error { return m } + // CreateCortexAlertsRequestValidationError is the validation error returned by // CreateCortexAlertsRequest.Validate if the designated constraints aren't met. type CreateCortexAlertsRequestValidationError struct { @@ -2985,14 +4821,47 @@ var _ interface { } = CreateCortexAlertsRequestValidationError{} // Validate checks the field values on CortexAlert with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. +// 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 *CortexAlert) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CortexAlert 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 CortexAlertMultiError, or +// nil if none found. +func (m *CortexAlert) ValidateAll() error { + return m.validate(true) +} + +func (m *CortexAlert) validate(all bool) error { if m == nil { return nil } - if v, ok := interface{}(m.GetAnnotations()).(interface{ Validate() error }); ok { + var errors []error + + if all { + switch v := interface{}(m.GetAnnotations()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CortexAlertValidationError{ + field: "Annotations", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CortexAlertValidationError{ + field: "Annotations", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetAnnotations()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return CortexAlertValidationError{ field: "Annotations", @@ -3002,7 +4871,26 @@ func (m *CortexAlert) Validate() error { } } - if v, ok := interface{}(m.GetLabels()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetLabels()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CortexAlertValidationError{ + field: "Labels", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CortexAlertValidationError{ + field: "Labels", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetLabels()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return CortexAlertValidationError{ field: "Labels", @@ -3014,7 +4902,26 @@ func (m *CortexAlert) Validate() error { // no validation rules for Status - if v, ok := interface{}(m.GetStartsAt()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetStartsAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CortexAlertValidationError{ + field: "StartsAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CortexAlertValidationError{ + field: "StartsAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetStartsAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return CortexAlertValidationError{ field: "StartsAt", @@ -3024,9 +4931,28 @@ func (m *CortexAlert) Validate() error { } } + if len(errors) > 0 { + return CortexAlertMultiError(errors) + } return nil } +// CortexAlertMultiError is an error wrapping multiple validation errors +// returned by CortexAlert.ValidateAll() if the designated constraints aren't met. +type CortexAlertMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CortexAlertMultiError) 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 CortexAlertMultiError) AllErrors() []error { return m } + // CortexAlertValidationError is the validation error returned by // CortexAlert.Validate if the designated constraints aren't met. type CortexAlertValidationError struct { @@ -3082,13 +5008,27 @@ var _ interface { } = CortexAlertValidationError{} // Validate checks the field values on Annotations with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. +// 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 *Annotations) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Annotations 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 AnnotationsMultiError, or +// nil if none found. +func (m *Annotations) ValidateAll() error { + return m.validate(true) +} + +func (m *Annotations) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for MetricName // no validation rules for MetricValue @@ -3097,9 +5037,28 @@ func (m *Annotations) Validate() error { // no validation rules for Template + if len(errors) > 0 { + return AnnotationsMultiError(errors) + } return nil } +// AnnotationsMultiError is an error wrapping multiple validation errors +// returned by Annotations.ValidateAll() if the designated constraints aren't met. +type AnnotationsMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m AnnotationsMultiError) 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 AnnotationsMultiError) AllErrors() []error { return m } + // AnnotationsValidationError is the validation error returned by // Annotations.Validate if the designated constraints aren't met. type AnnotationsValidationError struct { @@ -3155,17 +5114,50 @@ var _ interface { } = AnnotationsValidationError{} // Validate checks the field values on Labels with the rules defined in the -// proto definition for this message. If any rules are violated, an error is returned. +// 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 *Labels) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Labels 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 LabelsMultiError, or nil if none found. +func (m *Labels) ValidateAll() error { + return m.validate(true) +} + +func (m *Labels) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Severity + if len(errors) > 0 { + return LabelsMultiError(errors) + } return nil } +// LabelsMultiError is an error wrapping multiple validation errors returned by +// Labels.ValidateAll() if the designated constraints aren't met. +type LabelsMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m LabelsMultiError) 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 LabelsMultiError) AllErrors() []error { return m } + // LabelsValidationError is the validation error returned by Labels.Validate if // the designated constraints aren't met. type LabelsValidationError struct { @@ -3221,12 +5213,26 @@ var _ interface { } = LabelsValidationError{} // Validate checks the field values on Rule with the rules defined in the proto -// definition for this message. If any rules are violated, an error is returned. +// definition for this message. If any rules are violated, the first error +// encountered is returned, or nil if there are no violations. func (m *Rule) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Rule 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 RuleMultiError, or nil if none found. +func (m *Rule) ValidateAll() error { + return m.validate(true) +} + +func (m *Rule) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id // no validation rules for Name @@ -3242,7 +5248,26 @@ func (m *Rule) Validate() error { for idx, item := range m.GetVariables() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, RuleValidationError{ + field: fmt.Sprintf("Variables[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, RuleValidationError{ + field: fmt.Sprintf("Variables[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RuleValidationError{ field: fmt.Sprintf("Variables[%v]", idx), @@ -3254,7 +5279,26 @@ func (m *Rule) Validate() error { } - if v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetCreatedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, RuleValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, RuleValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RuleValidationError{ field: "CreatedAt", @@ -3264,7 +5308,26 @@ func (m *Rule) Validate() error { } } - if v, ok := interface{}(m.GetUpdatedAt()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetUpdatedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, RuleValidationError{ + field: "UpdatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, RuleValidationError{ + field: "UpdatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUpdatedAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RuleValidationError{ field: "UpdatedAt", @@ -3275,15 +5338,38 @@ func (m *Rule) Validate() error { } if m.GetProviderNamespace() < 0 { - return RuleValidationError{ + err := RuleValidationError{ field: "ProviderNamespace", reason: "value must be greater than or equal to 0", } + if !all { + return err + } + errors = append(errors, err) } + if len(errors) > 0 { + return RuleMultiError(errors) + } return nil } +// RuleMultiError is an error wrapping multiple validation errors returned by +// Rule.ValidateAll() if the designated constraints aren't met. +type RuleMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m RuleMultiError) 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 RuleMultiError) AllErrors() []error { return m } + // RuleValidationError is the validation error returned by Rule.Validate if the // designated constraints aren't met. type RuleValidationError struct { @@ -3339,17 +5425,36 @@ var _ interface { } = RuleValidationError{} // Validate checks the field values on Variables with the rules defined in the -// proto definition for this message. If any rules are violated, an error is returned. +// 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 *Variables) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Variables 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 VariablesMultiError, or nil +// if none found. +func (m *Variables) ValidateAll() error { + return m.validate(true) +} + +func (m *Variables) validate(all bool) error { if m == nil { return nil } + var errors []error + if !_Variables_Name_Pattern.MatchString(m.GetName()) { - return VariablesValidationError{ + err := VariablesValidationError{ field: "Name", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } // no validation rules for Value @@ -3358,9 +5463,28 @@ func (m *Variables) Validate() error { // no validation rules for Description + if len(errors) > 0 { + return VariablesMultiError(errors) + } return nil } +// VariablesMultiError is an error wrapping multiple validation errors returned +// by Variables.ValidateAll() if the designated constraints aren't met. +type VariablesMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m VariablesMultiError) 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 VariablesMultiError) AllErrors() []error { return m } + // VariablesValidationError is the validation error returned by // Variables.Validate if the designated constraints aren't met. type VariablesValidationError struct { @@ -3418,13 +5542,27 @@ var _ interface { var _Variables_Name_Pattern = regexp.MustCompile("^[A-Za-z0-9_-]+$") // Validate checks the field values on ListRulesRequest with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. +// 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 *ListRulesRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListRulesRequest 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 +// ListRulesRequestMultiError, or nil if none found. +func (m *ListRulesRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *ListRulesRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Name // no validation rules for Namespace @@ -3435,9 +5573,29 @@ func (m *ListRulesRequest) Validate() error { // no validation rules for ProviderNamespace + if len(errors) > 0 { + return ListRulesRequestMultiError(errors) + } return nil } +// ListRulesRequestMultiError is an error wrapping multiple validation errors +// returned by ListRulesRequest.ValidateAll() if the designated constraints +// aren't met. +type ListRulesRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListRulesRequestMultiError) 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 ListRulesRequestMultiError) AllErrors() []error { return m } + // ListRulesRequestValidationError is the validation error returned by // ListRulesRequest.Validate if the designated constraints aren't met. type ListRulesRequestValidationError struct { @@ -3493,17 +5651,50 @@ var _ interface { } = ListRulesRequestValidationError{} // Validate checks the field values on ListRulesResponse with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. +// 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 *ListRulesResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListRulesResponse 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 +// ListRulesResponseMultiError, or nil if none found. +func (m *ListRulesResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *ListRulesResponse) validate(all bool) error { if m == nil { return nil } + var errors []error + for idx, item := range m.GetRules() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ListRulesResponseValidationError{ + field: fmt.Sprintf("Rules[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ListRulesResponseValidationError{ + field: fmt.Sprintf("Rules[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ListRulesResponseValidationError{ field: fmt.Sprintf("Rules[%v]", idx), @@ -3515,9 +5706,29 @@ func (m *ListRulesResponse) Validate() error { } + if len(errors) > 0 { + return ListRulesResponseMultiError(errors) + } return nil } +// ListRulesResponseMultiError is an error wrapping multiple validation errors +// returned by ListRulesResponse.ValidateAll() if the designated constraints +// aren't met. +type ListRulesResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListRulesResponseMultiError) 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 ListRulesResponseMultiError) AllErrors() []error { return m } + // ListRulesResponseValidationError is the validation error returned by // ListRulesResponse.Validate if the designated constraints aren't met. type ListRulesResponseValidationError struct { @@ -3576,13 +5787,46 @@ var _ interface { // Validate checks the field values on UpdateRuleResponse with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *UpdateRuleResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on UpdateRuleResponse 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 +// UpdateRuleResponseMultiError, or nil if none found. +func (m *UpdateRuleResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *UpdateRuleResponse) validate(all bool) error { if m == nil { return nil } - if v, ok := interface{}(m.GetRule()).(interface{ Validate() error }); ok { + var errors []error + + if all { + switch v := interface{}(m.GetRule()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, UpdateRuleResponseValidationError{ + field: "Rule", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, UpdateRuleResponseValidationError{ + field: "Rule", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetRule()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return UpdateRuleResponseValidationError{ field: "Rule", @@ -3592,9 +5836,29 @@ func (m *UpdateRuleResponse) Validate() error { } } + if len(errors) > 0 { + return UpdateRuleResponseMultiError(errors) + } return nil } +// UpdateRuleResponseMultiError is an error wrapping multiple validation errors +// returned by UpdateRuleResponse.ValidateAll() if the designated constraints +// aren't met. +type UpdateRuleResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m UpdateRuleResponseMultiError) 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 UpdateRuleResponseMultiError) AllErrors() []error { return m } + // UpdateRuleResponseValidationError is the validation error returned by // UpdateRuleResponse.Validate if the designated constraints aren't met. type UpdateRuleResponseValidationError struct { @@ -3652,40 +5916,85 @@ var _ interface { } = UpdateRuleResponseValidationError{} // Validate checks the field values on UpdateRuleRequest with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. +// 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 *UpdateRuleRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on UpdateRuleRequest 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 +// UpdateRuleRequestMultiError, or nil if none found. +func (m *UpdateRuleRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *UpdateRuleRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Enabled if !_UpdateRuleRequest_GroupName_Pattern.MatchString(m.GetGroupName()) { - return UpdateRuleRequestValidationError{ + err := UpdateRuleRequestValidationError{ field: "GroupName", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } if !_UpdateRuleRequest_Namespace_Pattern.MatchString(m.GetNamespace()) { - return UpdateRuleRequestValidationError{ + err := UpdateRuleRequestValidationError{ field: "Namespace", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } if !_UpdateRuleRequest_Template_Pattern.MatchString(m.GetTemplate()) { - return UpdateRuleRequestValidationError{ + err := UpdateRuleRequestValidationError{ field: "Template", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } for idx, item := range m.GetVariables() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, UpdateRuleRequestValidationError{ + field: fmt.Sprintf("Variables[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, UpdateRuleRequestValidationError{ + field: fmt.Sprintf("Variables[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return UpdateRuleRequestValidationError{ field: fmt.Sprintf("Variables[%v]", idx), @@ -3699,9 +6008,29 @@ func (m *UpdateRuleRequest) Validate() error { // no validation rules for ProviderNamespace + if len(errors) > 0 { + return UpdateRuleRequestMultiError(errors) + } return nil } +// UpdateRuleRequestMultiError is an error wrapping multiple validation errors +// returned by UpdateRuleRequest.ValidateAll() if the designated constraints +// aren't met. +type UpdateRuleRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m UpdateRuleRequestMultiError) 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 UpdateRuleRequestMultiError) AllErrors() []error { return m } + // UpdateRuleRequestValidationError is the validation error returned by // UpdateRuleRequest.Validate if the designated constraints aren't met. type UpdateRuleRequestValidationError struct { @@ -3766,17 +6095,51 @@ var _UpdateRuleRequest_Template_Pattern = regexp.MustCompile("^[A-Za-z0-9_-]+$") // Validate checks the field values on ListTemplatesRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *ListTemplatesRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListTemplatesRequest 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 +// ListTemplatesRequestMultiError, or nil if none found. +func (m *ListTemplatesRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *ListTemplatesRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Tag + if len(errors) > 0 { + return ListTemplatesRequestMultiError(errors) + } return nil } +// ListTemplatesRequestMultiError is an error wrapping multiple validation +// errors returned by ListTemplatesRequest.ValidateAll() if the designated +// constraints aren't met. +type ListTemplatesRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListTemplatesRequestMultiError) 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 ListTemplatesRequestMultiError) AllErrors() []error { return m } + // ListTemplatesRequestValidationError is the validation error returned by // ListTemplatesRequest.Validate if the designated constraints aren't met. type ListTemplatesRequestValidationError struct { @@ -3834,34 +6197,76 @@ var _ interface { } = ListTemplatesRequestValidationError{} // Validate checks the field values on TemplateVariables with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. +// 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 *TemplateVariables) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on TemplateVariables 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 +// TemplateVariablesMultiError, or nil if none found. +func (m *TemplateVariables) ValidateAll() error { + return m.validate(true) +} + +func (m *TemplateVariables) validate(all bool) error { if m == nil { return nil } + var errors []error + if !_TemplateVariables_Name_Pattern.MatchString(m.GetName()) { - return TemplateVariablesValidationError{ + err := TemplateVariablesValidationError{ field: "Name", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } if !_TemplateVariables_Type_Pattern.MatchString(m.GetType()) { - return TemplateVariablesValidationError{ + err := TemplateVariablesValidationError{ field: "Type", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } // no validation rules for Default // no validation rules for Description + if len(errors) > 0 { + return TemplateVariablesMultiError(errors) + } return nil } +// TemplateVariablesMultiError is an error wrapping multiple validation errors +// returned by TemplateVariables.ValidateAll() if the designated constraints +// aren't met. +type TemplateVariablesMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m TemplateVariablesMultiError) 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 TemplateVariablesMultiError) AllErrors() []error { return m } + // TemplateVariablesValidationError is the validation error returned by // TemplateVariables.Validate if the designated constraints aren't met. type TemplateVariablesValidationError struct { @@ -3923,36 +6328,82 @@ var _TemplateVariables_Name_Pattern = regexp.MustCompile("^[A-Za-z0-9_-]+$") var _TemplateVariables_Type_Pattern = regexp.MustCompile("^[A-Za-z0-9_-]+$") // Validate checks the field values on Template with the rules defined in the -// proto definition for this message. If any rules are violated, an error is returned. +// 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 *Template) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Template 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 TemplateMultiError, or nil +// if none found. +func (m *Template) ValidateAll() error { + return m.validate(true) +} + +func (m *Template) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id if !_Template_Name_Pattern.MatchString(m.GetName()) { - return TemplateValidationError{ + err := TemplateValidationError{ field: "Name", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } if !_Template_Body_Pattern.MatchString(m.GetBody()) { - return TemplateValidationError{ + err := TemplateValidationError{ field: "Body", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } if len(m.GetTags()) < 1 { - return TemplateValidationError{ + err := TemplateValidationError{ field: "Tags", reason: "value must contain at least 1 item(s)", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetCreatedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, TemplateValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, TemplateValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return TemplateValidationError{ field: "CreatedAt", @@ -3962,7 +6413,26 @@ func (m *Template) Validate() error { } } - if v, ok := interface{}(m.GetUpdatedAt()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetUpdatedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, TemplateValidationError{ + field: "UpdatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, TemplateValidationError{ + field: "UpdatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUpdatedAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return TemplateValidationError{ field: "UpdatedAt", @@ -3973,16 +6443,39 @@ func (m *Template) Validate() error { } if len(m.GetVariables()) < 1 { - return TemplateValidationError{ + err := TemplateValidationError{ field: "Variables", reason: "value must contain at least 1 item(s)", } + if !all { + return err + } + errors = append(errors, err) } for idx, item := range m.GetVariables() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, TemplateValidationError{ + field: fmt.Sprintf("Variables[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, TemplateValidationError{ + field: fmt.Sprintf("Variables[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return TemplateValidationError{ field: fmt.Sprintf("Variables[%v]", idx), @@ -3994,9 +6487,28 @@ func (m *Template) Validate() error { } + if len(errors) > 0 { + return TemplateMultiError(errors) + } return nil } +// TemplateMultiError is an error wrapping multiple validation errors returned +// by Template.ValidateAll() if the designated constraints aren't met. +type TemplateMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m TemplateMultiError) 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 TemplateMultiError) AllErrors() []error { return m } + // TemplateValidationError is the validation error returned by // Template.Validate if the designated constraints aren't met. type TemplateValidationError struct { @@ -4056,14 +6568,47 @@ var _Template_Name_Pattern = regexp.MustCompile("^[A-Za-z0-9_-]+$") var _Template_Body_Pattern = regexp.MustCompile("^[A-Za-z0-9_-]+$") // Validate checks the field values on TemplateResponse with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. +// 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 *TemplateResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on TemplateResponse 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 +// TemplateResponseMultiError, or nil if none found. +func (m *TemplateResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *TemplateResponse) validate(all bool) error { if m == nil { return nil } - if v, ok := interface{}(m.GetTemplate()).(interface{ Validate() error }); ok { + var errors []error + + if all { + switch v := interface{}(m.GetTemplate()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, TemplateResponseValidationError{ + field: "Template", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, TemplateResponseValidationError{ + field: "Template", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetTemplate()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return TemplateResponseValidationError{ field: "Template", @@ -4073,9 +6618,29 @@ func (m *TemplateResponse) Validate() error { } } + if len(errors) > 0 { + return TemplateResponseMultiError(errors) + } return nil } +// TemplateResponseMultiError is an error wrapping multiple validation errors +// returned by TemplateResponse.ValidateAll() if the designated constraints +// aren't met. +type TemplateResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m TemplateResponseMultiError) 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 TemplateResponseMultiError) AllErrors() []error { return m } + // TemplateResponseValidationError is the validation error returned by // TemplateResponse.Validate if the designated constraints aren't met. type TemplateResponseValidationError struct { @@ -4132,41 +6697,86 @@ var _ interface { // Validate checks the field values on UpsertTemplateRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *UpsertTemplateRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on UpsertTemplateRequest 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 +// UpsertTemplateRequestMultiError, or nil if none found. +func (m *UpsertTemplateRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *UpsertTemplateRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Id if !_UpsertTemplateRequest_Name_Pattern.MatchString(m.GetName()) { - return UpsertTemplateRequestValidationError{ + err := UpsertTemplateRequestValidationError{ field: "Name", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } // no validation rules for Body if len(m.GetTags()) < 1 { - return UpsertTemplateRequestValidationError{ + err := UpsertTemplateRequestValidationError{ field: "Tags", reason: "value must contain at least 1 item(s)", } + if !all { + return err + } + errors = append(errors, err) } if len(m.GetVariables()) < 1 { - return UpsertTemplateRequestValidationError{ + err := UpsertTemplateRequestValidationError{ field: "Variables", reason: "value must contain at least 1 item(s)", } + if !all { + return err + } + errors = append(errors, err) } for idx, item := range m.GetVariables() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, UpsertTemplateRequestValidationError{ + field: fmt.Sprintf("Variables[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, UpsertTemplateRequestValidationError{ + field: fmt.Sprintf("Variables[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return UpsertTemplateRequestValidationError{ field: fmt.Sprintf("Variables[%v]", idx), @@ -4178,9 +6788,29 @@ func (m *UpsertTemplateRequest) Validate() error { } + if len(errors) > 0 { + return UpsertTemplateRequestMultiError(errors) + } return nil } +// UpsertTemplateRequestMultiError is an error wrapping multiple validation +// errors returned by UpsertTemplateRequest.ValidateAll() if the designated +// constraints aren't met. +type UpsertTemplateRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m UpsertTemplateRequestMultiError) 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 UpsertTemplateRequestMultiError) AllErrors() []error { return m } + // UpsertTemplateRequestValidationError is the validation error returned by // UpsertTemplateRequest.Validate if the designated constraints aren't met. type UpsertTemplateRequestValidationError struct { @@ -4241,16 +6871,49 @@ var _UpsertTemplateRequest_Name_Pattern = regexp.MustCompile("^[A-Za-z0-9_-]+$") // Validate checks the field values on ListTemplatesResponse with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *ListTemplatesResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListTemplatesResponse 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 +// ListTemplatesResponseMultiError, or nil if none found. +func (m *ListTemplatesResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *ListTemplatesResponse) validate(all bool) error { if m == nil { return nil } + var errors []error + for idx, item := range m.GetTemplates() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ListTemplatesResponseValidationError{ + field: fmt.Sprintf("Templates[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ListTemplatesResponseValidationError{ + field: fmt.Sprintf("Templates[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ListTemplatesResponseValidationError{ field: fmt.Sprintf("Templates[%v]", idx), @@ -4262,9 +6925,29 @@ func (m *ListTemplatesResponse) Validate() error { } + if len(errors) > 0 { + return ListTemplatesResponseMultiError(errors) + } return nil } +// ListTemplatesResponseMultiError is an error wrapping multiple validation +// errors returned by ListTemplatesResponse.ValidateAll() if the designated +// constraints aren't met. +type ListTemplatesResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListTemplatesResponseMultiError) 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 ListTemplatesResponseMultiError) AllErrors() []error { return m } + // ListTemplatesResponseValidationError is the validation error returned by // ListTemplatesResponse.Validate if the designated constraints aren't met. type ListTemplatesResponseValidationError struct { @@ -4323,22 +7006,60 @@ var _ interface { // Validate checks the field values on GetTemplateByNameRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *GetTemplateByNameRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GetTemplateByNameRequest 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 +// GetTemplateByNameRequestMultiError, or nil if none found. +func (m *GetTemplateByNameRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *GetTemplateByNameRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + if !_GetTemplateByNameRequest_Name_Pattern.MatchString(m.GetName()) { - return GetTemplateByNameRequestValidationError{ + err := GetTemplateByNameRequestValidationError{ field: "Name", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } + if len(errors) > 0 { + return GetTemplateByNameRequestMultiError(errors) + } return nil } +// GetTemplateByNameRequestMultiError is an error wrapping multiple validation +// errors returned by GetTemplateByNameRequest.ValidateAll() if the designated +// constraints aren't met. +type GetTemplateByNameRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GetTemplateByNameRequestMultiError) 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 GetTemplateByNameRequestMultiError) AllErrors() []error { return m } + // GetTemplateByNameRequestValidationError is the validation error returned by // GetTemplateByNameRequest.Validate if the designated constraints aren't met. type GetTemplateByNameRequestValidationError struct { @@ -4399,17 +7120,51 @@ var _GetTemplateByNameRequest_Name_Pattern = regexp.MustCompile("^[A-Za-z0-9_-]+ // Validate checks the field values on DeleteTemplateRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *DeleteTemplateRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on DeleteTemplateRequest 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 +// DeleteTemplateRequestMultiError, or nil if none found. +func (m *DeleteTemplateRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *DeleteTemplateRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Name + if len(errors) > 0 { + return DeleteTemplateRequestMultiError(errors) + } return nil } +// DeleteTemplateRequestMultiError is an error wrapping multiple validation +// errors returned by DeleteTemplateRequest.ValidateAll() if the designated +// constraints aren't met. +type DeleteTemplateRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m DeleteTemplateRequestMultiError) 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 DeleteTemplateRequestMultiError) AllErrors() []error { return m } + // DeleteTemplateRequestValidationError is the validation error returned by // DeleteTemplateRequest.Validate if the designated constraints aren't met. type DeleteTemplateRequestValidationError struct { @@ -4468,15 +7223,49 @@ var _ interface { // Validate checks the field values on DeleteTemplateResponse with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *DeleteTemplateResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on DeleteTemplateResponse 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 +// DeleteTemplateResponseMultiError, or nil if none found. +func (m *DeleteTemplateResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *DeleteTemplateResponse) validate(all bool) error { if m == nil { return nil } + var errors []error + + if len(errors) > 0 { + return DeleteTemplateResponseMultiError(errors) + } return nil } +// DeleteTemplateResponseMultiError is an error wrapping multiple validation +// errors returned by DeleteTemplateResponse.ValidateAll() if the designated +// constraints aren't met. +type DeleteTemplateResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m DeleteTemplateResponseMultiError) 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 DeleteTemplateResponseMultiError) AllErrors() []error { return m } + // DeleteTemplateResponseValidationError is the validation error returned by // DeleteTemplateResponse.Validate if the designated constraints aren't met. type DeleteTemplateResponseValidationError struct { @@ -4535,24 +7324,62 @@ var _ interface { // Validate checks the field values on RenderTemplateRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *RenderTemplateRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on RenderTemplateRequest 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 +// RenderTemplateRequestMultiError, or nil if none found. +func (m *RenderTemplateRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *RenderTemplateRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + if !_RenderTemplateRequest_Name_Pattern.MatchString(m.GetName()) { - return RenderTemplateRequestValidationError{ + err := RenderTemplateRequestValidationError{ field: "Name", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } // no validation rules for Variables + if len(errors) > 0 { + return RenderTemplateRequestMultiError(errors) + } return nil } +// RenderTemplateRequestMultiError is an error wrapping multiple validation +// errors returned by RenderTemplateRequest.ValidateAll() if the designated +// constraints aren't met. +type RenderTemplateRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m RenderTemplateRequestMultiError) 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 RenderTemplateRequestMultiError) AllErrors() []error { return m } + // RenderTemplateRequestValidationError is the validation error returned by // RenderTemplateRequest.Validate if the designated constraints aren't met. type RenderTemplateRequestValidationError struct { @@ -4613,17 +7440,51 @@ var _RenderTemplateRequest_Name_Pattern = regexp.MustCompile("^[A-Za-z0-9_-]+$") // Validate checks the field values on RenderTemplateResponse with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *RenderTemplateResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on RenderTemplateResponse 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 +// RenderTemplateResponseMultiError, or nil if none found. +func (m *RenderTemplateResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *RenderTemplateResponse) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Body + if len(errors) > 0 { + return RenderTemplateResponseMultiError(errors) + } return nil } +// RenderTemplateResponseMultiError is an error wrapping multiple validation +// errors returned by RenderTemplateResponse.ValidateAll() if the designated +// constraints aren't met. +type RenderTemplateResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m RenderTemplateResponseMultiError) 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 RenderTemplateResponseMultiError) AllErrors() []error { return m } + // RenderTemplateResponseValidationError is the validation error returned by // RenderTemplateResponse.Validate if the designated constraints aren't met. type RenderTemplateResponseValidationError struct { @@ -4682,32 +7543,75 @@ var _ interface { // Validate checks the field values on // SendReceiverNotificationRequest_SlackPayload with the rules defined in the -// proto definition for this message. If any rules are violated, an error is returned. +// 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 *SendReceiverNotificationRequest_SlackPayload) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on +// SendReceiverNotificationRequest_SlackPayload 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 +// SendReceiverNotificationRequest_SlackPayloadMultiError, or nil if none found. +func (m *SendReceiverNotificationRequest_SlackPayload) ValidateAll() error { + return m.validate(true) +} + +func (m *SendReceiverNotificationRequest_SlackPayload) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Message if !_SendReceiverNotificationRequest_SlackPayload_ReceiverName_Pattern.MatchString(m.GetReceiverName()) { - return SendReceiverNotificationRequest_SlackPayloadValidationError{ + err := SendReceiverNotificationRequest_SlackPayloadValidationError{ field: "ReceiverName", reason: "value does not match regex pattern \"^[A-Za-z0-9_-]+$\"", } + if !all { + return err + } + errors = append(errors, err) } if _, ok := _SendReceiverNotificationRequest_SlackPayload_ReceiverType_InLookup[m.GetReceiverType()]; !ok { - return SendReceiverNotificationRequest_SlackPayloadValidationError{ + err := SendReceiverNotificationRequest_SlackPayloadValidationError{ field: "ReceiverType", reason: "value must be in list [channel user]", } + if !all { + return err + } + errors = append(errors, err) } for idx, item := range m.GetBlocks() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SendReceiverNotificationRequest_SlackPayloadValidationError{ + field: fmt.Sprintf("Blocks[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SendReceiverNotificationRequest_SlackPayloadValidationError{ + field: fmt.Sprintf("Blocks[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return SendReceiverNotificationRequest_SlackPayloadValidationError{ field: fmt.Sprintf("Blocks[%v]", idx), @@ -4719,9 +7623,30 @@ func (m *SendReceiverNotificationRequest_SlackPayload) Validate() error { } + if len(errors) > 0 { + return SendReceiverNotificationRequest_SlackPayloadMultiError(errors) + } return nil } +// SendReceiverNotificationRequest_SlackPayloadMultiError is an error wrapping +// multiple validation errors returned by +// SendReceiverNotificationRequest_SlackPayload.ValidateAll() if the +// designated constraints aren't met. +type SendReceiverNotificationRequest_SlackPayloadMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SendReceiverNotificationRequest_SlackPayloadMultiError) 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 SendReceiverNotificationRequest_SlackPayloadMultiError) AllErrors() []error { return m } + // SendReceiverNotificationRequest_SlackPayloadValidationError is the // validation error returned by // SendReceiverNotificationRequest_SlackPayload.Validate if the designated diff --git a/buf.yaml b/buf.yaml deleted file mode 100644 index 74c02f3d..00000000 --- a/buf.yaml +++ /dev/null @@ -1,4 +0,0 @@ -version: v1beta1 -build: - roots: - - proton diff --git a/go.mod b/go.mod index 7745269b..cce125fd 100644 --- a/go.mod +++ b/go.mod @@ -5,38 +5,43 @@ go 1.16 require ( github.com/DATA-DOG/go-sqlmock v1.5.0 github.com/MakeNowJust/heredoc v1.0.0 - github.com/antihax/optional v1.0.0 - github.com/envoyproxy/protoc-gen-validate v0.1.0 + github.com/envoyproxy/protoc-gen-validate v0.6.2 github.com/go-openapi/loads v0.20.1 // indirect github.com/go-openapi/runtime v0.19.26 github.com/go-openapi/spec v0.20.2 // indirect - github.com/go-playground/universal-translator v0.17.0 // indirect + github.com/go-playground/universal-translator v0.18.0 // indirect + github.com/gofrs/uuid v4.0.0+incompatible // indirect + github.com/golang/snappy v0.0.3 // indirect github.com/grafana/cortex-tools v0.7.2 github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.6.0 github.com/gtank/cryptopasta v0.0.0-20170601214702-1f550f6f2f69 github.com/jeremywohl/flatten v1.0.1 + github.com/kr/pretty v0.3.0 // indirect github.com/leodido/go-urn v1.2.1 // indirect github.com/lib/pq v1.3.0 github.com/mcuadros/go-defaults v1.2.0 github.com/mitchellh/mapstructure v1.4.1 github.com/newrelic/go-agent/v3 v3.12.0 github.com/newrelic/go-agent/v3/integrations/nrgrpc v1.3.1 - github.com/odpf/salt v0.0.0-20211028100023-de463ef825e1 + github.com/odpf/salt v0.0.0-20220106155451-62e8c849ae81 github.com/pkg/errors v0.9.1 github.com/prometheus/alertmanager v0.21.1-0.20200911160112-1fdff6b3f939 github.com/prometheus/prometheus v1.8.2-0.20201014093524-73e2ce1bd643 + github.com/rogpeppe/go-internal v1.8.0 // indirect github.com/slack-go/slack v0.9.3 github.com/spf13/cobra v1.2.1 github.com/spf13/viper v1.8.1 github.com/stretchr/testify v1.7.0 + go.uber.org/multierr v1.7.0 // indirect go.uber.org/zap v1.19.0 - golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392 // indirect - golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d - golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f + golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect + golang.org/x/net v0.0.0-20210825183410-e898025ed96a + golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf // indirect google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83 google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/go-playground/assert.v1 v1.2.1 // indirect gopkg.in/go-playground/validator.v9 v9.31.0 gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b diff --git a/go.sum b/go.sum index db570b75..4ca09126 100644 --- a/go.sum +++ b/go.sum @@ -152,7 +152,6 @@ github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+Dx github.com/aliyun/aliyun-oss-go-sdk v2.0.4+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= -github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= @@ -336,8 +335,9 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= -github.com/envoyproxy/protoc-gen-validate v0.1.0 h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v0.6.2 h1:JiO+kJTpmYGjEodY7O1Zk8oZcNz1+f30UtwtXoFUPzE= +github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws= github.com/evanphx/json-patch v0.0.0-20200808040245-162e5629780b/go.mod h1:NAJj0yf/KaRKURN6nyi7A9IZydMivZEm9oQLWNjfKDc= github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= @@ -485,10 +485,10 @@ github.com/go-openapi/validate v0.19.12/go.mod h1:Rzou8hA/CBw8donlS6WNEUQupNvUZ0 github.com/go-openapi/validate v0.19.15/go.mod h1:tbn/fdOwYHgrhPBzidZfJC2MIVvs9GA7monOmWBbeCI= github.com/go-openapi/validate v0.20.1 h1:QGQ5CvK74E28t3DkegGweKR+auemUi5IdpMc4x3UW6s= github.com/go-openapi/validate v0.20.1/go.mod h1:b60iJT+xNNLfaQJUqLI7946tYiFEOuE9E4k54HpKcJ0= -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= +github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-redis/redis/v8 v8.0.0-beta.10.0.20200905143926-df7fe4e2ce72/go.mod h1:CJP1ZIHwhosNYwIdaHPZK9vHsM3+roNBaZ7U9Of1DXc= github.com/go-redis/redis/v8 v8.2.3/go.mod h1:ysgGY09J/QeDYbu3HikWEIPCwaeOkuNoTgKayTEaEOw= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= @@ -532,8 +532,9 @@ github.com/godbus/dbus v0.0.0-20190402143921-271e53dc4968/go.mod h1:/YcGZj5zSblf github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/flock v0.7.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gofrs/uuid v3.3.0+incompatible h1:8K4tyRfvU1CYPgJsveYFQMhpFd/wXNM7iK6rR7UHz84= github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= +github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/protobuf v1.0.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -588,8 +589,9 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.2 h1:aeE13tS0IiQgFjYdoL8qN3K1N2bXXtI6Vi51/y7BpMw= github.com/golang/snappy v0.0.2/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= +github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/gonum/blas v0.0.0-20181208220705-f22b278b28ac/go.mod h1:P32wAyui1PQ58Oce/KYkOqQv8cVw1zAapXOl+dRFGbc= github.com/gonum/floats v0.0.0-20181209220543-c233463c7e82/go.mod h1:PxC8OnwL11+aosOB5+iEPoV3picfs8tUpkVd0pDo+Kg= @@ -758,6 +760,7 @@ github.com/hetznercloud/hcloud-go v1.22.0/go.mod h1:xng8lbDUg+xM1dgc0yGHX5EeqbwI github.com/hodgesds/perf-utils v0.0.8/go.mod h1:F6TfvsbtrF88i++hou29dTXlI2sfsJv+gRZDtmTJkAs= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= @@ -903,6 +906,8 @@ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFB github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.0.0/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= @@ -932,6 +937,7 @@ github.com/lovoo/gcloud-opentracing v0.3.0/go.mod h1:ZFqk2y38kMDDikZPAK7ynTTGuyt github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/lufia/iostat v1.1.0/go.mod h1:rEPNA0xXgjHQjuI5Cy05sLlS2oRcSlWHRLrvh/AQ+Pg= +github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= @@ -963,8 +969,9 @@ github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2y github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA= github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= @@ -1055,12 +1062,11 @@ github.com/newrelic/go-agent/v3 v3.12.0 h1:tcDo0Q8qRWAJqb9uykfmM8pxGSbv0HqSS3q1+ github.com/newrelic/go-agent/v3 v3.12.0/go.mod h1:1A1dssWBwzB7UemzRU6ZVaGDsI+cEn5/bNxI0wiYlIc= github.com/newrelic/go-agent/v3/integrations/nrgrpc v1.3.1 h1:/ar1Omo9luapTJYWXt86oQGBpWwpWF92x+UuYU9v/7o= github.com/newrelic/go-agent/v3/integrations/nrgrpc v1.3.1/go.mod h1:2q0u6qkNJ4ClDt920A4r+NpcO370lFze1NF4OPJjAks= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/odpf/salt v0.0.0-20211028100023-de463ef825e1 h1:iFoq6ugjCrjmZ4eS4AS/HoFwX+uQVSxVpX/qJF4lMzs= -github.com/odpf/salt v0.0.0-20211028100023-de463ef825e1/go.mod h1:NVnVQaXur70W/1wo06X6DYu6utZIUI/bMeMGyvFIwyo= +github.com/odpf/salt v0.0.0-20220106155451-62e8c849ae81 h1:kZvnrHtQX5WcftjLvaVIZ83mm8QCIg71Vzu34xwl4rw= +github.com/odpf/salt v0.0.0-20220106155451-62e8c849ae81/go.mod h1:kmqHb7LvWQxMKTf1b60P8eNUfdO68Ttx7VZAJiElTNA= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= @@ -1126,6 +1132,7 @@ github.com/pierrec/cmdflag v0.0.2/go.mod h1:a3zKGZ3cdQUfxjd0RGMLZr8xI3nvpJOB+m6o github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/lz4/v4 v4.0.2-0.20200813132121-22f5d580d5c4/go.mod h1:vvUajMAuienWCEdMnA5Zb5mp0VIa9M8VvKcVEOkoAh8= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -1218,6 +1225,9 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= +github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= @@ -1279,6 +1289,7 @@ github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasO github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= +github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= @@ -1421,8 +1432,9 @@ go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/ go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= -go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec= +go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= @@ -1460,8 +1472,8 @@ golang.org/x/crypto v0.0.0-20200422194213-44a606286825/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392 h1:xYJJ3S178yv++9zXV/hnr29plCAGO9vAFG9dorqaFQc= -golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1504,6 +1516,7 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1565,8 +1578,9 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210331212208-0fccb6fa2b5c/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d h1:LO7XpTYMwTqxjLcGWPijK3vRXg1aWdlNOVOHRq45d7c= golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210825183410-e898025ed96a h1:bRuuGXV8wwSdGTB+CtJf+FjgO1APK1CoO39T4BN/XBw= +golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1694,9 +1708,12 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 h1:JWgyZ1qgdTaF3N3oxC+MdTV7qvEEgHo3otj+HB5CM7Q= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf h1:2ucpDCmfkl8Bd/FsLtiD653Wf96cW37s+iGx93zsu4k= +golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1707,8 +1724,9 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1961,8 +1979,9 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= diff --git a/scripts/build.sh b/scripts/build.sh deleted file mode 100644 index 33ba9621..00000000 --- a/scripts/build.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -NAME="github.com/odpf/siren" -VERSION=$(git describe --always --tags 2>/dev/null) - -SYS="linux" -ARCH="amd64" -BUILD_DIR="dist" - -build() { - EXECUTABLE_NAME=$1 - LD_FLAGS=$2 - # create a folder named via the combination of os and arch - TARGET="./$BUILD_DIR/${SYS}-${ARCH}" - mkdir -p $TARGET - - # place the executable within that folder - executable="${TARGET}/$EXECUTABLE_NAME" - echo $executable - GOOS=$SYS GOARCH=$ARCH go build -ldflags "$LD_FLAGS" -o $executable $NAME -} - -build siren "-X main.Version=${VERSION}"