1// Code generated by protoc-gen-validate. DO NOT EDIT.
2// source: xds/data/orca/v3/orca_load_report.proto
3
4package v3
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	"google.golang.org/protobuf/types/known/anypb"
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	_ = anypb.Any{}
34)
35
36// Validate checks the field values on OrcaLoadReport with the rules defined in
37// the proto definition for this message. If any rules are violated, an error
38// is returned.
39func (m *OrcaLoadReport) Validate() error {
40	if m == nil {
41		return nil
42	}
43
44	if val := m.GetCpuUtilization(); val < 0 || val > 1 {
45		return OrcaLoadReportValidationError{
46			field:  "CpuUtilization",
47			reason: "value must be inside range [0, 1]",
48		}
49	}
50
51	if val := m.GetMemUtilization(); val < 0 || val > 1 {
52		return OrcaLoadReportValidationError{
53			field:  "MemUtilization",
54			reason: "value must be inside range [0, 1]",
55		}
56	}
57
58	// no validation rules for Rps
59
60	// no validation rules for RequestCost
61
62	for key, val := range m.GetUtilization() {
63		_ = val
64
65		// no validation rules for Utilization[key]
66
67		if val := val; val < 0 || val > 1 {
68			return OrcaLoadReportValidationError{
69				field:  fmt.Sprintf("Utilization[%v]", key),
70				reason: "value must be inside range [0, 1]",
71			}
72		}
73
74	}
75
76	return nil
77}
78
79// OrcaLoadReportValidationError is the validation error returned by
80// OrcaLoadReport.Validate if the designated constraints aren't met.
81type OrcaLoadReportValidationError struct {
82	field  string
83	reason string
84	cause  error
85	key    bool
86}
87
88// Field function returns field value.
89func (e OrcaLoadReportValidationError) Field() string { return e.field }
90
91// Reason function returns reason value.
92func (e OrcaLoadReportValidationError) Reason() string { return e.reason }
93
94// Cause function returns cause value.
95func (e OrcaLoadReportValidationError) Cause() error { return e.cause }
96
97// Key function returns key value.
98func (e OrcaLoadReportValidationError) Key() bool { return e.key }
99
100// ErrorName returns error name.
101func (e OrcaLoadReportValidationError) ErrorName() string { return "OrcaLoadReportValidationError" }
102
103// Error satisfies the builtin error interface
104func (e OrcaLoadReportValidationError) Error() string {
105	cause := ""
106	if e.cause != nil {
107		cause = fmt.Sprintf(" | caused by: %v", e.cause)
108	}
109
110	key := ""
111	if e.key {
112		key = "key for "
113	}
114
115	return fmt.Sprintf(
116		"invalid %sOrcaLoadReport.%s: %s%s",
117		key,
118		e.field,
119		e.reason,
120		cause)
121}
122
123var _ error = OrcaLoadReportValidationError{}
124
125var _ interface {
126	Field() string
127	Reason() string
128	Key() bool
129	Cause() error
130	ErrorName() string
131} = OrcaLoadReportValidationError{}
132