1// Code generated by protoc-gen-validate. DO NOT EDIT.
2// source: envoy/config/filter/http/lua/v2/lua.proto
3
4package envoy_config_filter_http_lua_v2
5
6import (
7	"bytes"
8	"errors"
9	"fmt"
10	"net"
11	"net/mail"
12	"net/url"
13	"regexp"
14	"strings"
15	"time"
16	"unicode/utf8"
17
18	"github.com/golang/protobuf/ptypes"
19)
20
21// ensure the imports are used
22var (
23	_ = bytes.MinRead
24	_ = errors.New("")
25	_ = fmt.Print
26	_ = utf8.UTFMax
27	_ = (*regexp.Regexp)(nil)
28	_ = (*strings.Reader)(nil)
29	_ = net.IPv4len
30	_ = time.Duration(0)
31	_ = (*url.URL)(nil)
32	_ = (*mail.Address)(nil)
33	_ = ptypes.DynamicAny{}
34)
35
36// define the regex for a UUID once up-front
37var _lua_uuidPattern = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")
38
39// Validate checks the field values on Lua with the rules defined in the proto
40// definition for this message. If any rules are violated, an error is returned.
41func (m *Lua) Validate() error {
42	if m == nil {
43		return nil
44	}
45
46	if len(m.GetInlineCode()) < 1 {
47		return LuaValidationError{
48			field:  "InlineCode",
49			reason: "value length must be at least 1 bytes",
50		}
51	}
52
53	return nil
54}
55
56// LuaValidationError is the validation error returned by Lua.Validate if the
57// designated constraints aren't met.
58type LuaValidationError struct {
59	field  string
60	reason string
61	cause  error
62	key    bool
63}
64
65// Field function returns field value.
66func (e LuaValidationError) Field() string { return e.field }
67
68// Reason function returns reason value.
69func (e LuaValidationError) Reason() string { return e.reason }
70
71// Cause function returns cause value.
72func (e LuaValidationError) Cause() error { return e.cause }
73
74// Key function returns key value.
75func (e LuaValidationError) Key() bool { return e.key }
76
77// ErrorName returns error name.
78func (e LuaValidationError) ErrorName() string { return "LuaValidationError" }
79
80// Error satisfies the builtin error interface
81func (e LuaValidationError) Error() string {
82	cause := ""
83	if e.cause != nil {
84		cause = fmt.Sprintf(" | caused by: %v", e.cause)
85	}
86
87	key := ""
88	if e.key {
89		key = "key for "
90	}
91
92	return fmt.Sprintf(
93		"invalid %sLua.%s: %s%s",
94		key,
95		e.field,
96		e.reason,
97		cause)
98}
99
100var _ error = LuaValidationError{}
101
102var _ interface {
103	Field() string
104	Reason() string
105	Key() bool
106	Cause() error
107	ErrorName() string
108} = LuaValidationError{}
109