repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1 value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
envoyproxy/go-control-plane | envoy/type/http_status.pb.validate.go | Validate | func (m *HttpStatus) Validate() error {
if m == nil {
return nil
}
if _, ok := StatusCode_name[int32(m.GetCode())]; !ok {
return HttpStatusValidationError{
field: "Code",
reason: "value must be one of the defined enum values",
}
}
return nil
} | go | func (m *HttpStatus) Validate() error {
if m == nil {
return nil
}
if _, ok := StatusCode_name[int32(m.GetCode())]; !ok {
return HttpStatusValidationError{
field: "Code",
reason: "value must be one of the defined enum values",
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"HttpStatus",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"StatusCode_name",
"[",
"int32",
"(",
"m",
".",
"GetCode",
"(",
")",
")",
... | // Validate checks the field values on HttpStatus with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"HttpStatus",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/type/http_status.pb.validate.go#L38-L51 | train |
envoyproxy/go-control-plane | envoy/data/cluster/v2alpha/outlier_detection_event.pb.validate.go | Validate | func (m *OutlierDetectionEvent) Validate() error {
if m == nil {
return nil
}
if _, ok := OutlierEjectionType_name[int32(m.GetType())]; !ok {
return OutlierDetectionEventValidationError{
field: "Type",
reason: "value must be one of the defined enum values",
}
}
{
tmp := m.GetTimestamp()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OutlierDetectionEventValidationError{
field: "Timestamp",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetSecsSinceLastAction()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OutlierDetectionEventValidationError{
field: "SecsSinceLastAction",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(m.GetClusterName()) < 1 {
return OutlierDetectionEventValidationError{
field: "ClusterName",
reason: "value length must be at least 1 bytes",
}
}
if len(m.GetUpstreamUrl()) < 1 {
return OutlierDetectionEventValidationError{
field: "UpstreamUrl",
reason: "value length must be at least 1 bytes",
}
}
if _, ok := Action_name[int32(m.GetAction())]; !ok {
return OutlierDetectionEventValidationError{
field: "Action",
reason: "value must be one of the defined enum values",
}
}
// no validation rules for NumEjections
// no validation rules for Enforced
switch m.Event.(type) {
case *OutlierDetectionEvent_EjectSuccessRateEvent:
{
tmp := m.GetEjectSuccessRateEvent()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OutlierDetectionEventValidationError{
field: "EjectSuccessRateEvent",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *OutlierDetectionEvent_EjectConsecutiveEvent:
{
tmp := m.GetEjectConsecutiveEvent()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OutlierDetectionEventValidationError{
field: "EjectConsecutiveEvent",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
default:
return OutlierDetectionEventValidationError{
field: "Event",
reason: "value is required",
}
}
return nil
} | go | func (m *OutlierDetectionEvent) Validate() error {
if m == nil {
return nil
}
if _, ok := OutlierEjectionType_name[int32(m.GetType())]; !ok {
return OutlierDetectionEventValidationError{
field: "Type",
reason: "value must be one of the defined enum values",
}
}
{
tmp := m.GetTimestamp()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OutlierDetectionEventValidationError{
field: "Timestamp",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetSecsSinceLastAction()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OutlierDetectionEventValidationError{
field: "SecsSinceLastAction",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(m.GetClusterName()) < 1 {
return OutlierDetectionEventValidationError{
field: "ClusterName",
reason: "value length must be at least 1 bytes",
}
}
if len(m.GetUpstreamUrl()) < 1 {
return OutlierDetectionEventValidationError{
field: "UpstreamUrl",
reason: "value length must be at least 1 bytes",
}
}
if _, ok := Action_name[int32(m.GetAction())]; !ok {
return OutlierDetectionEventValidationError{
field: "Action",
reason: "value must be one of the defined enum values",
}
}
// no validation rules for NumEjections
// no validation rules for Enforced
switch m.Event.(type) {
case *OutlierDetectionEvent_EjectSuccessRateEvent:
{
tmp := m.GetEjectSuccessRateEvent()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OutlierDetectionEventValidationError{
field: "EjectSuccessRateEvent",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *OutlierDetectionEvent_EjectConsecutiveEvent:
{
tmp := m.GetEjectConsecutiveEvent()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OutlierDetectionEventValidationError{
field: "EjectConsecutiveEvent",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
default:
return OutlierDetectionEventValidationError{
field: "Event",
reason: "value is required",
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"OutlierDetectionEvent",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"OutlierEjectionType_name",
"[",
"int32",
"(",
"m",
".",
"GetType",
... | // Validate checks the field values on OutlierDetectionEvent with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"OutlierDetectionEvent",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/data/cluster/v2alpha/outlier_detection_event.pb.validate.go#L39-L151 | train |
envoyproxy/go-control-plane | envoy/data/cluster/v2alpha/outlier_detection_event.pb.validate.go | Validate | func (m *OutlierEjectSuccessRate) Validate() error {
if m == nil {
return nil
}
if m.GetHostSuccessRate() > 100 {
return OutlierEjectSuccessRateValidationError{
field: "HostSuccessRate",
reason: "value must be less than or equal to 100",
}
}
if m.GetClusterAverageSuccessRate() > 100 {
return OutlierEjectSuccessRateValidationError{
field: "ClusterAverageSuccessRate",
reason: "value must be less than or equal to 100",
}
}
if m.GetClusterSuccessRateEjectionThreshold() > 100 {
return OutlierEjectSuccessRateValidationError{
field: "ClusterSuccessRateEjectionThreshold",
reason: "value must be less than or equal to 100",
}
}
return nil
} | go | func (m *OutlierEjectSuccessRate) Validate() error {
if m == nil {
return nil
}
if m.GetHostSuccessRate() > 100 {
return OutlierEjectSuccessRateValidationError{
field: "HostSuccessRate",
reason: "value must be less than or equal to 100",
}
}
if m.GetClusterAverageSuccessRate() > 100 {
return OutlierEjectSuccessRateValidationError{
field: "ClusterAverageSuccessRate",
reason: "value must be less than or equal to 100",
}
}
if m.GetClusterSuccessRateEjectionThreshold() > 100 {
return OutlierEjectSuccessRateValidationError{
field: "ClusterSuccessRateEjectionThreshold",
reason: "value must be less than or equal to 100",
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"OutlierEjectSuccessRate",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"m",
".",
"GetHostSuccessRate",
"(",
")",
">",
"100",
"{",
"return",
"OutlierEjectSuccessRat... | // Validate checks the field values on OutlierEjectSuccessRate with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"OutlierEjectSuccessRate",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."... | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/data/cluster/v2alpha/outlier_detection_event.pb.validate.go#L212-L239 | train |
envoyproxy/go-control-plane | pkg/cache/resource.go | GetResourceName | func GetResourceName(res Resource) string {
switch v := res.(type) {
case *v2.ClusterLoadAssignment:
return v.GetClusterName()
case *v2.Cluster:
return v.GetName()
case *v2.RouteConfiguration:
return v.GetName()
case *v2.Listener:
return v.GetName()
case *auth.Secret:
return v.GetName()
default:
return ""
}
} | go | func GetResourceName(res Resource) string {
switch v := res.(type) {
case *v2.ClusterLoadAssignment:
return v.GetClusterName()
case *v2.Cluster:
return v.GetName()
case *v2.RouteConfiguration:
return v.GetName()
case *v2.Listener:
return v.GetName()
case *auth.Secret:
return v.GetName()
default:
return ""
}
} | [
"func",
"GetResourceName",
"(",
"res",
"Resource",
")",
"string",
"{",
"switch",
"v",
":=",
"res",
".",
"(",
"type",
")",
"{",
"case",
"*",
"v2",
".",
"ClusterLoadAssignment",
":",
"return",
"v",
".",
"GetClusterName",
"(",
")",
"\n",
"case",
"*",
"v2"... | // GetResourceName returns the resource name for a valid xDS response type. | [
"GetResourceName",
"returns",
"the",
"resource",
"name",
"for",
"a",
"valid",
"xDS",
"response",
"type",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/pkg/cache/resource.go#L58-L73 | train |
envoyproxy/go-control-plane | envoy/config/filter/http/squash/v2/squash.pb.validate.go | Validate | func (m *Squash) Validate() error {
if m == nil {
return nil
}
if len(m.GetCluster()) < 1 {
return SquashValidationError{
field: "Cluster",
reason: "value length must be at least 1 bytes",
}
}
{
tmp := m.GetAttachmentTemplate()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return SquashValidationError{
field: "AttachmentTemplate",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetRequestTimeout()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return SquashValidationError{
field: "RequestTimeout",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetAttachmentTimeout()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return SquashValidationError{
field: "AttachmentTimeout",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetAttachmentPollPeriod()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return SquashValidationError{
field: "AttachmentPollPeriod",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *Squash) Validate() error {
if m == nil {
return nil
}
if len(m.GetCluster()) < 1 {
return SquashValidationError{
field: "Cluster",
reason: "value length must be at least 1 bytes",
}
}
{
tmp := m.GetAttachmentTemplate()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return SquashValidationError{
field: "AttachmentTemplate",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetRequestTimeout()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return SquashValidationError{
field: "RequestTimeout",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetAttachmentTimeout()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return SquashValidationError{
field: "AttachmentTimeout",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetAttachmentPollPeriod()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return SquashValidationError{
field: "AttachmentPollPeriod",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"Squash",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"m",
".",
"GetCluster",
"(",
")",
")",
"<",
"1",
"{",
"return",
"SquashValidationError",
... | // Validate checks the field values on Squash with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"Squash",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/filter/http/squash/v2/squash.pb.validate.go#L38-L111 | train |
envoyproxy/go-control-plane | envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.pb.validate.go | Validate | func (m *Rds) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetConfigSource()
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RdsValidationError{
field: "ConfigSource",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(m.GetRouteConfigName()) < 1 {
return RdsValidationError{
field: "RouteConfigName",
reason: "value length must be at least 1 bytes",
}
}
return nil
} | go | func (m *Rds) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetConfigSource()
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RdsValidationError{
field: "ConfigSource",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(m.GetRouteConfigName()) < 1 {
return RdsValidationError{
field: "RouteConfigName",
reason: "value length must be at least 1 bytes",
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"Rds",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"{",
"tmp",
":=",
"m",
".",
"GetConfigSource",
"(",
")",
"\n\n",
"if",
"v",
",",
"ok",
":=",
"interface",
"{... | // Validate checks the field values on Rds with the rules defined in the proto
// definition for this message. If any rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"Rds",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.pb.validate.go#L463-L491 | train |
envoyproxy/go-control-plane | envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.pb.validate.go | Validate | func (m *HttpFilter) Validate() error {
if m == nil {
return nil
}
if len(m.GetName()) < 1 {
return HttpFilterValidationError{
field: "Name",
reason: "value length must be at least 1 bytes",
}
}
switch m.ConfigType.(type) {
case *HttpFilter_Config:
{
tmp := m.GetConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return HttpFilterValidationError{
field: "Config",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *HttpFilter_TypedConfig:
{
tmp := m.GetTypedConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return HttpFilterValidationError{
field: "TypedConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | go | func (m *HttpFilter) Validate() error {
if m == nil {
return nil
}
if len(m.GetName()) < 1 {
return HttpFilterValidationError{
field: "Name",
reason: "value length must be at least 1 bytes",
}
}
switch m.ConfigType.(type) {
case *HttpFilter_Config:
{
tmp := m.GetConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return HttpFilterValidationError{
field: "Config",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *HttpFilter_TypedConfig:
{
tmp := m.GetTypedConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return HttpFilterValidationError{
field: "TypedConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"HttpFilter",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"m",
".",
"GetName",
"(",
")",
")",
"<",
"1",
"{",
"return",
"HttpFilterValidationError... | // Validate checks the field values on HttpFilter with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"HttpFilter",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.pb.validate.go#L549-L600 | train |
envoyproxy/go-control-plane | envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.pb.validate.go | Validate | func (m *HttpConnectionManager_Tracing) Validate() error {
if m == nil {
return nil
}
if _, ok := HttpConnectionManager_Tracing_OperationName_name[int32(m.GetOperationName())]; !ok {
return HttpConnectionManager_TracingValidationError{
field: "OperationName",
reason: "value must be one of the defined enum values",
}
}
{
tmp := m.GetClientSampling()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return HttpConnectionManager_TracingValidationError{
field: "ClientSampling",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetRandomSampling()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return HttpConnectionManager_TracingValidationError{
field: "RandomSampling",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetOverallSampling()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return HttpConnectionManager_TracingValidationError{
field: "OverallSampling",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
// no validation rules for Verbose
return nil
} | go | func (m *HttpConnectionManager_Tracing) Validate() error {
if m == nil {
return nil
}
if _, ok := HttpConnectionManager_Tracing_OperationName_name[int32(m.GetOperationName())]; !ok {
return HttpConnectionManager_TracingValidationError{
field: "OperationName",
reason: "value must be one of the defined enum values",
}
}
{
tmp := m.GetClientSampling()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return HttpConnectionManager_TracingValidationError{
field: "ClientSampling",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetRandomSampling()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return HttpConnectionManager_TracingValidationError{
field: "RandomSampling",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetOverallSampling()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return HttpConnectionManager_TracingValidationError{
field: "OverallSampling",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
// no validation rules for Verbose
return nil
} | [
"func",
"(",
"m",
"*",
"HttpConnectionManager_Tracing",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"HttpConnectionManager_Tracing_OperationName_name",
"[",
"int32",
"(... | // Validate checks the field values on HttpConnectionManager_Tracing with the
// rules defined in the proto definition for this message. If any rules are
// violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"HttpConnectionManager_Tracing",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",... | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.pb.validate.go#L659-L719 | train |
envoyproxy/go-control-plane | envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.pb.validate.go | Validate | func (m *HttpConnectionManager_SetCurrentClientCertDetails) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetSubject()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return HttpConnectionManager_SetCurrentClientCertDetailsValidationError{
field: "Subject",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
// no validation rules for Cert
// no validation rules for Dns
// no validation rules for Uri
return nil
} | go | func (m *HttpConnectionManager_SetCurrentClientCertDetails) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetSubject()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return HttpConnectionManager_SetCurrentClientCertDetailsValidationError{
field: "Subject",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
// no validation rules for Cert
// no validation rules for Dns
// no validation rules for Uri
return nil
} | [
"func",
"(",
"m",
"*",
"HttpConnectionManager_SetCurrentClientCertDetails",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"{",
"tmp",
":=",
"m",
".",
"GetSubject",
"(",
")",
"\n\n",
"if",
"v",
... | // Validate checks the field values on
// HttpConnectionManager_SetCurrentClientCertDetails with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"HttpConnectionManager_SetCurrentClientCertDetails",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
... | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.pb.validate.go#L852-L879 | train |
envoyproxy/go-control-plane | envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.pb.validate.go | Validate | func (m *HttpConnectionManager_UpgradeConfig) Validate() error {
if m == nil {
return nil
}
// no validation rules for UpgradeType
for idx, item := range m.GetFilters() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return HttpConnectionManager_UpgradeConfigValidationError{
field: fmt.Sprintf("Filters[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
{
tmp := m.GetEnabled()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return HttpConnectionManager_UpgradeConfigValidationError{
field: "Enabled",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *HttpConnectionManager_UpgradeConfig) Validate() error {
if m == nil {
return nil
}
// no validation rules for UpgradeType
for idx, item := range m.GetFilters() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return HttpConnectionManager_UpgradeConfigValidationError{
field: fmt.Sprintf("Filters[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
{
tmp := m.GetEnabled()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return HttpConnectionManager_UpgradeConfigValidationError{
field: "Enabled",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"HttpConnectionManager_UpgradeConfig",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// no validation rules for UpgradeType",
"for",
"idx",
",",
"item",
":=",
"range",
"m",
"... | // Validate checks the field values on HttpConnectionManager_UpgradeConfig with
// the rules defined in the proto definition for this message. If any rules
// are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"HttpConnectionManager_UpgradeConfig",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"retu... | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.pb.validate.go#L948-L991 | train |
envoyproxy/go-control-plane | envoy/config/overload/v2alpha/overload.pb.validate.go | Validate | func (m *ResourceMonitor) Validate() error {
if m == nil {
return nil
}
if len(m.GetName()) < 1 {
return ResourceMonitorValidationError{
field: "Name",
reason: "value length must be at least 1 bytes",
}
}
switch m.ConfigType.(type) {
case *ResourceMonitor_Config:
{
tmp := m.GetConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ResourceMonitorValidationError{
field: "Config",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *ResourceMonitor_TypedConfig:
{
tmp := m.GetTypedConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ResourceMonitorValidationError{
field: "TypedConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | go | func (m *ResourceMonitor) Validate() error {
if m == nil {
return nil
}
if len(m.GetName()) < 1 {
return ResourceMonitorValidationError{
field: "Name",
reason: "value length must be at least 1 bytes",
}
}
switch m.ConfigType.(type) {
case *ResourceMonitor_Config:
{
tmp := m.GetConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ResourceMonitorValidationError{
field: "Config",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *ResourceMonitor_TypedConfig:
{
tmp := m.GetTypedConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ResourceMonitorValidationError{
field: "TypedConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"ResourceMonitor",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"m",
".",
"GetName",
"(",
")",
")",
"<",
"1",
"{",
"return",
"ResourceMonitorValid... | // Validate checks the field values on ResourceMonitor with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"ResourceMonitor",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/overload/v2alpha/overload.pb.validate.go#L39-L90 | train |
envoyproxy/go-control-plane | envoy/config/overload/v2alpha/overload.pb.validate.go | Validate | func (m *ThresholdTrigger) Validate() error {
if m == nil {
return nil
}
if val := m.GetValue(); val < 0 || val > 1 {
return ThresholdTriggerValidationError{
field: "Value",
reason: "value must be inside range [0, 1]",
}
}
return nil
} | go | func (m *ThresholdTrigger) Validate() error {
if m == nil {
return nil
}
if val := m.GetValue(); val < 0 || val > 1 {
return ThresholdTriggerValidationError{
field: "Value",
reason: "value must be inside range [0, 1]",
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"ThresholdTrigger",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"val",
":=",
"m",
".",
"GetValue",
"(",
")",
";",
"val",
"<",
"0",
"||",
"val",
">",
"1",... | // Validate checks the field values on ThresholdTrigger with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"ThresholdTrigger",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/overload/v2alpha/overload.pb.validate.go#L149-L162 | train |
envoyproxy/go-control-plane | envoy/config/overload/v2alpha/overload.pb.validate.go | Validate | func (m *Trigger) Validate() error {
if m == nil {
return nil
}
if len(m.GetName()) < 1 {
return TriggerValidationError{
field: "Name",
reason: "value length must be at least 1 bytes",
}
}
switch m.TriggerOneof.(type) {
case *Trigger_Threshold:
{
tmp := m.GetThreshold()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return TriggerValidationError{
field: "Threshold",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
default:
return TriggerValidationError{
field: "TriggerOneof",
reason: "value is required",
}
}
return nil
} | go | func (m *Trigger) Validate() error {
if m == nil {
return nil
}
if len(m.GetName()) < 1 {
return TriggerValidationError{
field: "Name",
reason: "value length must be at least 1 bytes",
}
}
switch m.TriggerOneof.(type) {
case *Trigger_Threshold:
{
tmp := m.GetThreshold()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return TriggerValidationError{
field: "Threshold",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
default:
return TriggerValidationError{
field: "TriggerOneof",
reason: "value is required",
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"Trigger",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"m",
".",
"GetName",
"(",
")",
")",
"<",
"1",
"{",
"return",
"TriggerValidationError",
"... | // Validate checks the field values on Trigger with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"Trigger",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/overload/v2alpha/overload.pb.validate.go#L220-L260 | train |
envoyproxy/go-control-plane | envoy/config/overload/v2alpha/overload.pb.validate.go | Validate | func (m *OverloadAction) Validate() error {
if m == nil {
return nil
}
if len(m.GetName()) < 1 {
return OverloadActionValidationError{
field: "Name",
reason: "value length must be at least 1 bytes",
}
}
if len(m.GetTriggers()) < 1 {
return OverloadActionValidationError{
field: "Triggers",
reason: "value must contain at least 1 item(s)",
}
}
for idx, item := range m.GetTriggers() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OverloadActionValidationError{
field: fmt.Sprintf("Triggers[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | go | func (m *OverloadAction) Validate() error {
if m == nil {
return nil
}
if len(m.GetName()) < 1 {
return OverloadActionValidationError{
field: "Name",
reason: "value length must be at least 1 bytes",
}
}
if len(m.GetTriggers()) < 1 {
return OverloadActionValidationError{
field: "Triggers",
reason: "value must contain at least 1 item(s)",
}
}
for idx, item := range m.GetTriggers() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OverloadActionValidationError{
field: fmt.Sprintf("Triggers[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"OverloadAction",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"m",
".",
"GetName",
"(",
")",
")",
"<",
"1",
"{",
"return",
"OverloadActionValidat... | // Validate checks the field values on OverloadAction with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"OverloadAction",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/overload/v2alpha/overload.pb.validate.go#L319-L359 | train |
envoyproxy/go-control-plane | envoy/config/overload/v2alpha/overload.pb.validate.go | Validate | func (m *OverloadManager) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetRefreshInterval()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OverloadManagerValidationError{
field: "RefreshInterval",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(m.GetResourceMonitors()) < 1 {
return OverloadManagerValidationError{
field: "ResourceMonitors",
reason: "value must contain at least 1 item(s)",
}
}
for idx, item := range m.GetResourceMonitors() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OverloadManagerValidationError{
field: fmt.Sprintf("ResourceMonitors[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
for idx, item := range m.GetActions() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OverloadManagerValidationError{
field: fmt.Sprintf("Actions[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | go | func (m *OverloadManager) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetRefreshInterval()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OverloadManagerValidationError{
field: "RefreshInterval",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(m.GetResourceMonitors()) < 1 {
return OverloadManagerValidationError{
field: "ResourceMonitors",
reason: "value must contain at least 1 item(s)",
}
}
for idx, item := range m.GetResourceMonitors() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OverloadManagerValidationError{
field: fmt.Sprintf("ResourceMonitors[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
for idx, item := range m.GetActions() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OverloadManagerValidationError{
field: fmt.Sprintf("Actions[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"OverloadManager",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"{",
"tmp",
":=",
"m",
".",
"GetRefreshInterval",
"(",
")",
"\n\n",
"if",
"v",
",",
"ok",
":=",
"i... | // Validate checks the field values on OverloadManager with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"OverloadManager",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/overload/v2alpha/overload.pb.validate.go#L418-L486 | train |
envoyproxy/go-control-plane | envoy/config/filter/http/rbac/v2/rbac.pb.validate.go | Validate | func (m *RBAC) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetRules()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RBACValidationError{
field: "Rules",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetShadowRules()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RBACValidationError{
field: "ShadowRules",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *RBAC) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetRules()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RBACValidationError{
field: "Rules",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetShadowRules()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RBACValidationError{
field: "ShadowRules",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"RBAC",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"{",
"tmp",
":=",
"m",
".",
"GetRules",
"(",
")",
"\n\n",
"if",
"v",
",",
"ok",
":=",
"interface",
"{",
"... | // Validate checks the field values on RBAC with the rules defined in the proto
// definition for this message. If any rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"RBAC",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/filter/http/rbac/v2/rbac.pb.validate.go#L38-L74 | train |
envoyproxy/go-control-plane | envoy/config/filter/http/rbac/v2/rbac.pb.validate.go | Validate | func (m *RBACPerRoute) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetRbac()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RBACPerRouteValidationError{
field: "Rbac",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *RBACPerRoute) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetRbac()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RBACPerRouteValidationError{
field: "Rbac",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"RBACPerRoute",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"{",
"tmp",
":=",
"m",
".",
"GetRbac",
"(",
")",
"\n\n",
"if",
"v",
",",
"ok",
":=",
"interface",
"... | // Validate checks the field values on RBACPerRoute with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"RBACPerRoute",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/filter/http/rbac/v2/rbac.pb.validate.go#L133-L154 | train |
envoyproxy/go-control-plane | envoy/api/v2/discovery.pb.validate.go | Validate | func (m *DiscoveryRequest) Validate() error {
if m == nil {
return nil
}
// no validation rules for VersionInfo
{
tmp := m.GetNode()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DiscoveryRequestValidationError{
field: "Node",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
// no validation rules for TypeUrl
// no validation rules for ResponseNonce
{
tmp := m.GetErrorDetail()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DiscoveryRequestValidationError{
field: "ErrorDetail",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *DiscoveryRequest) Validate() error {
if m == nil {
return nil
}
// no validation rules for VersionInfo
{
tmp := m.GetNode()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DiscoveryRequestValidationError{
field: "Node",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
// no validation rules for TypeUrl
// no validation rules for ResponseNonce
{
tmp := m.GetErrorDetail()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DiscoveryRequestValidationError{
field: "ErrorDetail",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"DiscoveryRequest",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// no validation rules for VersionInfo",
"{",
"tmp",
":=",
"m",
".",
"GetNode",
"(",
")",
"\n\n",
"if",
... | // Validate checks the field values on DiscoveryRequest with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"DiscoveryRequest",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/api/v2/discovery.pb.validate.go#L39-L81 | train |
envoyproxy/go-control-plane | envoy/api/v2/discovery.pb.validate.go | Validate | func (m *DiscoveryResponse) Validate() error {
if m == nil {
return nil
}
// no validation rules for VersionInfo
for idx, item := range m.GetResources() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DiscoveryResponseValidationError{
field: fmt.Sprintf("Resources[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
// no validation rules for Canary
// no validation rules for TypeUrl
// no validation rules for Nonce
{
tmp := m.GetControlPlane()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DiscoveryResponseValidationError{
field: "ControlPlane",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *DiscoveryResponse) Validate() error {
if m == nil {
return nil
}
// no validation rules for VersionInfo
for idx, item := range m.GetResources() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DiscoveryResponseValidationError{
field: fmt.Sprintf("Resources[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
// no validation rules for Canary
// no validation rules for TypeUrl
// no validation rules for Nonce
{
tmp := m.GetControlPlane()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DiscoveryResponseValidationError{
field: "ControlPlane",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"DiscoveryResponse",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// no validation rules for VersionInfo",
"for",
"idx",
",",
"item",
":=",
"range",
"m",
".",
"GetResource... | // Validate checks the field values on DiscoveryResponse with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"DiscoveryResponse",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/api/v2/discovery.pb.validate.go#L140-L189 | train |
envoyproxy/go-control-plane | envoy/api/v2/discovery.pb.validate.go | Validate | func (m *DeltaDiscoveryRequest) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetNode()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DeltaDiscoveryRequestValidationError{
field: "Node",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
// no validation rules for TypeUrl
// no validation rules for InitialResourceVersions
// no validation rules for ResponseNonce
{
tmp := m.GetErrorDetail()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DeltaDiscoveryRequestValidationError{
field: "ErrorDetail",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *DeltaDiscoveryRequest) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetNode()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DeltaDiscoveryRequestValidationError{
field: "Node",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
// no validation rules for TypeUrl
// no validation rules for InitialResourceVersions
// no validation rules for ResponseNonce
{
tmp := m.GetErrorDetail()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DeltaDiscoveryRequestValidationError{
field: "ErrorDetail",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"DeltaDiscoveryRequest",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"{",
"tmp",
":=",
"m",
".",
"GetNode",
"(",
")",
"\n\n",
"if",
"v",
",",
"ok",
":=",
"interf... | // Validate checks the field values on DeltaDiscoveryRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"DeltaDiscoveryRequest",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/api/v2/discovery.pb.validate.go#L250-L292 | train |
envoyproxy/go-control-plane | envoy/api/v2/discovery.pb.validate.go | Validate | func (m *DeltaDiscoveryResponse) Validate() error {
if m == nil {
return nil
}
// no validation rules for SystemVersionInfo
for idx, item := range m.GetResources() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DeltaDiscoveryResponseValidationError{
field: fmt.Sprintf("Resources[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
// no validation rules for Nonce
return nil
} | go | func (m *DeltaDiscoveryResponse) Validate() error {
if m == nil {
return nil
}
// no validation rules for SystemVersionInfo
for idx, item := range m.GetResources() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DeltaDiscoveryResponseValidationError{
field: fmt.Sprintf("Resources[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
// no validation rules for Nonce
return nil
} | [
"func",
"(",
"m",
"*",
"DeltaDiscoveryResponse",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// no validation rules for SystemVersionInfo",
"for",
"idx",
",",
"item",
":=",
"range",
"m",
".",
"... | // Validate checks the field values on DeltaDiscoveryResponse with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"DeltaDiscoveryResponse",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
... | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/api/v2/discovery.pb.validate.go#L353-L383 | train |
envoyproxy/go-control-plane | envoy/api/v2/discovery.pb.validate.go | Validate | func (m *Resource) Validate() error {
if m == nil {
return nil
}
// no validation rules for Name
// no validation rules for Version
{
tmp := m.GetResource()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ResourceValidationError{
field: "Resource",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *Resource) Validate() error {
if m == nil {
return nil
}
// no validation rules for Name
// no validation rules for Version
{
tmp := m.GetResource()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ResourceValidationError{
field: "Resource",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"Resource",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// no validation rules for Name",
"// no validation rules for Version",
"{",
"tmp",
":=",
"m",
".",
"GetResource",
"... | // Validate checks the field values on Resource with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"Resource",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/api/v2/discovery.pb.validate.go#L443-L468 | train |
envoyproxy/go-control-plane | envoy/config/bootstrap/v2/bootstrap.pb.validate.go | Validate | func (m *Admin) Validate() error {
if m == nil {
return nil
}
// no validation rules for AccessLogPath
// no validation rules for ProfilePath
{
tmp := m.GetAddress()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AdminValidationError{
field: "Address",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *Admin) Validate() error {
if m == nil {
return nil
}
// no validation rules for AccessLogPath
// no validation rules for ProfilePath
{
tmp := m.GetAddress()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AdminValidationError{
field: "Address",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"Admin",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// no validation rules for AccessLogPath",
"// no validation rules for ProfilePath",
"{",
"tmp",
":=",
"m",
".",
"GetAddr... | // Validate checks the field values on Admin with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"Admin",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/bootstrap/v2/bootstrap.pb.validate.go#L306-L331 | train |
envoyproxy/go-control-plane | envoy/config/bootstrap/v2/bootstrap.pb.validate.go | Validate | func (m *ClusterManager) Validate() error {
if m == nil {
return nil
}
// no validation rules for LocalClusterName
{
tmp := m.GetOutlierDetection()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClusterManagerValidationError{
field: "OutlierDetection",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetUpstreamBindConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClusterManagerValidationError{
field: "UpstreamBindConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetLoadStatsConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClusterManagerValidationError{
field: "LoadStatsConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *ClusterManager) Validate() error {
if m == nil {
return nil
}
// no validation rules for LocalClusterName
{
tmp := m.GetOutlierDetection()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClusterManagerValidationError{
field: "OutlierDetection",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetUpstreamBindConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClusterManagerValidationError{
field: "UpstreamBindConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetLoadStatsConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClusterManagerValidationError{
field: "LoadStatsConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"ClusterManager",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// no validation rules for LocalClusterName",
"{",
"tmp",
":=",
"m",
".",
"GetOutlierDetection",
"(",
")",
"... | // Validate checks the field values on ClusterManager with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"ClusterManager",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/bootstrap/v2/bootstrap.pb.validate.go#L390-L443 | train |
envoyproxy/go-control-plane | envoy/config/bootstrap/v2/bootstrap.pb.validate.go | Validate | func (m *Watchdog) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetMissTimeout()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return WatchdogValidationError{
field: "MissTimeout",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetMegamissTimeout()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return WatchdogValidationError{
field: "MegamissTimeout",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetKillTimeout()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return WatchdogValidationError{
field: "KillTimeout",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetMultikillTimeout()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return WatchdogValidationError{
field: "MultikillTimeout",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *Watchdog) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetMissTimeout()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return WatchdogValidationError{
field: "MissTimeout",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetMegamissTimeout()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return WatchdogValidationError{
field: "MegamissTimeout",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetKillTimeout()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return WatchdogValidationError{
field: "KillTimeout",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetMultikillTimeout()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return WatchdogValidationError{
field: "MultikillTimeout",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"Watchdog",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"{",
"tmp",
":=",
"m",
".",
"GetMissTimeout",
"(",
")",
"\n\n",
"if",
"v",
",",
"ok",
":=",
"interface",
... | // Validate checks the field values on Watchdog with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"Watchdog",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/bootstrap/v2/bootstrap.pb.validate.go#L501-L567 | train |
envoyproxy/go-control-plane | envoy/config/bootstrap/v2/bootstrap.pb.validate.go | Validate | func (m *Runtime) Validate() error {
if m == nil {
return nil
}
if len(m.GetSymlinkRoot()) < 1 {
return RuntimeValidationError{
field: "SymlinkRoot",
reason: "value length must be at least 1 bytes",
}
}
// no validation rules for Subdirectory
// no validation rules for OverrideSubdirectory
return nil
} | go | func (m *Runtime) Validate() error {
if m == nil {
return nil
}
if len(m.GetSymlinkRoot()) < 1 {
return RuntimeValidationError{
field: "SymlinkRoot",
reason: "value length must be at least 1 bytes",
}
}
// no validation rules for Subdirectory
// no validation rules for OverrideSubdirectory
return nil
} | [
"func",
"(",
"m",
"*",
"Runtime",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"m",
".",
"GetSymlinkRoot",
"(",
")",
")",
"<",
"1",
"{",
"return",
"RuntimeValidationErro... | // Validate checks the field values on Runtime with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"Runtime",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/bootstrap/v2/bootstrap.pb.validate.go#L625-L642 | train |
envoyproxy/go-control-plane | envoy/config/bootstrap/v2/bootstrap.pb.validate.go | Validate | func (m *Bootstrap_StaticResources) Validate() error {
if m == nil {
return nil
}
for idx, item := range m.GetListeners() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return Bootstrap_StaticResourcesValidationError{
field: fmt.Sprintf("Listeners[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
for idx, item := range m.GetClusters() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return Bootstrap_StaticResourcesValidationError{
field: fmt.Sprintf("Clusters[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
for idx, item := range m.GetSecrets() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return Bootstrap_StaticResourcesValidationError{
field: fmt.Sprintf("Secrets[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | go | func (m *Bootstrap_StaticResources) Validate() error {
if m == nil {
return nil
}
for idx, item := range m.GetListeners() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return Bootstrap_StaticResourcesValidationError{
field: fmt.Sprintf("Listeners[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
for idx, item := range m.GetClusters() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return Bootstrap_StaticResourcesValidationError{
field: fmt.Sprintf("Clusters[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
for idx, item := range m.GetSecrets() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return Bootstrap_StaticResourcesValidationError{
field: fmt.Sprintf("Secrets[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"Bootstrap_StaticResources",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"for",
"idx",
",",
"item",
":=",
"range",
"m",
".",
"GetListeners",
"(",
")",
"{",
"_",
",... | // Validate checks the field values on Bootstrap_StaticResources with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"Bootstrap_StaticResources",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"... | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/bootstrap/v2/bootstrap.pb.validate.go#L701-L767 | train |
envoyproxy/go-control-plane | envoy/config/bootstrap/v2/bootstrap.pb.validate.go | Validate | func (m *Bootstrap_DynamicResources) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetLdsConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return Bootstrap_DynamicResourcesValidationError{
field: "LdsConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetCdsConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return Bootstrap_DynamicResourcesValidationError{
field: "CdsConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetAdsConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return Bootstrap_DynamicResourcesValidationError{
field: "AdsConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *Bootstrap_DynamicResources) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetLdsConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return Bootstrap_DynamicResourcesValidationError{
field: "LdsConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetCdsConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return Bootstrap_DynamicResourcesValidationError{
field: "CdsConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetAdsConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return Bootstrap_DynamicResourcesValidationError{
field: "AdsConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"Bootstrap_DynamicResources",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"{",
"tmp",
":=",
"m",
".",
"GetLdsConfig",
"(",
")",
"\n\n",
"if",
"v",
",",
"ok",
":=",... | // Validate checks the field values on Bootstrap_DynamicResources with the
// rules defined in the proto definition for this message. If any rules are
// violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"Bootstrap_DynamicResources",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
... | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/bootstrap/v2/bootstrap.pb.validate.go#L828-L879 | train |
envoyproxy/go-control-plane | pkg/server/server.go | NewServer | func NewServer(config cache.Cache, callbacks Callbacks) Server {
return &server{cache: config, callbacks: callbacks}
} | go | func NewServer(config cache.Cache, callbacks Callbacks) Server {
return &server{cache: config, callbacks: callbacks}
} | [
"func",
"NewServer",
"(",
"config",
"cache",
".",
"Cache",
",",
"callbacks",
"Callbacks",
")",
"Server",
"{",
"return",
"&",
"server",
"{",
"cache",
":",
"config",
",",
"callbacks",
":",
"callbacks",
"}",
"\n",
"}"
] | // NewServer creates handlers from a config watcher and callbacks. | [
"NewServer",
"creates",
"handlers",
"from",
"a",
"config",
"watcher",
"and",
"callbacks",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/pkg/server/server.go#L69-L71 | train |
envoyproxy/go-control-plane | pkg/server/server.go | Cancel | func (values watches) Cancel() {
if values.endpointCancel != nil {
values.endpointCancel()
}
if values.clusterCancel != nil {
values.clusterCancel()
}
if values.routeCancel != nil {
values.routeCancel()
}
if values.listenerCancel != nil {
values.listenerCancel()
}
if values.secretCancel != nil {
values.secretCancel()
}
} | go | func (values watches) Cancel() {
if values.endpointCancel != nil {
values.endpointCancel()
}
if values.clusterCancel != nil {
values.clusterCancel()
}
if values.routeCancel != nil {
values.routeCancel()
}
if values.listenerCancel != nil {
values.listenerCancel()
}
if values.secretCancel != nil {
values.secretCancel()
}
} | [
"func",
"(",
"values",
"watches",
")",
"Cancel",
"(",
")",
"{",
"if",
"values",
".",
"endpointCancel",
"!=",
"nil",
"{",
"values",
".",
"endpointCancel",
"(",
")",
"\n",
"}",
"\n",
"if",
"values",
".",
"clusterCancel",
"!=",
"nil",
"{",
"values",
".",
... | // Cancel all watches | [
"Cancel",
"all",
"watches"
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/pkg/server/server.go#L110-L126 | train |
envoyproxy/go-control-plane | pkg/server/server.go | handler | func (s *server) handler(stream stream, typeURL string) error {
// a channel for receiving incoming requests
reqCh := make(chan *v2.DiscoveryRequest)
reqStop := int32(0)
go func() {
for {
req, err := stream.Recv()
if atomic.LoadInt32(&reqStop) != 0 {
return
}
if err != nil {
close(reqCh)
return
}
reqCh <- req
}
}()
err := s.process(stream, reqCh, typeURL)
// prevents writing to a closed channel if send failed on blocked recv
// TODO(kuat) figure out how to unblock recv through gRPC API
atomic.StoreInt32(&reqStop, 1)
return err
} | go | func (s *server) handler(stream stream, typeURL string) error {
// a channel for receiving incoming requests
reqCh := make(chan *v2.DiscoveryRequest)
reqStop := int32(0)
go func() {
for {
req, err := stream.Recv()
if atomic.LoadInt32(&reqStop) != 0 {
return
}
if err != nil {
close(reqCh)
return
}
reqCh <- req
}
}()
err := s.process(stream, reqCh, typeURL)
// prevents writing to a closed channel if send failed on blocked recv
// TODO(kuat) figure out how to unblock recv through gRPC API
atomic.StoreInt32(&reqStop, 1)
return err
} | [
"func",
"(",
"s",
"*",
"server",
")",
"handler",
"(",
"stream",
"stream",
",",
"typeURL",
"string",
")",
"error",
"{",
"// a channel for receiving incoming requests",
"reqCh",
":=",
"make",
"(",
"chan",
"*",
"v2",
".",
"DiscoveryRequest",
")",
"\n",
"reqStop",... | // handler converts a blocking read call to channels and initiates stream processing | [
"handler",
"converts",
"a",
"blocking",
"read",
"call",
"to",
"channels",
"and",
"initiates",
"stream",
"processing"
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/pkg/server/server.go#L304-L329 | train |
envoyproxy/go-control-plane | pkg/server/server.go | Fetch | func (s *server) Fetch(ctx context.Context, req *v2.DiscoveryRequest) (*v2.DiscoveryResponse, error) {
if s.callbacks != nil {
if err := s.callbacks.OnFetchRequest(ctx, req); err != nil {
return nil, err
}
}
resp, err := s.cache.Fetch(ctx, *req)
if err != nil {
return nil, err
}
out, err := createResponse(resp, req.TypeUrl)
if s.callbacks != nil {
s.callbacks.OnFetchResponse(req, out)
}
return out, err
} | go | func (s *server) Fetch(ctx context.Context, req *v2.DiscoveryRequest) (*v2.DiscoveryResponse, error) {
if s.callbacks != nil {
if err := s.callbacks.OnFetchRequest(ctx, req); err != nil {
return nil, err
}
}
resp, err := s.cache.Fetch(ctx, *req)
if err != nil {
return nil, err
}
out, err := createResponse(resp, req.TypeUrl)
if s.callbacks != nil {
s.callbacks.OnFetchResponse(req, out)
}
return out, err
} | [
"func",
"(",
"s",
"*",
"server",
")",
"Fetch",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"v2",
".",
"DiscoveryRequest",
")",
"(",
"*",
"v2",
".",
"DiscoveryResponse",
",",
"error",
")",
"{",
"if",
"s",
".",
"callbacks",
"!=",
"nil",
"... | // Fetch is the universal fetch method. | [
"Fetch",
"is",
"the",
"universal",
"fetch",
"method",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/pkg/server/server.go#L356-L371 | train |
envoyproxy/go-control-plane | envoy/api/v2/core/grpc_service.pb.validate.go | Validate | func (m *GrpcService) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetTimeout()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcServiceValidationError{
field: "Timeout",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
for idx, item := range m.GetInitialMetadata() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcServiceValidationError{
field: fmt.Sprintf("InitialMetadata[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
switch m.TargetSpecifier.(type) {
case *GrpcService_EnvoyGrpc_:
{
tmp := m.GetEnvoyGrpc()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcServiceValidationError{
field: "EnvoyGrpc",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *GrpcService_GoogleGrpc_:
{
tmp := m.GetGoogleGrpc()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcServiceValidationError{
field: "GoogleGrpc",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
default:
return GrpcServiceValidationError{
field: "TargetSpecifier",
reason: "value is required",
}
}
return nil
} | go | func (m *GrpcService) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetTimeout()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcServiceValidationError{
field: "Timeout",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
for idx, item := range m.GetInitialMetadata() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcServiceValidationError{
field: fmt.Sprintf("InitialMetadata[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
switch m.TargetSpecifier.(type) {
case *GrpcService_EnvoyGrpc_:
{
tmp := m.GetEnvoyGrpc()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcServiceValidationError{
field: "EnvoyGrpc",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *GrpcService_GoogleGrpc_:
{
tmp := m.GetGoogleGrpc()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcServiceValidationError{
field: "GoogleGrpc",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
default:
return GrpcServiceValidationError{
field: "TargetSpecifier",
reason: "value is required",
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"GrpcService",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"{",
"tmp",
":=",
"m",
".",
"GetTimeout",
"(",
")",
"\n\n",
"if",
"v",
",",
"ok",
":=",
"interface",
... | // Validate checks the field values on GrpcService with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"GrpcService",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/api/v2/core/grpc_service.pb.validate.go#L39-L124 | train |
envoyproxy/go-control-plane | envoy/api/v2/core/grpc_service.pb.validate.go | Validate | func (m *GrpcService_EnvoyGrpc) Validate() error {
if m == nil {
return nil
}
if len(m.GetClusterName()) < 1 {
return GrpcService_EnvoyGrpcValidationError{
field: "ClusterName",
reason: "value length must be at least 1 bytes",
}
}
return nil
} | go | func (m *GrpcService_EnvoyGrpc) Validate() error {
if m == nil {
return nil
}
if len(m.GetClusterName()) < 1 {
return GrpcService_EnvoyGrpcValidationError{
field: "ClusterName",
reason: "value length must be at least 1 bytes",
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"GrpcService_EnvoyGrpc",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"m",
".",
"GetClusterName",
"(",
")",
")",
"<",
"1",
"{",
"return",
"GrpcSer... | // Validate checks the field values on GrpcService_EnvoyGrpc with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"GrpcService_EnvoyGrpc",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/api/v2/core/grpc_service.pb.validate.go#L183-L196 | train |
envoyproxy/go-control-plane | envoy/api/v2/core/grpc_service.pb.validate.go | Validate | func (m *GrpcService_GoogleGrpc) Validate() error {
if m == nil {
return nil
}
if len(m.GetTargetUri()) < 1 {
return GrpcService_GoogleGrpcValidationError{
field: "TargetUri",
reason: "value length must be at least 1 bytes",
}
}
{
tmp := m.GetChannelCredentials()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpcValidationError{
field: "ChannelCredentials",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
for idx, item := range m.GetCallCredentials() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpcValidationError{
field: fmt.Sprintf("CallCredentials[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
if len(m.GetStatPrefix()) < 1 {
return GrpcService_GoogleGrpcValidationError{
field: "StatPrefix",
reason: "value length must be at least 1 bytes",
}
}
// no validation rules for CredentialsFactoryName
{
tmp := m.GetConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpcValidationError{
field: "Config",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *GrpcService_GoogleGrpc) Validate() error {
if m == nil {
return nil
}
if len(m.GetTargetUri()) < 1 {
return GrpcService_GoogleGrpcValidationError{
field: "TargetUri",
reason: "value length must be at least 1 bytes",
}
}
{
tmp := m.GetChannelCredentials()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpcValidationError{
field: "ChannelCredentials",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
for idx, item := range m.GetCallCredentials() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpcValidationError{
field: fmt.Sprintf("CallCredentials[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
if len(m.GetStatPrefix()) < 1 {
return GrpcService_GoogleGrpcValidationError{
field: "StatPrefix",
reason: "value length must be at least 1 bytes",
}
}
// no validation rules for CredentialsFactoryName
{
tmp := m.GetConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpcValidationError{
field: "Config",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"GrpcService_GoogleGrpc",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"m",
".",
"GetTargetUri",
"(",
")",
")",
"<",
"1",
"{",
"return",
"GrpcServ... | // Validate checks the field values on GrpcService_GoogleGrpc with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"GrpcService_GoogleGrpc",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
... | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/api/v2/core/grpc_service.pb.validate.go#L257-L329 | train |
envoyproxy/go-control-plane | envoy/api/v2/core/grpc_service.pb.validate.go | Validate | func (m *GrpcService_GoogleGrpc_SslCredentials) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetRootCerts()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_SslCredentialsValidationError{
field: "RootCerts",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetPrivateKey()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_SslCredentialsValidationError{
field: "PrivateKey",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetCertChain()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_SslCredentialsValidationError{
field: "CertChain",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *GrpcService_GoogleGrpc_SslCredentials) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetRootCerts()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_SslCredentialsValidationError{
field: "RootCerts",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetPrivateKey()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_SslCredentialsValidationError{
field: "PrivateKey",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetCertChain()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_SslCredentialsValidationError{
field: "CertChain",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"GrpcService_GoogleGrpc_SslCredentials",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"{",
"tmp",
":=",
"m",
".",
"GetRootCerts",
"(",
")",
"\n\n",
"if",
"v",
",",
"o... | // Validate checks the field values on GrpcService_GoogleGrpc_SslCredentials
// with the rules defined in the proto definition for this message. If any
// rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"GrpcService_GoogleGrpc_SslCredentials",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"re... | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/api/v2/core/grpc_service.pb.validate.go#L390-L441 | train |
envoyproxy/go-control-plane | envoy/api/v2/core/grpc_service.pb.validate.go | Validate | func (m *GrpcService_GoogleGrpc_ChannelCredentials) Validate() error {
if m == nil {
return nil
}
switch m.CredentialSpecifier.(type) {
case *GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials:
{
tmp := m.GetSslCredentials()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_ChannelCredentialsValidationError{
field: "SslCredentials",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault:
{
tmp := m.GetGoogleDefault()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_ChannelCredentialsValidationError{
field: "GoogleDefault",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials:
{
tmp := m.GetLocalCredentials()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_ChannelCredentialsValidationError{
field: "LocalCredentials",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
default:
return GrpcService_GoogleGrpc_ChannelCredentialsValidationError{
field: "CredentialSpecifier",
reason: "value is required",
}
}
return nil
} | go | func (m *GrpcService_GoogleGrpc_ChannelCredentials) Validate() error {
if m == nil {
return nil
}
switch m.CredentialSpecifier.(type) {
case *GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials:
{
tmp := m.GetSslCredentials()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_ChannelCredentialsValidationError{
field: "SslCredentials",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault:
{
tmp := m.GetGoogleDefault()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_ChannelCredentialsValidationError{
field: "GoogleDefault",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials:
{
tmp := m.GetLocalCredentials()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_ChannelCredentialsValidationError{
field: "LocalCredentials",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
default:
return GrpcService_GoogleGrpc_ChannelCredentialsValidationError{
field: "CredentialSpecifier",
reason: "value is required",
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"GrpcService_GoogleGrpc_ChannelCredentials",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"switch",
"m",
".",
"CredentialSpecifier",
".",
"(",
"type",
")",
"{",
"case",
"... | // Validate checks the field values on
// GrpcService_GoogleGrpc_ChannelCredentials with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"GrpcService_GoogleGrpc_ChannelCredentials",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
... | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/api/v2/core/grpc_service.pb.validate.go#L572-L639 | train |
envoyproxy/go-control-plane | envoy/api/v2/core/grpc_service.pb.validate.go | Validate | func (m *GrpcService_GoogleGrpc_CallCredentials) Validate() error {
if m == nil {
return nil
}
switch m.CredentialSpecifier.(type) {
case *GrpcService_GoogleGrpc_CallCredentials_AccessToken:
// no validation rules for AccessToken
case *GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine:
{
tmp := m.GetGoogleComputeEngine()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_CallCredentialsValidationError{
field: "GoogleComputeEngine",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken:
// no validation rules for GoogleRefreshToken
case *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess:
{
tmp := m.GetServiceAccountJwtAccess()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_CallCredentialsValidationError{
field: "ServiceAccountJwtAccess",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *GrpcService_GoogleGrpc_CallCredentials_GoogleIam:
{
tmp := m.GetGoogleIam()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_CallCredentialsValidationError{
field: "GoogleIam",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *GrpcService_GoogleGrpc_CallCredentials_FromPlugin:
{
tmp := m.GetFromPlugin()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_CallCredentialsValidationError{
field: "FromPlugin",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
default:
return GrpcService_GoogleGrpc_CallCredentialsValidationError{
field: "CredentialSpecifier",
reason: "value is required",
}
}
return nil
} | go | func (m *GrpcService_GoogleGrpc_CallCredentials) Validate() error {
if m == nil {
return nil
}
switch m.CredentialSpecifier.(type) {
case *GrpcService_GoogleGrpc_CallCredentials_AccessToken:
// no validation rules for AccessToken
case *GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine:
{
tmp := m.GetGoogleComputeEngine()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_CallCredentialsValidationError{
field: "GoogleComputeEngine",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken:
// no validation rules for GoogleRefreshToken
case *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess:
{
tmp := m.GetServiceAccountJwtAccess()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_CallCredentialsValidationError{
field: "ServiceAccountJwtAccess",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *GrpcService_GoogleGrpc_CallCredentials_GoogleIam:
{
tmp := m.GetGoogleIam()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_CallCredentialsValidationError{
field: "GoogleIam",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *GrpcService_GoogleGrpc_CallCredentials_FromPlugin:
{
tmp := m.GetFromPlugin()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_CallCredentialsValidationError{
field: "FromPlugin",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
default:
return GrpcService_GoogleGrpc_CallCredentialsValidationError{
field: "CredentialSpecifier",
reason: "value is required",
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"GrpcService_GoogleGrpc_CallCredentials",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"switch",
"m",
".",
"CredentialSpecifier",
".",
"(",
"type",
")",
"{",
"case",
"*",... | // Validate checks the field values on GrpcService_GoogleGrpc_CallCredentials
// with the rules defined in the proto definition for this message. If any
// rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"GrpcService_GoogleGrpc_CallCredentials",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"r... | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/api/v2/core/grpc_service.pb.validate.go#L701-L791 | train |
envoyproxy/go-control-plane | envoy/api/v2/core/grpc_service.pb.validate.go | Validate | func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) Validate() error {
if m == nil {
return nil
}
// no validation rules for Name
switch m.ConfigType.(type) {
case *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_Config:
{
tmp := m.GetConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError{
field: "Config",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_TypedConfig:
{
tmp := m.GetTypedConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError{
field: "TypedConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | go | func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) Validate() error {
if m == nil {
return nil
}
// no validation rules for Name
switch m.ConfigType.(type) {
case *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_Config:
{
tmp := m.GetConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError{
field: "Config",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_TypedConfig:
{
tmp := m.GetTypedConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError{
field: "TypedConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// no validation rules for Name",
"switch",
"m",
".",
"ConfigTyp... | // Validate checks the field values on
// GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin with
// the rules defined in the proto definition for this message. If any rules
// are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
... | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/api/v2/core/grpc_service.pb.validate.go#L1018-L1064 | train |
envoyproxy/go-control-plane | envoy/admin/v2alpha/config_dump.pb.validate.go | Validate | func (m *ConfigDump) Validate() error {
if m == nil {
return nil
}
for idx, item := range m.GetConfigs() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ConfigDumpValidationError{
field: fmt.Sprintf("Configs[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | go | func (m *ConfigDump) Validate() error {
if m == nil {
return nil
}
for idx, item := range m.GetConfigs() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ConfigDumpValidationError{
field: fmt.Sprintf("Configs[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"ConfigDump",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"for",
"idx",
",",
"item",
":=",
"range",
"m",
".",
"GetConfigs",
"(",
")",
"{",
"_",
",",
"_",
"=",
... | // Validate checks the field values on ConfigDump with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"ConfigDump",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/admin/v2alpha/config_dump.pb.validate.go#L38-L64 | train |
envoyproxy/go-control-plane | envoy/admin/v2alpha/config_dump.pb.validate.go | Validate | func (m *BootstrapConfigDump) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetBootstrap()
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return BootstrapConfigDumpValidationError{
field: "Bootstrap",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetLastUpdated()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return BootstrapConfigDumpValidationError{
field: "LastUpdated",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *BootstrapConfigDump) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetBootstrap()
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return BootstrapConfigDumpValidationError{
field: "Bootstrap",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetLastUpdated()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return BootstrapConfigDumpValidationError{
field: "LastUpdated",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"BootstrapConfigDump",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"{",
"tmp",
":=",
"m",
".",
"GetBootstrap",
"(",
")",
"\n\n",
"if",
"v",
",",
"ok",
":=",
"int... | // Validate checks the field values on BootstrapConfigDump with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"BootstrapConfigDump",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/admin/v2alpha/config_dump.pb.validate.go#L123-L159 | train |
envoyproxy/go-control-plane | envoy/admin/v2alpha/config_dump.pb.validate.go | Validate | func (m *ListenersConfigDump) Validate() error {
if m == nil {
return nil
}
// no validation rules for VersionInfo
for idx, item := range m.GetStaticListeners() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ListenersConfigDumpValidationError{
field: fmt.Sprintf("StaticListeners[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
for idx, item := range m.GetDynamicActiveListeners() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ListenersConfigDumpValidationError{
field: fmt.Sprintf("DynamicActiveListeners[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
for idx, item := range m.GetDynamicWarmingListeners() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ListenersConfigDumpValidationError{
field: fmt.Sprintf("DynamicWarmingListeners[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
for idx, item := range m.GetDynamicDrainingListeners() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ListenersConfigDumpValidationError{
field: fmt.Sprintf("DynamicDrainingListeners[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | go | func (m *ListenersConfigDump) Validate() error {
if m == nil {
return nil
}
// no validation rules for VersionInfo
for idx, item := range m.GetStaticListeners() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ListenersConfigDumpValidationError{
field: fmt.Sprintf("StaticListeners[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
for idx, item := range m.GetDynamicActiveListeners() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ListenersConfigDumpValidationError{
field: fmt.Sprintf("DynamicActiveListeners[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
for idx, item := range m.GetDynamicWarmingListeners() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ListenersConfigDumpValidationError{
field: fmt.Sprintf("DynamicWarmingListeners[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
for idx, item := range m.GetDynamicDrainingListeners() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ListenersConfigDumpValidationError{
field: fmt.Sprintf("DynamicDrainingListeners[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"ListenersConfigDump",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// no validation rules for VersionInfo",
"for",
"idx",
",",
"item",
":=",
"range",
"m",
".",
"GetStatic... | // Validate checks the field values on ListenersConfigDump with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"ListenersConfigDump",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/admin/v2alpha/config_dump.pb.validate.go#L220-L308 | train |
envoyproxy/go-control-plane | envoy/admin/v2alpha/config_dump.pb.validate.go | Validate | func (m *ClustersConfigDump) Validate() error {
if m == nil {
return nil
}
// no validation rules for VersionInfo
for idx, item := range m.GetStaticClusters() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClustersConfigDumpValidationError{
field: fmt.Sprintf("StaticClusters[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
for idx, item := range m.GetDynamicActiveClusters() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClustersConfigDumpValidationError{
field: fmt.Sprintf("DynamicActiveClusters[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
for idx, item := range m.GetDynamicWarmingClusters() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClustersConfigDumpValidationError{
field: fmt.Sprintf("DynamicWarmingClusters[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | go | func (m *ClustersConfigDump) Validate() error {
if m == nil {
return nil
}
// no validation rules for VersionInfo
for idx, item := range m.GetStaticClusters() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClustersConfigDumpValidationError{
field: fmt.Sprintf("StaticClusters[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
for idx, item := range m.GetDynamicActiveClusters() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClustersConfigDumpValidationError{
field: fmt.Sprintf("DynamicActiveClusters[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
for idx, item := range m.GetDynamicWarmingClusters() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClustersConfigDumpValidationError{
field: fmt.Sprintf("DynamicWarmingClusters[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"ClustersConfigDump",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// no validation rules for VersionInfo",
"for",
"idx",
",",
"item",
":=",
"range",
"m",
".",
"GetStaticC... | // Validate checks the field values on ClustersConfigDump with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"ClustersConfigDump",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/admin/v2alpha/config_dump.pb.validate.go#L369-L437 | train |
envoyproxy/go-control-plane | envoy/admin/v2alpha/config_dump.pb.validate.go | Validate | func (m *RoutesConfigDump) Validate() error {
if m == nil {
return nil
}
for idx, item := range m.GetStaticRouteConfigs() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RoutesConfigDumpValidationError{
field: fmt.Sprintf("StaticRouteConfigs[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
for idx, item := range m.GetDynamicRouteConfigs() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RoutesConfigDumpValidationError{
field: fmt.Sprintf("DynamicRouteConfigs[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | go | func (m *RoutesConfigDump) Validate() error {
if m == nil {
return nil
}
for idx, item := range m.GetStaticRouteConfigs() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RoutesConfigDumpValidationError{
field: fmt.Sprintf("StaticRouteConfigs[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
for idx, item := range m.GetDynamicRouteConfigs() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RoutesConfigDumpValidationError{
field: fmt.Sprintf("DynamicRouteConfigs[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"RoutesConfigDump",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"for",
"idx",
",",
"item",
":=",
"range",
"m",
".",
"GetStaticRouteConfigs",
"(",
")",
"{",
"_",
",... | // Validate checks the field values on RoutesConfigDump with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"RoutesConfigDump",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/admin/v2alpha/config_dump.pb.validate.go#L498-L544 | train |
envoyproxy/go-control-plane | envoy/admin/v2alpha/config_dump.pb.validate.go | Validate | func (m *ListenersConfigDump_StaticListener) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetListener()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ListenersConfigDump_StaticListenerValidationError{
field: "Listener",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetLastUpdated()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ListenersConfigDump_StaticListenerValidationError{
field: "LastUpdated",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *ListenersConfigDump_StaticListener) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetListener()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ListenersConfigDump_StaticListenerValidationError{
field: "Listener",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetLastUpdated()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ListenersConfigDump_StaticListenerValidationError{
field: "LastUpdated",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"ListenersConfigDump_StaticListener",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"{",
"tmp",
":=",
"m",
".",
"GetListener",
"(",
")",
"\n\n",
"if",
"v",
",",
"ok",
... | // Validate checks the field values on ListenersConfigDump_StaticListener with
// the rules defined in the proto definition for this message. If any rules
// are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"ListenersConfigDump_StaticListener",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"retur... | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/admin/v2alpha/config_dump.pb.validate.go#L603-L639 | train |
envoyproxy/go-control-plane | envoy/admin/v2alpha/config_dump.pb.validate.go | Validate | func (m *ListenersConfigDump_DynamicListener) Validate() error {
if m == nil {
return nil
}
// no validation rules for VersionInfo
{
tmp := m.GetListener()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ListenersConfigDump_DynamicListenerValidationError{
field: "Listener",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetLastUpdated()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ListenersConfigDump_DynamicListenerValidationError{
field: "LastUpdated",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *ListenersConfigDump_DynamicListener) Validate() error {
if m == nil {
return nil
}
// no validation rules for VersionInfo
{
tmp := m.GetListener()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ListenersConfigDump_DynamicListenerValidationError{
field: "Listener",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetLastUpdated()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ListenersConfigDump_DynamicListenerValidationError{
field: "LastUpdated",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"ListenersConfigDump_DynamicListener",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// no validation rules for VersionInfo",
"{",
"tmp",
":=",
"m",
".",
"GetListener",
"(",
... | // Validate checks the field values on ListenersConfigDump_DynamicListener with
// the rules defined in the proto definition for this message. If any rules
// are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"ListenersConfigDump_DynamicListener",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"retu... | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/admin/v2alpha/config_dump.pb.validate.go#L701-L739 | train |
envoyproxy/go-control-plane | envoy/admin/v2alpha/config_dump.pb.validate.go | Validate | func (m *ClustersConfigDump_StaticCluster) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetCluster()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClustersConfigDump_StaticClusterValidationError{
field: "Cluster",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetLastUpdated()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClustersConfigDump_StaticClusterValidationError{
field: "LastUpdated",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *ClustersConfigDump_StaticCluster) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetCluster()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClustersConfigDump_StaticClusterValidationError{
field: "Cluster",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetLastUpdated()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClustersConfigDump_StaticClusterValidationError{
field: "LastUpdated",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"ClustersConfigDump_StaticCluster",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"{",
"tmp",
":=",
"m",
".",
"GetCluster",
"(",
")",
"\n\n",
"if",
"v",
",",
"ok",
"... | // Validate checks the field values on ClustersConfigDump_StaticCluster with
// the rules defined in the proto definition for this message. If any rules
// are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"ClustersConfigDump_StaticCluster",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returne... | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/admin/v2alpha/config_dump.pb.validate.go#L801-L837 | train |
envoyproxy/go-control-plane | envoy/admin/v2alpha/config_dump.pb.validate.go | Validate | func (m *ClustersConfigDump_DynamicCluster) Validate() error {
if m == nil {
return nil
}
// no validation rules for VersionInfo
{
tmp := m.GetCluster()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClustersConfigDump_DynamicClusterValidationError{
field: "Cluster",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetLastUpdated()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClustersConfigDump_DynamicClusterValidationError{
field: "LastUpdated",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *ClustersConfigDump_DynamicCluster) Validate() error {
if m == nil {
return nil
}
// no validation rules for VersionInfo
{
tmp := m.GetCluster()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClustersConfigDump_DynamicClusterValidationError{
field: "Cluster",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetLastUpdated()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClustersConfigDump_DynamicClusterValidationError{
field: "LastUpdated",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"ClustersConfigDump_DynamicCluster",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// no validation rules for VersionInfo",
"{",
"tmp",
":=",
"m",
".",
"GetCluster",
"(",
")"... | // Validate checks the field values on ClustersConfigDump_DynamicCluster with
// the rules defined in the proto definition for this message. If any rules
// are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"ClustersConfigDump_DynamicCluster",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"return... | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/admin/v2alpha/config_dump.pb.validate.go#L899-L937 | train |
envoyproxy/go-control-plane | envoy/admin/v2alpha/config_dump.pb.validate.go | Validate | func (m *RoutesConfigDump_StaticRouteConfig) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetRouteConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RoutesConfigDump_StaticRouteConfigValidationError{
field: "RouteConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetLastUpdated()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RoutesConfigDump_StaticRouteConfigValidationError{
field: "LastUpdated",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *RoutesConfigDump_StaticRouteConfig) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetRouteConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RoutesConfigDump_StaticRouteConfigValidationError{
field: "RouteConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetLastUpdated()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RoutesConfigDump_StaticRouteConfigValidationError{
field: "LastUpdated",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"RoutesConfigDump_StaticRouteConfig",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"{",
"tmp",
":=",
"m",
".",
"GetRouteConfig",
"(",
")",
"\n\n",
"if",
"v",
",",
"ok... | // Validate checks the field values on RoutesConfigDump_StaticRouteConfig with
// the rules defined in the proto definition for this message. If any rules
// are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"RoutesConfigDump_StaticRouteConfig",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"retur... | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/admin/v2alpha/config_dump.pb.validate.go#L999-L1035 | train |
envoyproxy/go-control-plane | envoy/admin/v2alpha/config_dump.pb.validate.go | Validate | func (m *RoutesConfigDump_DynamicRouteConfig) Validate() error {
if m == nil {
return nil
}
// no validation rules for VersionInfo
{
tmp := m.GetRouteConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RoutesConfigDump_DynamicRouteConfigValidationError{
field: "RouteConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetLastUpdated()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RoutesConfigDump_DynamicRouteConfigValidationError{
field: "LastUpdated",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *RoutesConfigDump_DynamicRouteConfig) Validate() error {
if m == nil {
return nil
}
// no validation rules for VersionInfo
{
tmp := m.GetRouteConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RoutesConfigDump_DynamicRouteConfigValidationError{
field: "RouteConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetLastUpdated()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RoutesConfigDump_DynamicRouteConfigValidationError{
field: "LastUpdated",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"RoutesConfigDump_DynamicRouteConfig",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// no validation rules for VersionInfo",
"{",
"tmp",
":=",
"m",
".",
"GetRouteConfig",
"(",... | // Validate checks the field values on RoutesConfigDump_DynamicRouteConfig with
// the rules defined in the proto definition for this message. If any rules
// are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"RoutesConfigDump_DynamicRouteConfig",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"retu... | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/admin/v2alpha/config_dump.pb.validate.go#L1097-L1135 | train |
envoyproxy/go-control-plane | envoy/admin/v2alpha/certs.pb.validate.go | Validate | func (m *Certificates) Validate() error {
if m == nil {
return nil
}
for idx, item := range m.GetCertificates() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return CertificatesValidationError{
field: fmt.Sprintf("Certificates[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | go | func (m *Certificates) Validate() error {
if m == nil {
return nil
}
for idx, item := range m.GetCertificates() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return CertificatesValidationError{
field: fmt.Sprintf("Certificates[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"Certificates",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"for",
"idx",
",",
"item",
":=",
"range",
"m",
".",
"GetCertificates",
"(",
")",
"{",
"_",
",",
"_",
... | // Validate checks the field values on Certificates with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"Certificates",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/admin/v2alpha/certs.pb.validate.go#L39-L65 | train |
envoyproxy/go-control-plane | envoy/admin/v2alpha/certs.pb.validate.go | Validate | func (m *Certificate) Validate() error {
if m == nil {
return nil
}
for idx, item := range m.GetCaCert() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return CertificateValidationError{
field: fmt.Sprintf("CaCert[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
for idx, item := range m.GetCertChain() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return CertificateValidationError{
field: fmt.Sprintf("CertChain[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | go | func (m *Certificate) Validate() error {
if m == nil {
return nil
}
for idx, item := range m.GetCaCert() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return CertificateValidationError{
field: fmt.Sprintf("CaCert[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
for idx, item := range m.GetCertChain() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return CertificateValidationError{
field: fmt.Sprintf("CertChain[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"Certificate",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"for",
"idx",
",",
"item",
":=",
"range",
"m",
".",
"GetCaCert",
"(",
")",
"{",
"_",
",",
"_",
"=",
... | // Validate checks the field values on Certificate with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"Certificate",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/admin/v2alpha/certs.pb.validate.go#L124-L170 | train |
envoyproxy/go-control-plane | envoy/admin/v2alpha/certs.pb.validate.go | Validate | func (m *CertificateDetails) Validate() error {
if m == nil {
return nil
}
// no validation rules for Path
// no validation rules for SerialNumber
for idx, item := range m.GetSubjectAltNames() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return CertificateDetailsValidationError{
field: fmt.Sprintf("SubjectAltNames[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
// no validation rules for DaysUntilExpiration
{
tmp := m.GetValidFrom()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return CertificateDetailsValidationError{
field: "ValidFrom",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetExpirationTime()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return CertificateDetailsValidationError{
field: "ExpirationTime",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *CertificateDetails) Validate() error {
if m == nil {
return nil
}
// no validation rules for Path
// no validation rules for SerialNumber
for idx, item := range m.GetSubjectAltNames() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return CertificateDetailsValidationError{
field: fmt.Sprintf("SubjectAltNames[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
// no validation rules for DaysUntilExpiration
{
tmp := m.GetValidFrom()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return CertificateDetailsValidationError{
field: "ValidFrom",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetExpirationTime()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return CertificateDetailsValidationError{
field: "ExpirationTime",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"CertificateDetails",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// no validation rules for Path",
"// no validation rules for SerialNumber",
"for",
"idx",
",",
"item",
":=",
... | // Validate checks the field values on CertificateDetails with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"CertificateDetails",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/admin/v2alpha/certs.pb.validate.go#L229-L291 | train |
envoyproxy/go-control-plane | envoy/admin/v2alpha/certs.pb.validate.go | Validate | func (m *SubjectAlternateName) Validate() error {
if m == nil {
return nil
}
switch m.Name.(type) {
case *SubjectAlternateName_Dns:
// no validation rules for Dns
case *SubjectAlternateName_Uri:
// no validation rules for Uri
}
return nil
} | go | func (m *SubjectAlternateName) Validate() error {
if m == nil {
return nil
}
switch m.Name.(type) {
case *SubjectAlternateName_Dns:
// no validation rules for Dns
case *SubjectAlternateName_Uri:
// no validation rules for Uri
}
return nil
} | [
"func",
"(",
"m",
"*",
"SubjectAlternateName",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"switch",
"m",
".",
"Name",
".",
"(",
"type",
")",
"{",
"case",
"*",
"SubjectAlternateName_Dns",
... | // Validate checks the field values on SubjectAlternateName with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"SubjectAlternateName",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/admin/v2alpha/certs.pb.validate.go#L352-L368 | train |
envoyproxy/go-control-plane | envoy/api/v2/lds.pb.validate.go | Validate | func (m *Listener_DeprecatedV1) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetBindToPort()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return Listener_DeprecatedV1ValidationError{
field: "BindToPort",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *Listener_DeprecatedV1) Validate() error {
if m == nil {
return nil
}
{
tmp := m.GetBindToPort()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return Listener_DeprecatedV1ValidationError{
field: "BindToPort",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"Listener_DeprecatedV1",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"{",
"tmp",
":=",
"m",
".",
"GetBindToPort",
"(",
")",
"\n\n",
"if",
"v",
",",
"ok",
":=",
"... | // Validate checks the field values on Listener_DeprecatedV1 with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"Listener_DeprecatedV1",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/api/v2/lds.pb.validate.go#L309-L330 | train |
envoyproxy/go-control-plane | envoy/api/v2/eds.pb.validate.go | Validate | func (m *ClusterLoadAssignment) Validate() error {
if m == nil {
return nil
}
if len(m.GetClusterName()) < 1 {
return ClusterLoadAssignmentValidationError{
field: "ClusterName",
reason: "value length must be at least 1 bytes",
}
}
for idx, item := range m.GetEndpoints() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClusterLoadAssignmentValidationError{
field: fmt.Sprintf("Endpoints[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
// no validation rules for NamedEndpoints
{
tmp := m.GetPolicy()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClusterLoadAssignmentValidationError{
field: "Policy",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *ClusterLoadAssignment) Validate() error {
if m == nil {
return nil
}
if len(m.GetClusterName()) < 1 {
return ClusterLoadAssignmentValidationError{
field: "ClusterName",
reason: "value length must be at least 1 bytes",
}
}
for idx, item := range m.GetEndpoints() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(&tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClusterLoadAssignmentValidationError{
field: fmt.Sprintf("Endpoints[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
// no validation rules for NamedEndpoints
{
tmp := m.GetPolicy()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClusterLoadAssignmentValidationError{
field: "Policy",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"ClusterLoadAssignment",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"m",
".",
"GetClusterName",
"(",
")",
")",
"<",
"1",
"{",
"return",
"Cluster... | // Validate checks the field values on ClusterLoadAssignment with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"ClusterLoadAssignment",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/api/v2/eds.pb.validate.go#L39-L89 | train |
envoyproxy/go-control-plane | envoy/api/v2/eds.pb.validate.go | Validate | func (m *ClusterLoadAssignment_Policy) Validate() error {
if m == nil {
return nil
}
for idx, item := range m.GetDropOverloads() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClusterLoadAssignment_PolicyValidationError{
field: fmt.Sprintf("DropOverloads[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
if wrapper := m.GetOverprovisioningFactor(); wrapper != nil {
if wrapper.GetValue() <= 0 {
return ClusterLoadAssignment_PolicyValidationError{
field: "OverprovisioningFactor",
reason: "value must be greater than 0",
}
}
}
if d := m.GetEndpointStaleAfter(); d != nil {
dur, err := types.DurationFromProto(d)
if err != nil {
return ClusterLoadAssignment_PolicyValidationError{
field: "EndpointStaleAfter",
reason: "value is not a valid duration",
cause: err,
}
}
gt := time.Duration(0*time.Second + 0*time.Nanosecond)
if dur <= gt {
return ClusterLoadAssignment_PolicyValidationError{
field: "EndpointStaleAfter",
reason: "value must be greater than 0s",
}
}
}
return nil
} | go | func (m *ClusterLoadAssignment_Policy) Validate() error {
if m == nil {
return nil
}
for idx, item := range m.GetDropOverloads() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClusterLoadAssignment_PolicyValidationError{
field: fmt.Sprintf("DropOverloads[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
if wrapper := m.GetOverprovisioningFactor(); wrapper != nil {
if wrapper.GetValue() <= 0 {
return ClusterLoadAssignment_PolicyValidationError{
field: "OverprovisioningFactor",
reason: "value must be greater than 0",
}
}
}
if d := m.GetEndpointStaleAfter(); d != nil {
dur, err := types.DurationFromProto(d)
if err != nil {
return ClusterLoadAssignment_PolicyValidationError{
field: "EndpointStaleAfter",
reason: "value is not a valid duration",
cause: err,
}
}
gt := time.Duration(0*time.Second + 0*time.Nanosecond)
if dur <= gt {
return ClusterLoadAssignment_PolicyValidationError{
field: "EndpointStaleAfter",
reason: "value must be greater than 0s",
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"ClusterLoadAssignment_Policy",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"for",
"idx",
",",
"item",
":=",
"range",
"m",
".",
"GetDropOverloads",
"(",
")",
"{",
"_... | // Validate checks the field values on ClusterLoadAssignment_Policy with the
// rules defined in the proto definition for this message. If any rules are
// violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"ClusterLoadAssignment_Policy",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
... | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/api/v2/eds.pb.validate.go#L150-L208 | train |
envoyproxy/go-control-plane | envoy/api/v2/eds.pb.validate.go | Validate | func (m *ClusterLoadAssignment_Policy_DropOverload) Validate() error {
if m == nil {
return nil
}
if len(m.GetCategory()) < 1 {
return ClusterLoadAssignment_Policy_DropOverloadValidationError{
field: "Category",
reason: "value length must be at least 1 bytes",
}
}
{
tmp := m.GetDropPercentage()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClusterLoadAssignment_Policy_DropOverloadValidationError{
field: "DropPercentage",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *ClusterLoadAssignment_Policy_DropOverload) Validate() error {
if m == nil {
return nil
}
if len(m.GetCategory()) < 1 {
return ClusterLoadAssignment_Policy_DropOverloadValidationError{
field: "Category",
reason: "value length must be at least 1 bytes",
}
}
{
tmp := m.GetDropPercentage()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ClusterLoadAssignment_Policy_DropOverloadValidationError{
field: "DropPercentage",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"ClusterLoadAssignment_Policy_DropOverload",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"m",
".",
"GetCategory",
"(",
")",
")",
"<",
"1",
"{",
"re... | // Validate checks the field values on
// ClusterLoadAssignment_Policy_DropOverload with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"ClusterLoadAssignment_Policy_DropOverload",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
... | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/api/v2/eds.pb.validate.go#L270-L298 | train |
envoyproxy/go-control-plane | envoy/config/filter/network/mysql_proxy/v1alpha1/mysql_proxy.pb.validate.go | Validate | func (m *MySQLProxy) Validate() error {
if m == nil {
return nil
}
if len(m.GetStatPrefix()) < 1 {
return MySQLProxyValidationError{
field: "StatPrefix",
reason: "value length must be at least 1 bytes",
}
}
// no validation rules for AccessLog
return nil
} | go | func (m *MySQLProxy) Validate() error {
if m == nil {
return nil
}
if len(m.GetStatPrefix()) < 1 {
return MySQLProxyValidationError{
field: "StatPrefix",
reason: "value length must be at least 1 bytes",
}
}
// no validation rules for AccessLog
return nil
} | [
"func",
"(",
"m",
"*",
"MySQLProxy",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"m",
".",
"GetStatPrefix",
"(",
")",
")",
"<",
"1",
"{",
"return",
"MySQLProxyValidatio... | // Validate checks the field values on MySQLProxy with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"MySQLProxy",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/filter/network/mysql_proxy/v1alpha1/mysql_proxy.pb.validate.go#L38-L53 | train |
envoyproxy/go-control-plane | pkg/cache/simple.go | SetSnapshot | func (cache *snapshotCache) SetSnapshot(node string, snapshot Snapshot) error {
cache.mu.Lock()
defer cache.mu.Unlock()
// update the existing entry
cache.snapshots[node] = snapshot
// trigger existing watches for which version changed
if info, ok := cache.status[node]; ok {
info.mu.Lock()
for id, watch := range info.watches {
version := snapshot.GetVersion(watch.Request.TypeUrl)
if version != watch.Request.VersionInfo {
if cache.log != nil {
cache.log.Infof("respond open watch %d%v with new version %q", id, watch.Request.ResourceNames, version)
}
cache.respond(watch.Request, watch.Response, snapshot.GetResources(watch.Request.TypeUrl), version)
// discard the watch
delete(info.watches, id)
}
}
info.mu.Unlock()
}
return nil
} | go | func (cache *snapshotCache) SetSnapshot(node string, snapshot Snapshot) error {
cache.mu.Lock()
defer cache.mu.Unlock()
// update the existing entry
cache.snapshots[node] = snapshot
// trigger existing watches for which version changed
if info, ok := cache.status[node]; ok {
info.mu.Lock()
for id, watch := range info.watches {
version := snapshot.GetVersion(watch.Request.TypeUrl)
if version != watch.Request.VersionInfo {
if cache.log != nil {
cache.log.Infof("respond open watch %d%v with new version %q", id, watch.Request.ResourceNames, version)
}
cache.respond(watch.Request, watch.Response, snapshot.GetResources(watch.Request.TypeUrl), version)
// discard the watch
delete(info.watches, id)
}
}
info.mu.Unlock()
}
return nil
} | [
"func",
"(",
"cache",
"*",
"snapshotCache",
")",
"SetSnapshot",
"(",
"node",
"string",
",",
"snapshot",
"Snapshot",
")",
"error",
"{",
"cache",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"cache",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"// ... | // SetSnapshotCache updates a snapshot for a node. | [
"SetSnapshotCache",
"updates",
"a",
"snapshot",
"for",
"a",
"node",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/pkg/cache/simple.go#L100-L126 | train |
envoyproxy/go-control-plane | pkg/cache/simple.go | GetSnapshot | func (cache *snapshotCache) GetSnapshot(node string) (Snapshot, error) {
cache.mu.RLock()
defer cache.mu.RUnlock()
snap, ok := cache.snapshots[node]
if !ok {
return Snapshot{}, fmt.Errorf("no snapshot found for node %s", node)
}
return snap, nil
} | go | func (cache *snapshotCache) GetSnapshot(node string) (Snapshot, error) {
cache.mu.RLock()
defer cache.mu.RUnlock()
snap, ok := cache.snapshots[node]
if !ok {
return Snapshot{}, fmt.Errorf("no snapshot found for node %s", node)
}
return snap, nil
} | [
"func",
"(",
"cache",
"*",
"snapshotCache",
")",
"GetSnapshot",
"(",
"node",
"string",
")",
"(",
"Snapshot",
",",
"error",
")",
"{",
"cache",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"cache",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n\n",
"s... | // GetSnapshots gets the snapshot for a node, and returns an error if not found. | [
"GetSnapshots",
"gets",
"the",
"snapshot",
"for",
"a",
"node",
"and",
"returns",
"an",
"error",
"if",
"not",
"found",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/pkg/cache/simple.go#L129-L138 | train |
envoyproxy/go-control-plane | pkg/cache/simple.go | ClearSnapshot | func (cache *snapshotCache) ClearSnapshot(node string) {
cache.mu.Lock()
defer cache.mu.Unlock()
delete(cache.snapshots, node)
delete(cache.status, node)
} | go | func (cache *snapshotCache) ClearSnapshot(node string) {
cache.mu.Lock()
defer cache.mu.Unlock()
delete(cache.snapshots, node)
delete(cache.status, node)
} | [
"func",
"(",
"cache",
"*",
"snapshotCache",
")",
"ClearSnapshot",
"(",
"node",
"string",
")",
"{",
"cache",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"cache",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"delete",
"(",
"cache",
".",
"snapshots"... | // ClearSnapshot clears snapshot and info for a node. | [
"ClearSnapshot",
"clears",
"snapshot",
"and",
"info",
"for",
"a",
"node",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/pkg/cache/simple.go#L141-L147 | train |
envoyproxy/go-control-plane | pkg/cache/simple.go | nameSet | func nameSet(names []string) map[string]bool {
set := make(map[string]bool)
for _, name := range names {
set[name] = true
}
return set
} | go | func nameSet(names []string) map[string]bool {
set := make(map[string]bool)
for _, name := range names {
set[name] = true
}
return set
} | [
"func",
"nameSet",
"(",
"names",
"[",
"]",
"string",
")",
"map",
"[",
"string",
"]",
"bool",
"{",
"set",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n",
"for",
"_",
",",
"name",
":=",
"range",
"names",
"{",
"set",
"[",
"name",
... | // nameSet creates a map from a string slice to value true. | [
"nameSet",
"creates",
"a",
"map",
"from",
"a",
"string",
"slice",
"to",
"value",
"true",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/pkg/cache/simple.go#L150-L156 | train |
envoyproxy/go-control-plane | pkg/cache/simple.go | superset | func superset(names map[string]bool, resources map[string]Resource) error {
for resourceName := range resources {
if _, exists := names[resourceName]; !exists {
return fmt.Errorf("%q not listed", resourceName)
}
}
return nil
} | go | func superset(names map[string]bool, resources map[string]Resource) error {
for resourceName := range resources {
if _, exists := names[resourceName]; !exists {
return fmt.Errorf("%q not listed", resourceName)
}
}
return nil
} | [
"func",
"superset",
"(",
"names",
"map",
"[",
"string",
"]",
"bool",
",",
"resources",
"map",
"[",
"string",
"]",
"Resource",
")",
"error",
"{",
"for",
"resourceName",
":=",
"range",
"resources",
"{",
"if",
"_",
",",
"exists",
":=",
"names",
"[",
"reso... | // superset checks that all resources are listed in the names set. | [
"superset",
"checks",
"that",
"all",
"resources",
"are",
"listed",
"in",
"the",
"names",
"set",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/pkg/cache/simple.go#L159-L166 | train |
envoyproxy/go-control-plane | pkg/cache/simple.go | CreateWatch | func (cache *snapshotCache) CreateWatch(request Request) (chan Response, func()) {
nodeID := cache.hash.ID(request.Node)
cache.mu.Lock()
defer cache.mu.Unlock()
info, ok := cache.status[nodeID]
if !ok {
info = newStatusInfo(request.Node)
cache.status[nodeID] = info
}
// update last watch request time
info.mu.Lock()
info.lastWatchRequestTime = time.Now()
info.mu.Unlock()
// allocate capacity 1 to allow one-time non-blocking use
value := make(chan Response, 1)
snapshot, exists := cache.snapshots[nodeID]
version := snapshot.GetVersion(request.TypeUrl)
// if the requested version is up-to-date or missing a response, leave an open watch
if !exists || request.VersionInfo == version {
watchID := cache.nextWatchID()
if cache.log != nil {
cache.log.Infof("open watch %d for %s%v from nodeID %q, version %q", watchID,
request.TypeUrl, request.ResourceNames, nodeID, request.VersionInfo)
}
info.mu.Lock()
info.watches[watchID] = ResponseWatch{Request: request, Response: value}
info.mu.Unlock()
return value, cache.cancelWatch(nodeID, watchID)
}
// otherwise, the watch may be responded immediately
cache.respond(request, value, snapshot.GetResources(request.TypeUrl), version)
return value, nil
} | go | func (cache *snapshotCache) CreateWatch(request Request) (chan Response, func()) {
nodeID := cache.hash.ID(request.Node)
cache.mu.Lock()
defer cache.mu.Unlock()
info, ok := cache.status[nodeID]
if !ok {
info = newStatusInfo(request.Node)
cache.status[nodeID] = info
}
// update last watch request time
info.mu.Lock()
info.lastWatchRequestTime = time.Now()
info.mu.Unlock()
// allocate capacity 1 to allow one-time non-blocking use
value := make(chan Response, 1)
snapshot, exists := cache.snapshots[nodeID]
version := snapshot.GetVersion(request.TypeUrl)
// if the requested version is up-to-date or missing a response, leave an open watch
if !exists || request.VersionInfo == version {
watchID := cache.nextWatchID()
if cache.log != nil {
cache.log.Infof("open watch %d for %s%v from nodeID %q, version %q", watchID,
request.TypeUrl, request.ResourceNames, nodeID, request.VersionInfo)
}
info.mu.Lock()
info.watches[watchID] = ResponseWatch{Request: request, Response: value}
info.mu.Unlock()
return value, cache.cancelWatch(nodeID, watchID)
}
// otherwise, the watch may be responded immediately
cache.respond(request, value, snapshot.GetResources(request.TypeUrl), version)
return value, nil
} | [
"func",
"(",
"cache",
"*",
"snapshotCache",
")",
"CreateWatch",
"(",
"request",
"Request",
")",
"(",
"chan",
"Response",
",",
"func",
"(",
")",
")",
"{",
"nodeID",
":=",
"cache",
".",
"hash",
".",
"ID",
"(",
"request",
".",
"Node",
")",
"\n\n",
"cach... | // CreateWatch returns a watch for an xDS request. | [
"CreateWatch",
"returns",
"a",
"watch",
"for",
"an",
"xDS",
"request",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/pkg/cache/simple.go#L169-L209 | train |
envoyproxy/go-control-plane | pkg/cache/simple.go | cancelWatch | func (cache *snapshotCache) cancelWatch(nodeID string, watchID int64) func() {
return func() {
// uses the cache mutex
cache.mu.Lock()
defer cache.mu.Unlock()
if info, ok := cache.status[nodeID]; ok {
info.mu.Lock()
delete(info.watches, watchID)
info.mu.Unlock()
}
}
} | go | func (cache *snapshotCache) cancelWatch(nodeID string, watchID int64) func() {
return func() {
// uses the cache mutex
cache.mu.Lock()
defer cache.mu.Unlock()
if info, ok := cache.status[nodeID]; ok {
info.mu.Lock()
delete(info.watches, watchID)
info.mu.Unlock()
}
}
} | [
"func",
"(",
"cache",
"*",
"snapshotCache",
")",
"cancelWatch",
"(",
"nodeID",
"string",
",",
"watchID",
"int64",
")",
"func",
"(",
")",
"{",
"return",
"func",
"(",
")",
"{",
"// uses the cache mutex",
"cache",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"... | // cancellation function for cleaning stale watches | [
"cancellation",
"function",
"for",
"cleaning",
"stale",
"watches"
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/pkg/cache/simple.go#L216-L227 | train |
envoyproxy/go-control-plane | pkg/cache/simple.go | Fetch | func (cache *snapshotCache) Fetch(ctx context.Context, request Request) (*Response, error) {
nodeID := cache.hash.ID(request.Node)
cache.mu.RLock()
defer cache.mu.RUnlock()
if snapshot, exists := cache.snapshots[nodeID]; exists {
// Respond only if the request version is distinct from the current snapshot state.
// It might be beneficial to hold the request since Envoy will re-attempt the refresh.
version := snapshot.GetVersion(request.TypeUrl)
if request.VersionInfo == version {
return nil, errors.New("skip fetch: version up to date")
}
resources := snapshot.GetResources(request.TypeUrl)
out := createResponse(request, resources, version)
return &out, nil
}
return nil, fmt.Errorf("missing snapshot for %q", nodeID)
} | go | func (cache *snapshotCache) Fetch(ctx context.Context, request Request) (*Response, error) {
nodeID := cache.hash.ID(request.Node)
cache.mu.RLock()
defer cache.mu.RUnlock()
if snapshot, exists := cache.snapshots[nodeID]; exists {
// Respond only if the request version is distinct from the current snapshot state.
// It might be beneficial to hold the request since Envoy will re-attempt the refresh.
version := snapshot.GetVersion(request.TypeUrl)
if request.VersionInfo == version {
return nil, errors.New("skip fetch: version up to date")
}
resources := snapshot.GetResources(request.TypeUrl)
out := createResponse(request, resources, version)
return &out, nil
}
return nil, fmt.Errorf("missing snapshot for %q", nodeID)
} | [
"func",
"(",
"cache",
"*",
"snapshotCache",
")",
"Fetch",
"(",
"ctx",
"context",
".",
"Context",
",",
"request",
"Request",
")",
"(",
"*",
"Response",
",",
"error",
")",
"{",
"nodeID",
":=",
"cache",
".",
"hash",
".",
"ID",
"(",
"request",
".",
"Node... | // Fetch implements the cache fetch function.
// Fetch is called on multiple streams, so responding to individual names with the same version works. | [
"Fetch",
"implements",
"the",
"cache",
"fetch",
"function",
".",
"Fetch",
"is",
"called",
"on",
"multiple",
"streams",
"so",
"responding",
"to",
"individual",
"names",
"with",
"the",
"same",
"version",
"works",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/pkg/cache/simple.go#L278-L298 | train |
envoyproxy/go-control-plane | pkg/cache/simple.go | GetStatusInfo | func (cache *snapshotCache) GetStatusInfo(node string) StatusInfo {
cache.mu.RLock()
defer cache.mu.RUnlock()
info, exists := cache.status[node]
if !exists {
return nil
}
return info
} | go | func (cache *snapshotCache) GetStatusInfo(node string) StatusInfo {
cache.mu.RLock()
defer cache.mu.RUnlock()
info, exists := cache.status[node]
if !exists {
return nil
}
return info
} | [
"func",
"(",
"cache",
"*",
"snapshotCache",
")",
"GetStatusInfo",
"(",
"node",
"string",
")",
"StatusInfo",
"{",
"cache",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"cache",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n\n",
"info",
",",
"exists",
"... | // GetStatusInfo retrieves the status info for the node. | [
"GetStatusInfo",
"retrieves",
"the",
"status",
"info",
"for",
"the",
"node",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/pkg/cache/simple.go#L301-L311 | train |
envoyproxy/go-control-plane | pkg/cache/simple.go | GetStatusKeys | func (cache *snapshotCache) GetStatusKeys() []string {
cache.mu.RLock()
defer cache.mu.RUnlock()
out := make([]string, 0, len(cache.status))
for id := range cache.status {
out = append(out, id)
}
return out
} | go | func (cache *snapshotCache) GetStatusKeys() []string {
cache.mu.RLock()
defer cache.mu.RUnlock()
out := make([]string, 0, len(cache.status))
for id := range cache.status {
out = append(out, id)
}
return out
} | [
"func",
"(",
"cache",
"*",
"snapshotCache",
")",
"GetStatusKeys",
"(",
")",
"[",
"]",
"string",
"{",
"cache",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"cache",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n\n",
"out",
":=",
"make",
"(",
"[",
"... | // GetStatusKeys retrieves all node IDs in the status map. | [
"GetStatusKeys",
"retrieves",
"all",
"node",
"IDs",
"in",
"the",
"status",
"map",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/pkg/cache/simple.go#L314-L324 | train |
envoyproxy/go-control-plane | envoy/config/ratelimit/v2/rls.pb.validate.go | Validate | func (m *RateLimitServiceConfig) Validate() error {
if m == nil {
return nil
}
if m.GetGrpcService() == nil {
return RateLimitServiceConfigValidationError{
field: "GrpcService",
reason: "value is required",
}
}
{
tmp := m.GetGrpcService()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RateLimitServiceConfigValidationError{
field: "GrpcService",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *RateLimitServiceConfig) Validate() error {
if m == nil {
return nil
}
if m.GetGrpcService() == nil {
return RateLimitServiceConfigValidationError{
field: "GrpcService",
reason: "value is required",
}
}
{
tmp := m.GetGrpcService()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RateLimitServiceConfigValidationError{
field: "GrpcService",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"RateLimitServiceConfig",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"m",
".",
"GetGrpcService",
"(",
")",
"==",
"nil",
"{",
"return",
"RateLimitServiceConfigVali... | // Validate checks the field values on RateLimitServiceConfig with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"RateLimitServiceConfig",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
... | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/ratelimit/v2/rls.pb.validate.go#L39-L67 | train |
envoyproxy/go-control-plane | envoy/type/matcher/number.pb.validate.go | Validate | func (m *DoubleMatcher) Validate() error {
if m == nil {
return nil
}
switch m.MatchPattern.(type) {
case *DoubleMatcher_Range:
{
tmp := m.GetRange()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DoubleMatcherValidationError{
field: "Range",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *DoubleMatcher_Exact:
// no validation rules for Exact
default:
return DoubleMatcherValidationError{
field: "MatchPattern",
reason: "value is required",
}
}
return nil
} | go | func (m *DoubleMatcher) Validate() error {
if m == nil {
return nil
}
switch m.MatchPattern.(type) {
case *DoubleMatcher_Range:
{
tmp := m.GetRange()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DoubleMatcherValidationError{
field: "Range",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *DoubleMatcher_Exact:
// no validation rules for Exact
default:
return DoubleMatcherValidationError{
field: "MatchPattern",
reason: "value is required",
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"DoubleMatcher",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"switch",
"m",
".",
"MatchPattern",
".",
"(",
"type",
")",
"{",
"case",
"*",
"DoubleMatcher_Range",
":",... | // Validate checks the field values on DoubleMatcher with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"DoubleMatcher",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/type/matcher/number.pb.validate.go#L39-L75 | train |
envoyproxy/go-control-plane | envoy/config/metrics/v2/stats.pb.validate.go | Validate | func (m *StatsSink) Validate() error {
if m == nil {
return nil
}
// no validation rules for Name
switch m.ConfigType.(type) {
case *StatsSink_Config:
{
tmp := m.GetConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return StatsSinkValidationError{
field: "Config",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *StatsSink_TypedConfig:
{
tmp := m.GetTypedConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return StatsSinkValidationError{
field: "TypedConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | go | func (m *StatsSink) Validate() error {
if m == nil {
return nil
}
// no validation rules for Name
switch m.ConfigType.(type) {
case *StatsSink_Config:
{
tmp := m.GetConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return StatsSinkValidationError{
field: "Config",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *StatsSink_TypedConfig:
{
tmp := m.GetTypedConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return StatsSinkValidationError{
field: "TypedConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"StatsSink",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// no validation rules for Name",
"switch",
"m",
".",
"ConfigType",
".",
"(",
"type",
")",
"{",
"case",
"*",
... | // Validate checks the field values on StatsSink with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"StatsSink",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/metrics/v2/stats.pb.validate.go#L38-L84 | train |
envoyproxy/go-control-plane | envoy/config/metrics/v2/stats.pb.validate.go | Validate | func (m *StatsConfig) Validate() error {
if m == nil {
return nil
}
for idx, item := range m.GetStatsTags() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return StatsConfigValidationError{
field: fmt.Sprintf("StatsTags[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
{
tmp := m.GetUseAllDefaultTags()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return StatsConfigValidationError{
field: "UseAllDefaultTags",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetStatsMatcher()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return StatsConfigValidationError{
field: "StatsMatcher",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *StatsConfig) Validate() error {
if m == nil {
return nil
}
for idx, item := range m.GetStatsTags() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return StatsConfigValidationError{
field: fmt.Sprintf("StatsTags[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
{
tmp := m.GetUseAllDefaultTags()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return StatsConfigValidationError{
field: "UseAllDefaultTags",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetStatsMatcher()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return StatsConfigValidationError{
field: "StatsMatcher",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"StatsConfig",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"for",
"idx",
",",
"item",
":=",
"range",
"m",
".",
"GetStatsTags",
"(",
")",
"{",
"_",
",",
"_",
"=... | // Validate checks the field values on StatsConfig with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"StatsConfig",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/metrics/v2/stats.pb.validate.go#L143-L199 | train |
envoyproxy/go-control-plane | envoy/config/metrics/v2/stats.pb.validate.go | Validate | func (m *StatsMatcher) Validate() error {
if m == nil {
return nil
}
switch m.StatsMatcher.(type) {
case *StatsMatcher_RejectAll:
// no validation rules for RejectAll
case *StatsMatcher_ExclusionList:
{
tmp := m.GetExclusionList()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return StatsMatcherValidationError{
field: "ExclusionList",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *StatsMatcher_InclusionList:
{
tmp := m.GetInclusionList()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return StatsMatcherValidationError{
field: "InclusionList",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
default:
return StatsMatcherValidationError{
field: "StatsMatcher",
reason: "value is required",
}
}
return nil
} | go | func (m *StatsMatcher) Validate() error {
if m == nil {
return nil
}
switch m.StatsMatcher.(type) {
case *StatsMatcher_RejectAll:
// no validation rules for RejectAll
case *StatsMatcher_ExclusionList:
{
tmp := m.GetExclusionList()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return StatsMatcherValidationError{
field: "ExclusionList",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *StatsMatcher_InclusionList:
{
tmp := m.GetInclusionList()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return StatsMatcherValidationError{
field: "InclusionList",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
default:
return StatsMatcherValidationError{
field: "StatsMatcher",
reason: "value is required",
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"StatsMatcher",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"switch",
"m",
".",
"StatsMatcher",
".",
"(",
"type",
")",
"{",
"case",
"*",
"StatsMatcher_RejectAll",
":... | // Validate checks the field values on StatsMatcher with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"StatsMatcher",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/metrics/v2/stats.pb.validate.go#L258-L311 | train |
envoyproxy/go-control-plane | envoy/config/metrics/v2/stats.pb.validate.go | Validate | func (m *TagSpecifier) Validate() error {
if m == nil {
return nil
}
// no validation rules for TagName
switch m.TagValue.(type) {
case *TagSpecifier_Regex:
if len(m.GetRegex()) > 1024 {
return TagSpecifierValidationError{
field: "Regex",
reason: "value length must be at most 1024 bytes",
}
}
case *TagSpecifier_FixedValue:
// no validation rules for FixedValue
}
return nil
} | go | func (m *TagSpecifier) Validate() error {
if m == nil {
return nil
}
// no validation rules for TagName
switch m.TagValue.(type) {
case *TagSpecifier_Regex:
if len(m.GetRegex()) > 1024 {
return TagSpecifierValidationError{
field: "Regex",
reason: "value length must be at most 1024 bytes",
}
}
case *TagSpecifier_FixedValue:
// no validation rules for FixedValue
}
return nil
} | [
"func",
"(",
"m",
"*",
"TagSpecifier",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// no validation rules for TagName",
"switch",
"m",
".",
"TagValue",
".",
"(",
"type",
")",
"{",
"case",
"... | // Validate checks the field values on TagSpecifier with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"TagSpecifier",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/metrics/v2/stats.pb.validate.go#L370-L394 | train |
envoyproxy/go-control-plane | envoy/config/metrics/v2/stats.pb.validate.go | Validate | func (m *StatsdSink) Validate() error {
if m == nil {
return nil
}
// no validation rules for Prefix
switch m.StatsdSpecifier.(type) {
case *StatsdSink_Address:
{
tmp := m.GetAddress()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return StatsdSinkValidationError{
field: "Address",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *StatsdSink_TcpClusterName:
// no validation rules for TcpClusterName
default:
return StatsdSinkValidationError{
field: "StatsdSpecifier",
reason: "value is required",
}
}
return nil
} | go | func (m *StatsdSink) Validate() error {
if m == nil {
return nil
}
// no validation rules for Prefix
switch m.StatsdSpecifier.(type) {
case *StatsdSink_Address:
{
tmp := m.GetAddress()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return StatsdSinkValidationError{
field: "Address",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *StatsdSink_TcpClusterName:
// no validation rules for TcpClusterName
default:
return StatsdSinkValidationError{
field: "StatsdSpecifier",
reason: "value is required",
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"StatsdSink",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// no validation rules for Prefix",
"switch",
"m",
".",
"StatsdSpecifier",
".",
"(",
"type",
")",
"{",
"case",... | // Validate checks the field values on StatsdSink with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"StatsdSink",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/metrics/v2/stats.pb.validate.go#L452-L490 | train |
envoyproxy/go-control-plane | envoy/config/metrics/v2/stats.pb.validate.go | Validate | func (m *DogStatsdSink) Validate() error {
if m == nil {
return nil
}
// no validation rules for Prefix
switch m.DogStatsdSpecifier.(type) {
case *DogStatsdSink_Address:
{
tmp := m.GetAddress()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DogStatsdSinkValidationError{
field: "Address",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
default:
return DogStatsdSinkValidationError{
field: "DogStatsdSpecifier",
reason: "value is required",
}
}
return nil
} | go | func (m *DogStatsdSink) Validate() error {
if m == nil {
return nil
}
// no validation rules for Prefix
switch m.DogStatsdSpecifier.(type) {
case *DogStatsdSink_Address:
{
tmp := m.GetAddress()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DogStatsdSinkValidationError{
field: "Address",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
default:
return DogStatsdSinkValidationError{
field: "DogStatsdSpecifier",
reason: "value is required",
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"DogStatsdSink",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// no validation rules for Prefix",
"switch",
"m",
".",
"DogStatsdSpecifier",
".",
"(",
"type",
")",
"{",
"... | // Validate checks the field values on DogStatsdSink with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"DogStatsdSink",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/metrics/v2/stats.pb.validate.go#L549-L584 | train |
envoyproxy/go-control-plane | pkg/cache/snapshot.go | IndexResourcesByName | func IndexResourcesByName(items []Resource) map[string]Resource {
indexed := make(map[string]Resource, len(items))
for _, item := range items {
indexed[GetResourceName(item)] = item
}
return indexed
} | go | func IndexResourcesByName(items []Resource) map[string]Resource {
indexed := make(map[string]Resource, len(items))
for _, item := range items {
indexed[GetResourceName(item)] = item
}
return indexed
} | [
"func",
"IndexResourcesByName",
"(",
"items",
"[",
"]",
"Resource",
")",
"map",
"[",
"string",
"]",
"Resource",
"{",
"indexed",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"Resource",
",",
"len",
"(",
"items",
")",
")",
"\n",
"for",
"_",
",",
"item... | // IndexResourcesByName creates a map from the resource name to the resource. | [
"IndexResourcesByName",
"creates",
"a",
"map",
"from",
"the",
"resource",
"name",
"to",
"the",
"resource",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/pkg/cache/snapshot.go#L32-L38 | train |
envoyproxy/go-control-plane | pkg/cache/snapshot.go | NewResources | func NewResources(version string, items []Resource) Resources {
return Resources{
Version: version,
Items: IndexResourcesByName(items),
}
} | go | func NewResources(version string, items []Resource) Resources {
return Resources{
Version: version,
Items: IndexResourcesByName(items),
}
} | [
"func",
"NewResources",
"(",
"version",
"string",
",",
"items",
"[",
"]",
"Resource",
")",
"Resources",
"{",
"return",
"Resources",
"{",
"Version",
":",
"version",
",",
"Items",
":",
"IndexResourcesByName",
"(",
"items",
")",
",",
"}",
"\n",
"}"
] | // NewResources creates a new resource group. | [
"NewResources",
"creates",
"a",
"new",
"resource",
"group",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/pkg/cache/snapshot.go#L41-L46 | train |
envoyproxy/go-control-plane | pkg/cache/snapshot.go | NewSnapshot | func NewSnapshot(version string,
endpoints []Resource,
clusters []Resource,
routes []Resource,
listeners []Resource) Snapshot {
return Snapshot{
Endpoints: NewResources(version, endpoints),
Clusters: NewResources(version, clusters),
Routes: NewResources(version, routes),
Listeners: NewResources(version, listeners),
}
} | go | func NewSnapshot(version string,
endpoints []Resource,
clusters []Resource,
routes []Resource,
listeners []Resource) Snapshot {
return Snapshot{
Endpoints: NewResources(version, endpoints),
Clusters: NewResources(version, clusters),
Routes: NewResources(version, routes),
Listeners: NewResources(version, listeners),
}
} | [
"func",
"NewSnapshot",
"(",
"version",
"string",
",",
"endpoints",
"[",
"]",
"Resource",
",",
"clusters",
"[",
"]",
"Resource",
",",
"routes",
"[",
"]",
"Resource",
",",
"listeners",
"[",
"]",
"Resource",
")",
"Snapshot",
"{",
"return",
"Snapshot",
"{",
... | // NewSnapshot creates a snapshot from response types and a version. | [
"NewSnapshot",
"creates",
"a",
"snapshot",
"from",
"response",
"types",
"and",
"a",
"version",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/pkg/cache/snapshot.go#L69-L80 | train |
envoyproxy/go-control-plane | pkg/cache/snapshot.go | GetResources | func (s *Snapshot) GetResources(typ string) map[string]Resource {
if s == nil {
return nil
}
switch typ {
case EndpointType:
return s.Endpoints.Items
case ClusterType:
return s.Clusters.Items
case RouteType:
return s.Routes.Items
case ListenerType:
return s.Listeners.Items
case SecretType:
return s.Secrets.Items
}
return nil
} | go | func (s *Snapshot) GetResources(typ string) map[string]Resource {
if s == nil {
return nil
}
switch typ {
case EndpointType:
return s.Endpoints.Items
case ClusterType:
return s.Clusters.Items
case RouteType:
return s.Routes.Items
case ListenerType:
return s.Listeners.Items
case SecretType:
return s.Secrets.Items
}
return nil
} | [
"func",
"(",
"s",
"*",
"Snapshot",
")",
"GetResources",
"(",
"typ",
"string",
")",
"map",
"[",
"string",
"]",
"Resource",
"{",
"if",
"s",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"switch",
"typ",
"{",
"case",
"EndpointType",
":",
"return",... | // GetResources selects snapshot resources by type. | [
"GetResources",
"selects",
"snapshot",
"resources",
"by",
"type",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/pkg/cache/snapshot.go#L110-L127 | train |
envoyproxy/go-control-plane | pkg/cache/snapshot.go | GetVersion | func (s *Snapshot) GetVersion(typ string) string {
if s == nil {
return ""
}
switch typ {
case EndpointType:
return s.Endpoints.Version
case ClusterType:
return s.Clusters.Version
case RouteType:
return s.Routes.Version
case ListenerType:
return s.Listeners.Version
case SecretType:
return s.Secrets.Version
}
return ""
} | go | func (s *Snapshot) GetVersion(typ string) string {
if s == nil {
return ""
}
switch typ {
case EndpointType:
return s.Endpoints.Version
case ClusterType:
return s.Clusters.Version
case RouteType:
return s.Routes.Version
case ListenerType:
return s.Listeners.Version
case SecretType:
return s.Secrets.Version
}
return ""
} | [
"func",
"(",
"s",
"*",
"Snapshot",
")",
"GetVersion",
"(",
"typ",
"string",
")",
"string",
"{",
"if",
"s",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"switch",
"typ",
"{",
"case",
"EndpointType",
":",
"return",
"s",
".",
"Endpoints",
... | // GetVersion returns the version for a resource type. | [
"GetVersion",
"returns",
"the",
"version",
"for",
"a",
"resource",
"type",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/pkg/cache/snapshot.go#L130-L147 | train |
envoyproxy/go-control-plane | envoy/config/metrics/v2/metrics_service.pb.validate.go | Validate | func (m *MetricsServiceConfig) Validate() error {
if m == nil {
return nil
}
if m.GetGrpcService() == nil {
return MetricsServiceConfigValidationError{
field: "GrpcService",
reason: "value is required",
}
}
{
tmp := m.GetGrpcService()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return MetricsServiceConfigValidationError{
field: "GrpcService",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *MetricsServiceConfig) Validate() error {
if m == nil {
return nil
}
if m.GetGrpcService() == nil {
return MetricsServiceConfigValidationError{
field: "GrpcService",
reason: "value is required",
}
}
{
tmp := m.GetGrpcService()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return MetricsServiceConfigValidationError{
field: "GrpcService",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"MetricsServiceConfig",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"m",
".",
"GetGrpcService",
"(",
")",
"==",
"nil",
"{",
"return",
"MetricsServiceConfigValidati... | // Validate checks the field values on MetricsServiceConfig with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"MetricsServiceConfig",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/metrics/v2/metrics_service.pb.validate.go#L39-L67 | train |
envoyproxy/go-control-plane | envoy/config/filter/http/lua/v2/lua.pb.validate.go | Validate | func (m *Lua) Validate() error {
if m == nil {
return nil
}
if len(m.GetInlineCode()) < 1 {
return LuaValidationError{
field: "InlineCode",
reason: "value length must be at least 1 bytes",
}
}
return nil
} | go | func (m *Lua) Validate() error {
if m == nil {
return nil
}
if len(m.GetInlineCode()) < 1 {
return LuaValidationError{
field: "InlineCode",
reason: "value length must be at least 1 bytes",
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"Lua",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"m",
".",
"GetInlineCode",
"(",
")",
")",
"<",
"1",
"{",
"return",
"LuaValidationError",
"{"... | // Validate checks the field values on Lua with the rules defined in the proto
// definition for this message. If any rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"Lua",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/filter/http/lua/v2/lua.pb.validate.go#L38-L51 | train |
envoyproxy/go-control-plane | envoy/service/tap/v2alpha/common.pb.validate.go | Validate | func (m *TapConfig) Validate() error {
if m == nil {
return nil
}
if m.GetMatchConfig() == nil {
return TapConfigValidationError{
field: "MatchConfig",
reason: "value is required",
}
}
{
tmp := m.GetMatchConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return TapConfigValidationError{
field: "MatchConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if m.GetOutputConfig() == nil {
return TapConfigValidationError{
field: "OutputConfig",
reason: "value is required",
}
}
{
tmp := m.GetOutputConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return TapConfigValidationError{
field: "OutputConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *TapConfig) Validate() error {
if m == nil {
return nil
}
if m.GetMatchConfig() == nil {
return TapConfigValidationError{
field: "MatchConfig",
reason: "value is required",
}
}
{
tmp := m.GetMatchConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return TapConfigValidationError{
field: "MatchConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if m.GetOutputConfig() == nil {
return TapConfigValidationError{
field: "OutputConfig",
reason: "value is required",
}
}
{
tmp := m.GetOutputConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return TapConfigValidationError{
field: "OutputConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"TapConfig",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"m",
".",
"GetMatchConfig",
"(",
")",
"==",
"nil",
"{",
"return",
"TapConfigValidationError",
"{",
"fi... | // Validate checks the field values on TapConfig with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"TapConfig",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/service/tap/v2alpha/common.pb.validate.go#L38-L88 | train |
envoyproxy/go-control-plane | envoy/service/tap/v2alpha/common.pb.validate.go | Validate | func (m *OutputConfig) Validate() error {
if m == nil {
return nil
}
if len(m.GetSinks()) != 1 {
return OutputConfigValidationError{
field: "Sinks",
reason: "value must contain exactly 1 item(s)",
}
}
for idx, item := range m.GetSinks() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OutputConfigValidationError{
field: fmt.Sprintf("Sinks[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
{
tmp := m.GetMaxBufferedRxBytes()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OutputConfigValidationError{
field: "MaxBufferedRxBytes",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetMaxBufferedTxBytes()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OutputConfigValidationError{
field: "MaxBufferedTxBytes",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
// no validation rules for Streaming
return nil
} | go | func (m *OutputConfig) Validate() error {
if m == nil {
return nil
}
if len(m.GetSinks()) != 1 {
return OutputConfigValidationError{
field: "Sinks",
reason: "value must contain exactly 1 item(s)",
}
}
for idx, item := range m.GetSinks() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OutputConfigValidationError{
field: fmt.Sprintf("Sinks[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
{
tmp := m.GetMaxBufferedRxBytes()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OutputConfigValidationError{
field: "MaxBufferedRxBytes",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
{
tmp := m.GetMaxBufferedTxBytes()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OutputConfigValidationError{
field: "MaxBufferedTxBytes",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
// no validation rules for Streaming
return nil
} | [
"func",
"(",
"m",
"*",
"OutputConfig",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"m",
".",
"GetSinks",
"(",
")",
")",
"!=",
"1",
"{",
"return",
"OutputConfigValidatio... | // Validate checks the field values on OutputConfig with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"OutputConfig",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/service/tap/v2alpha/common.pb.validate.go#L435-L500 | train |
envoyproxy/go-control-plane | envoy/service/tap/v2alpha/common.pb.validate.go | Validate | func (m *OutputSink) Validate() error {
if m == nil {
return nil
}
if _, ok := OutputSink_Format_name[int32(m.GetFormat())]; !ok {
return OutputSinkValidationError{
field: "Format",
reason: "value must be one of the defined enum values",
}
}
switch m.OutputSinkType.(type) {
case *OutputSink_StreamingAdmin:
{
tmp := m.GetStreamingAdmin()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OutputSinkValidationError{
field: "StreamingAdmin",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *OutputSink_FilePerTap:
{
tmp := m.GetFilePerTap()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OutputSinkValidationError{
field: "FilePerTap",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
default:
return OutputSinkValidationError{
field: "OutputSinkType",
reason: "value is required",
}
}
return nil
} | go | func (m *OutputSink) Validate() error {
if m == nil {
return nil
}
if _, ok := OutputSink_Format_name[int32(m.GetFormat())]; !ok {
return OutputSinkValidationError{
field: "Format",
reason: "value must be one of the defined enum values",
}
}
switch m.OutputSinkType.(type) {
case *OutputSink_StreamingAdmin:
{
tmp := m.GetStreamingAdmin()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OutputSinkValidationError{
field: "StreamingAdmin",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *OutputSink_FilePerTap:
{
tmp := m.GetFilePerTap()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OutputSinkValidationError{
field: "FilePerTap",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
default:
return OutputSinkValidationError{
field: "OutputSinkType",
reason: "value is required",
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"OutputSink",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"OutputSink_Format_name",
"[",
"int32",
"(",
"m",
".",
"GetFormat",
"(",
")",... | // Validate checks the field values on OutputSink with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"OutputSink",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/service/tap/v2alpha/common.pb.validate.go#L558-L615 | train |
envoyproxy/go-control-plane | envoy/service/tap/v2alpha/common.pb.validate.go | Validate | func (m *FilePerTapSink) Validate() error {
if m == nil {
return nil
}
if len(m.GetPathPrefix()) < 1 {
return FilePerTapSinkValidationError{
field: "PathPrefix",
reason: "value length must be at least 1 bytes",
}
}
return nil
} | go | func (m *FilePerTapSink) Validate() error {
if m == nil {
return nil
}
if len(m.GetPathPrefix()) < 1 {
return FilePerTapSinkValidationError{
field: "PathPrefix",
reason: "value length must be at least 1 bytes",
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"FilePerTapSink",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"m",
".",
"GetPathPrefix",
"(",
")",
")",
"<",
"1",
"{",
"return",
"FilePerTapSinkV... | // Validate checks the field values on FilePerTapSink with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"FilePerTapSink",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/service/tap/v2alpha/common.pb.validate.go#L741-L754 | train |
envoyproxy/go-control-plane | envoy/config/filter/accesslog/v2/accesslog.pb.validate.go | Validate | func (m *AccessLog) Validate() error {
if m == nil {
return nil
}
// no validation rules for Name
{
tmp := m.GetFilter()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AccessLogValidationError{
field: "Filter",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
switch m.ConfigType.(type) {
case *AccessLog_Config:
{
tmp := m.GetConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AccessLogValidationError{
field: "Config",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *AccessLog_TypedConfig:
{
tmp := m.GetTypedConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AccessLogValidationError{
field: "TypedConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | go | func (m *AccessLog) Validate() error {
if m == nil {
return nil
}
// no validation rules for Name
{
tmp := m.GetFilter()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AccessLogValidationError{
field: "Filter",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
switch m.ConfigType.(type) {
case *AccessLog_Config:
{
tmp := m.GetConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AccessLogValidationError{
field: "Config",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
case *AccessLog_TypedConfig:
{
tmp := m.GetTypedConfig()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AccessLogValidationError{
field: "TypedConfig",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"AccessLog",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// no validation rules for Name",
"{",
"tmp",
":=",
"m",
".",
"GetFilter",
"(",
")",
"\n\n",
"if",
"v",
","... | // Validate checks the field values on AccessLog with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"AccessLog",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/filter/accesslog/v2/accesslog.pb.validate.go#L38-L99 | train |
envoyproxy/go-control-plane | envoy/config/filter/accesslog/v2/accesslog.pb.validate.go | Validate | func (m *ComparisonFilter) Validate() error {
if m == nil {
return nil
}
if _, ok := ComparisonFilter_Op_name[int32(m.GetOp())]; !ok {
return ComparisonFilterValidationError{
field: "Op",
reason: "value must be one of the defined enum values",
}
}
{
tmp := m.GetValue()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ComparisonFilterValidationError{
field: "Value",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *ComparisonFilter) Validate() error {
if m == nil {
return nil
}
if _, ok := ComparisonFilter_Op_name[int32(m.GetOp())]; !ok {
return ComparisonFilterValidationError{
field: "Op",
reason: "value must be one of the defined enum values",
}
}
{
tmp := m.GetValue()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ComparisonFilterValidationError{
field: "Value",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"ComparisonFilter",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"ComparisonFilter_Op_name",
"[",
"int32",
"(",
"m",
".",
"GetOp",
"(",
... | // Validate checks the field values on ComparisonFilter with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"ComparisonFilter",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/filter/accesslog/v2/accesslog.pb.validate.go#L403-L431 | train |
envoyproxy/go-control-plane | envoy/config/filter/accesslog/v2/accesslog.pb.validate.go | Validate | func (m *StatusCodeFilter) Validate() error {
if m == nil {
return nil
}
if m.GetComparison() == nil {
return StatusCodeFilterValidationError{
field: "Comparison",
reason: "value is required",
}
}
{
tmp := m.GetComparison()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return StatusCodeFilterValidationError{
field: "Comparison",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *StatusCodeFilter) Validate() error {
if m == nil {
return nil
}
if m.GetComparison() == nil {
return StatusCodeFilterValidationError{
field: "Comparison",
reason: "value is required",
}
}
{
tmp := m.GetComparison()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return StatusCodeFilterValidationError{
field: "Comparison",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"StatusCodeFilter",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"m",
".",
"GetComparison",
"(",
")",
"==",
"nil",
"{",
"return",
"StatusCodeFilterValidationError",... | // Validate checks the field values on StatusCodeFilter with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"StatusCodeFilter",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/filter/accesslog/v2/accesslog.pb.validate.go#L490-L518 | train |
envoyproxy/go-control-plane | envoy/config/filter/accesslog/v2/accesslog.pb.validate.go | Validate | func (m *DurationFilter) Validate() error {
if m == nil {
return nil
}
if m.GetComparison() == nil {
return DurationFilterValidationError{
field: "Comparison",
reason: "value is required",
}
}
{
tmp := m.GetComparison()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DurationFilterValidationError{
field: "Comparison",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *DurationFilter) Validate() error {
if m == nil {
return nil
}
if m.GetComparison() == nil {
return DurationFilterValidationError{
field: "Comparison",
reason: "value is required",
}
}
{
tmp := m.GetComparison()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DurationFilterValidationError{
field: "Comparison",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"DurationFilter",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"m",
".",
"GetComparison",
"(",
")",
"==",
"nil",
"{",
"return",
"DurationFilterValidationError",
"... | // Validate checks the field values on DurationFilter with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"DurationFilter",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/filter/accesslog/v2/accesslog.pb.validate.go#L577-L605 | train |
envoyproxy/go-control-plane | envoy/config/filter/accesslog/v2/accesslog.pb.validate.go | Validate | func (m *RuntimeFilter) Validate() error {
if m == nil {
return nil
}
if len(m.GetRuntimeKey()) < 1 {
return RuntimeFilterValidationError{
field: "RuntimeKey",
reason: "value length must be at least 1 bytes",
}
}
{
tmp := m.GetPercentSampled()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RuntimeFilterValidationError{
field: "PercentSampled",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
// no validation rules for UseIndependentRandomness
return nil
} | go | func (m *RuntimeFilter) Validate() error {
if m == nil {
return nil
}
if len(m.GetRuntimeKey()) < 1 {
return RuntimeFilterValidationError{
field: "RuntimeKey",
reason: "value length must be at least 1 bytes",
}
}
{
tmp := m.GetPercentSampled()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RuntimeFilterValidationError{
field: "PercentSampled",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
// no validation rules for UseIndependentRandomness
return nil
} | [
"func",
"(",
"m",
"*",
"RuntimeFilter",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"m",
".",
"GetRuntimeKey",
"(",
")",
")",
"<",
"1",
"{",
"return",
"RuntimeFilterVal... | // Validate checks the field values on RuntimeFilter with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"RuntimeFilter",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/filter/accesslog/v2/accesslog.pb.validate.go#L796-L826 | train |
envoyproxy/go-control-plane | envoy/config/filter/accesslog/v2/accesslog.pb.validate.go | Validate | func (m *OrFilter) Validate() error {
if m == nil {
return nil
}
if len(m.GetFilters()) < 2 {
return OrFilterValidationError{
field: "Filters",
reason: "value must contain at least 2 item(s)",
}
}
for idx, item := range m.GetFilters() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OrFilterValidationError{
field: fmt.Sprintf("Filters[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | go | func (m *OrFilter) Validate() error {
if m == nil {
return nil
}
if len(m.GetFilters()) < 2 {
return OrFilterValidationError{
field: "Filters",
reason: "value must contain at least 2 item(s)",
}
}
for idx, item := range m.GetFilters() {
_, _ = idx, item
{
tmp := item
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return OrFilterValidationError{
field: fmt.Sprintf("Filters[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"OrFilter",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"m",
".",
"GetFilters",
"(",
")",
")",
"<",
"2",
"{",
"return",
"OrFilterValidationError"... | // Validate checks the field values on OrFilter with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"OrFilter",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/filter/accesslog/v2/accesslog.pb.validate.go#L975-L1008 | train |
envoyproxy/go-control-plane | envoy/config/filter/accesslog/v2/accesslog.pb.validate.go | Validate | func (m *HeaderFilter) Validate() error {
if m == nil {
return nil
}
if m.GetHeader() == nil {
return HeaderFilterValidationError{
field: "Header",
reason: "value is required",
}
}
{
tmp := m.GetHeader()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return HeaderFilterValidationError{
field: "Header",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | go | func (m *HeaderFilter) Validate() error {
if m == nil {
return nil
}
if m.GetHeader() == nil {
return HeaderFilterValidationError{
field: "Header",
reason: "value is required",
}
}
{
tmp := m.GetHeader()
if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return HeaderFilterValidationError{
field: "Header",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"HeaderFilter",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"m",
".",
"GetHeader",
"(",
")",
"==",
"nil",
"{",
"return",
"HeaderFilterValidationError",
"{",
"f... | // Validate checks the field values on HeaderFilter with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"HeaderFilter",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/filter/accesslog/v2/accesslog.pb.validate.go#L1067-L1095 | train |
envoyproxy/go-control-plane | envoy/config/filter/accesslog/v2/accesslog.pb.validate.go | Validate | func (m *ResponseFlagFilter) Validate() error {
if m == nil {
return nil
}
for idx, item := range m.GetFlags() {
_, _ = idx, item
if _, ok := _ResponseFlagFilter_Flags_InLookup[item]; !ok {
return ResponseFlagFilterValidationError{
field: fmt.Sprintf("Flags[%v]", idx),
reason: "value must be in list [LH UH UT LR UR UF UC UO NR DI FI RL UAEX RLSE DC URX SI]",
}
}
}
return nil
} | go | func (m *ResponseFlagFilter) Validate() error {
if m == nil {
return nil
}
for idx, item := range m.GetFlags() {
_, _ = idx, item
if _, ok := _ResponseFlagFilter_Flags_InLookup[item]; !ok {
return ResponseFlagFilterValidationError{
field: fmt.Sprintf("Flags[%v]", idx),
reason: "value must be in list [LH UH UT LR UR UF UC UO NR DI FI RL UAEX RLSE DC URX SI]",
}
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"ResponseFlagFilter",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"for",
"idx",
",",
"item",
":=",
"range",
"m",
".",
"GetFlags",
"(",
")",
"{",
"_",
",",
"_",
... | // Validate checks the field values on ResponseFlagFilter with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"ResponseFlagFilter",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/filter/accesslog/v2/accesslog.pb.validate.go#L1154-L1172 | train |
envoyproxy/go-control-plane | envoy/config/filter/accesslog/v2/accesslog.pb.validate.go | Validate | func (m *GrpcStatusFilter) Validate() error {
if m == nil {
return nil
}
for idx, item := range m.GetStatuses() {
_, _ = idx, item
if _, ok := GrpcStatusFilter_Status_name[int32(item)]; !ok {
return GrpcStatusFilterValidationError{
field: fmt.Sprintf("Statuses[%v]", idx),
reason: "value must be one of the defined enum values",
}
}
}
// no validation rules for Exclude
return nil
} | go | func (m *GrpcStatusFilter) Validate() error {
if m == nil {
return nil
}
for idx, item := range m.GetStatuses() {
_, _ = idx, item
if _, ok := GrpcStatusFilter_Status_name[int32(item)]; !ok {
return GrpcStatusFilterValidationError{
field: fmt.Sprintf("Statuses[%v]", idx),
reason: "value must be one of the defined enum values",
}
}
}
// no validation rules for Exclude
return nil
} | [
"func",
"(",
"m",
"*",
"GrpcStatusFilter",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"for",
"idx",
",",
"item",
":=",
"range",
"m",
".",
"GetStatuses",
"(",
")",
"{",
"_",
",",
"_",
... | // Validate checks the field values on GrpcStatusFilter with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned. | [
"Validate",
"checks",
"the",
"field",
"values",
"on",
"GrpcStatusFilter",
"with",
"the",
"rules",
"defined",
"in",
"the",
"proto",
"definition",
"for",
"this",
"message",
".",
"If",
"any",
"rules",
"are",
"violated",
"an",
"error",
"is",
"returned",
"."
] | 9ffbaf293221f9fef735838632a9109d00aa2f4c | https://github.com/envoyproxy/go-control-plane/blob/9ffbaf293221f9fef735838632a9109d00aa2f4c/envoy/config/filter/accesslog/v2/accesslog.pb.validate.go#L1253-L1273 | train |
rs/zerolog | log.go | ParseLevel | func ParseLevel(levelStr string) (Level, error) {
switch levelStr {
case LevelFieldMarshalFunc(DebugLevel):
return DebugLevel, nil
case LevelFieldMarshalFunc(InfoLevel):
return InfoLevel, nil
case LevelFieldMarshalFunc(WarnLevel):
return WarnLevel, nil
case LevelFieldMarshalFunc(ErrorLevel):
return ErrorLevel, nil
case LevelFieldMarshalFunc(FatalLevel):
return FatalLevel, nil
case LevelFieldMarshalFunc(PanicLevel):
return PanicLevel, nil
case LevelFieldMarshalFunc(NoLevel):
return NoLevel, nil
}
return NoLevel, fmt.Errorf("Unknown Level String: '%s', defaulting to NoLevel", levelStr)
} | go | func ParseLevel(levelStr string) (Level, error) {
switch levelStr {
case LevelFieldMarshalFunc(DebugLevel):
return DebugLevel, nil
case LevelFieldMarshalFunc(InfoLevel):
return InfoLevel, nil
case LevelFieldMarshalFunc(WarnLevel):
return WarnLevel, nil
case LevelFieldMarshalFunc(ErrorLevel):
return ErrorLevel, nil
case LevelFieldMarshalFunc(FatalLevel):
return FatalLevel, nil
case LevelFieldMarshalFunc(PanicLevel):
return PanicLevel, nil
case LevelFieldMarshalFunc(NoLevel):
return NoLevel, nil
}
return NoLevel, fmt.Errorf("Unknown Level String: '%s', defaulting to NoLevel", levelStr)
} | [
"func",
"ParseLevel",
"(",
"levelStr",
"string",
")",
"(",
"Level",
",",
"error",
")",
"{",
"switch",
"levelStr",
"{",
"case",
"LevelFieldMarshalFunc",
"(",
"DebugLevel",
")",
":",
"return",
"DebugLevel",
",",
"nil",
"\n",
"case",
"LevelFieldMarshalFunc",
"(",... | // ParseLevel converts a level string into a zerolog Level value.
// returns an error if the input string does not match known values. | [
"ParseLevel",
"converts",
"a",
"level",
"string",
"into",
"a",
"zerolog",
"Level",
"value",
".",
"returns",
"an",
"error",
"if",
"the",
"input",
"string",
"does",
"not",
"match",
"known",
"values",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/log.go#L153-L171 | train |
rs/zerolog | log.go | New | func New(w io.Writer) Logger {
if w == nil {
w = ioutil.Discard
}
lw, ok := w.(LevelWriter)
if !ok {
lw = levelWriterAdapter{w}
}
return Logger{w: lw}
} | go | func New(w io.Writer) Logger {
if w == nil {
w = ioutil.Discard
}
lw, ok := w.(LevelWriter)
if !ok {
lw = levelWriterAdapter{w}
}
return Logger{w: lw}
} | [
"func",
"New",
"(",
"w",
"io",
".",
"Writer",
")",
"Logger",
"{",
"if",
"w",
"==",
"nil",
"{",
"w",
"=",
"ioutil",
".",
"Discard",
"\n",
"}",
"\n",
"lw",
",",
"ok",
":=",
"w",
".",
"(",
"LevelWriter",
")",
"\n",
"if",
"!",
"ok",
"{",
"lw",
... | // New creates a root logger with given output writer. If the output writer implements
// the LevelWriter interface, the WriteLevel method will be called instead of the Write
// one.
//
// Each logging operation makes a single call to the Writer's Write method. There is no
// guaranty on access serialization to the Writer. If your Writer is not thread safe,
// you may consider using sync wrapper. | [
"New",
"creates",
"a",
"root",
"logger",
"with",
"given",
"output",
"writer",
".",
"If",
"the",
"output",
"writer",
"implements",
"the",
"LevelWriter",
"interface",
"the",
"WriteLevel",
"method",
"will",
"be",
"called",
"instead",
"of",
"the",
"Write",
"one",
... | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/log.go#L193-L202 | train |
rs/zerolog | log.go | Output | func (l Logger) Output(w io.Writer) Logger {
l2 := New(w)
l2.level = l.level
l2.sampler = l.sampler
if len(l.hooks) > 0 {
l2.hooks = append(l2.hooks, l.hooks...)
}
if l.context != nil {
l2.context = make([]byte, len(l.context), cap(l.context))
copy(l2.context, l.context)
}
return l2
} | go | func (l Logger) Output(w io.Writer) Logger {
l2 := New(w)
l2.level = l.level
l2.sampler = l.sampler
if len(l.hooks) > 0 {
l2.hooks = append(l2.hooks, l.hooks...)
}
if l.context != nil {
l2.context = make([]byte, len(l.context), cap(l.context))
copy(l2.context, l.context)
}
return l2
} | [
"func",
"(",
"l",
"Logger",
")",
"Output",
"(",
"w",
"io",
".",
"Writer",
")",
"Logger",
"{",
"l2",
":=",
"New",
"(",
"w",
")",
"\n",
"l2",
".",
"level",
"=",
"l",
".",
"level",
"\n",
"l2",
".",
"sampler",
"=",
"l",
".",
"sampler",
"\n",
"if"... | // Output duplicates the current logger and sets w as its output. | [
"Output",
"duplicates",
"the",
"current",
"logger",
"and",
"sets",
"w",
"as",
"its",
"output",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/log.go#L210-L222 | train |
Subsets and Splits
SQL Console for semeru/code-text-go
Retrieves a limited set of code samples with their languages, with a specific case adjustment for 'Go' language.