// Validate checks the field values on AccessLogFilter with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned.
426962
func (m *AccessLogFilter) Validate() error {
	if m == nil {
		return nil
	}

	switch m.FilterSpecifier.(type) {

	case *AccessLogFilter_StatusCodeFilter:

		{
			tmp := m.GetStatusCodeFilter()

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return AccessLogFilterValidationError{
						field:  "StatusCodeFilter",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	case *AccessLogFilter_DurationFilter:

		{
			tmp := m.GetDurationFilter()

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return AccessLogFilterValidationError{
						field:  "DurationFilter",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	case *AccessLogFilter_NotHealthCheckFilter:

		{
			tmp := m.GetNotHealthCheckFilter()

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return AccessLogFilterValidationError{
						field:  "NotHealthCheckFilter",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	case *AccessLogFilter_TraceableFilter:

		{
			tmp := m.GetTraceableFilter()

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return AccessLogFilterValidationError{
						field:  "TraceableFilter",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	case *AccessLogFilter_RuntimeFilter:

		{
			tmp := m.GetRuntimeFilter()

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return AccessLogFilterValidationError{
						field:  "RuntimeFilter",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	case *AccessLogFilter_AndFilter:

		{
			tmp := m.GetAndFilter()

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return AccessLogFilterValidationError{
						field:  "AndFilter",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	case *AccessLogFilter_OrFilter:

		{
			tmp := m.GetOrFilter()

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return AccessLogFilterValidationError{
						field:  "OrFilter",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	case *AccessLogFilter_HeaderFilter:

		{
			tmp := m.GetHeaderFilter()

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return AccessLogFilterValidationError{
						field:  "HeaderFilter",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	case *AccessLogFilter_ResponseFlagFilter:

		{
			tmp := m.GetResponseFlagFilter()

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return AccessLogFilterValidationError{
						field:  "ResponseFlagFilter",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	case *AccessLogFilter_GrpcStatusFilter:

		{
			tmp := m.GetGrpcStatusFilter()

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return AccessLogFilterValidationError{
						field:  "GrpcStatusFilter",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	default:
		return AccessLogFilterValidationError{
			field:  "FilterSpecifier",
			reason: "value is required",
		}

	}

	return nil
}
173273
func (r *InRule) Validate(value interface{}) error {
	value, isNil := Indirect(value)
	if isNil || IsEmpty(value) {
		return nil
	}

	for _, e := range r.elements {
		if e == value {
			return nil
		}
	}
	return errors.New(r.message)
}
1323306
func (m *StreamAccessLogsMessage) Validate() error {
	if m == nil {
		return nil
	}

	{
		tmp := m.GetIdentifier()

		if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

			if err := v.Validate(); err != nil {
				return StreamAccessLogsMessageValidationError{
					field:  "Identifier",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}
	}

	switch m.LogEntries.(type) {

	case *StreamAccessLogsMessage_HttpLogs:

		{
			tmp := m.GetHttpLogs()

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return StreamAccessLogsMessageValidationError{
						field:  "HttpLogs",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	case *StreamAccessLogsMessage_TcpLogs:

		{
			tmp := m.GetTcpLogs()

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return StreamAccessLogsMessageValidationError{
						field:  "TcpLogs",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	default:
		return StreamAccessLogsMessageValidationError{
			field:  "LogEntries",
			reason: "value is required",
		}

	}

	return nil
}
26526
func (conf *rExecConf) validate() error {
	// Validate the filters
	if conf.node != "" {
		if _, err := regexp.Compile(conf.node); err != nil {
			return fmt.Errorf("Failed to compile node filter regexp: %v", err)
		}
	}
	if conf.service != "" {
		if _, err := regexp.Compile(conf.service); err != nil {
			return fmt.Errorf("Failed to compile service filter regexp: %v", err)
		}
	}
	if conf.tag != "" {
		if _, err := regexp.Compile(conf.tag); err != nil {
			return fmt.Errorf("Failed to compile tag filter regexp: %v", err)
		}
	}
	if conf.tag != "" && conf.service == "" {
		return fmt.Errorf("Cannot provide tag filter without service filter.")
	}
	return nil
}
603984
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
}
1091369
func (r *notNilRule) Validate(value interface{}) error {
	_, isNil := Indirect(value)
	if isNil {
		return errors.New(r.message)
	}
	return nil
}
1153745
func (m *Policy) Validate() error {
	if m == nil {
		return nil
	}

	if len(m.GetPermissions()) < 1 {
		return PolicyValidationError{
			field:  "Permissions",
			reason: "value must contain at least 1 item(s)",
		}
	}

	for idx, item := range m.GetPermissions() {
		_, _ = idx, item

		{
			tmp := item

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return PolicyValidationError{
						field:  fmt.Sprintf("Permissions[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	}

	if len(m.GetPrincipals()) < 1 {
		return PolicyValidationError{
			field:  "Principals",
			reason: "value must contain at least 1 item(s)",
		}
	}

	for idx, item := range m.GetPrincipals() {
		_, _ = idx, item

		{
			tmp := item

			if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

				if err := v.Validate(); err != nil {
					return PolicyValidationError{
						field:  fmt.Sprintf("Principals[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	}

	return nil
}
136367
func (filter *Filter) Validate() error {
	if filter.EventFormat != "client" && filter.EventFormat != "federation" {
		return errors.New("Bad event_format value. Must be one of [\"client\", \"federation\"]")
	}
	return nil
}
328903
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
}
16792
func (v *ACLType) Validate() error {

	if v.Grantee != nil {
		if err := v.Grantee.Validate(); err != nil {
			return err
		}
	}

	if v.Grantee == nil {
		return errors.ParameterRequiredError{
			ParameterName: "Grantee",
			ParentName:    "ACL",
		}
	}

	if v.Permission == nil {
		return errors.ParameterRequiredError{
			ParameterName: "Permission",
			ParentName:    "ACL",
		}
	}

	if v.Permission != nil {
		permissionValidValues := []string{"READ", "WRITE", "FULL_CONTROL"}
		permissionParameterValue := fmt.Sprint(*v.Permission)

		permissionIsValid := false
		for _, value := range permissionValidValues {
			if value == permissionParameterValue {
				permissionIsValid = true
			}
		}

		if !permissionIsValid {
			return errors.ParameterValueNotAllowedError{
				ParameterName:  "Permission",
				ParameterValue: permissionParameterValue,
				AllowedValues:  permissionValidValues,
			}
		}
	}

	return nil
}
38239
func (v *FilterType) Validate() error {

	if v.Prefix == nil {
		return errors.ParameterRequiredError{
			ParameterName: "Prefix",
			ParentName:    "Filter",
		}
	}

	return nil
}
1092669
func (a *AliasAddAction) Validate() error {
	var invalid []string
	if len(a.alias) == 0 {
		invalid = append(invalid, "Alias")
	}
	if len(a.index) == 0 {
		invalid = append(invalid, "Index")
	}
	if len(invalid) > 0 {
		return fmt.Errorf("missing required fields: %v", invalid)
	}
	if a.isWriteIndex != nil && len(a.index) > 1 {
		return fmt.Errorf("more than 1 target index specified in operation with 'is_write_index' flag present")
	}
	return nil
}
942663
func (lst *LogStreamState) Validate() error {
	if lst.Created.IsZero() {
		return errors.New("missing created time")
	}
	if lst.Updated.IsZero() {
		return errors.New("missing updated time")
	}

	if lst.Terminated() && lst.TerminatedTime.IsZero() {
		return errors.New("log stream is terminated, but missing terminated time")
	}
	if err := types.PrefixSecret(lst.Secret).Validate(); err != nil {
		return fmt.Errorf("invalid prefix secret: %v", err)
	}

	return nil
}
328527
func (c *Config) Validate() error {
	if c.API == nil {
		return errors.NotValidf("missing API")
	}
	if c.InProcessUpdate == nil {
		return errors.NotValidf("missing InProcessUpdate")
	}
	if c.Logger == nil {
		return errors.NotValidf("missing Logger")
	}
	return nil
}
1286924
func (field *RelationalFieldDefinition) Validate() *dslengine.ValidationErrors {
	fmt.Println("Validing Field")
	verr := new(dslengine.ValidationErrors)

	if field.Parent == nil {
		verr.Add(field, "missing relational model parent")
	}
	if field.FieldName == "" {
		verr.Add(field, "field name not defined")
	}
	return verr.AsError()
}
1098073
func (a ElasticsearchArgs) Validate() error {
	if !a.Enable {
		return nil
	}
	if a.URL.IsEmpty() {
		return errors.New("empty URL")
	}
	if a.Format != "" {
		f := strings.ToLower(a.Format)
		if f != event.NamespaceFormat && f != event.AccessFormat {
			return errors.New("format value unrecognized")
		}
	}
	if a.Index == "" {
		return errors.New("empty index value")
	}
	return nil
}
1106738
func (bc *BooleanConstraint) Validate(v interface{}) error {
	rv := reflect.ValueOf(v)
	switch rv.Kind() {
	case reflect.Bool:
	default:
		return errors.New("value is not a boolean")
	}
	return nil
}