github.com/cloudwan/edgelq-sdk@v1.15.4/alerting/resources/v1/log_condition_template/log_condition_template.pb.validate.go (about)

     1  // Code generated by protoc-gen-goten-validate
     2  // File: edgelq/alerting/proto/v1/log_condition_template.proto
     3  // DO NOT EDIT!!!
     4  
     5  package log_condition_template
     6  
     7  import (
     8  	"bytes"
     9  	"errors"
    10  	"fmt"
    11  	"net"
    12  	"net/url"
    13  	"regexp"
    14  	"strings"
    15  	"time"
    16  	"unicode/utf8"
    17  
    18  	gotenvalidate "github.com/cloudwan/goten-sdk/runtime/validate"
    19  )
    20  
    21  // proto imports
    22  import (
    23  	rcommon "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/common"
    24  	document "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/document"
    25  	policy_template "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/policy_template"
    26  	meta "github.com/cloudwan/goten-sdk/types/meta"
    27  )
    28  
    29  var (
    30  	_ = bytes.Equal
    31  	_ = errors.New
    32  	_ = fmt.Errorf
    33  	_ = net.ParseIP
    34  	_ = regexp.Match
    35  	_ = strings.Split
    36  	_ = time.Now
    37  	_ = utf8.RuneCountInString
    38  	_ = url.Parse
    39  	_ = gotenvalidate.NewValidationError
    40  )
    41  
    42  // make sure we're using proto imports
    43  var (
    44  	_ = &document.Document{}
    45  	_ = &policy_template.PolicyTemplate{}
    46  	_ = &rcommon.LogCndSpec{}
    47  	_ = &meta.Meta{}
    48  )
    49  
    50  func (obj *LogConditionTemplate) GotenValidate() error {
    51  	if obj == nil {
    52  		return nil
    53  	}
    54  	if subobj, ok := interface{}(obj.Metadata).(gotenvalidate.Validator); ok {
    55  		if err := subobj.GotenValidate(); err != nil {
    56  			return gotenvalidate.NewValidationError("LogConditionTemplate", "metadata", obj.Metadata, "nested object validation failed", err)
    57  		}
    58  	}
    59  	{
    60  		rlen := utf8.RuneCountInString(obj.DisplayName)
    61  		if rlen > 256 {
    62  			return gotenvalidate.NewValidationError("LogConditionTemplate", "displayName", obj.DisplayName, "field must contain at most 256 characters", nil)
    63  		}
    64  	}
    65  	{
    66  		rlen := utf8.RuneCountInString(obj.Description)
    67  		if rlen > 512 {
    68  			return gotenvalidate.NewValidationError("LogConditionTemplate", "description", obj.Description, "field must contain at most 512 characters", nil)
    69  		}
    70  	}
    71  	if obj.SpecTemplate == nil {
    72  		return gotenvalidate.NewValidationError("LogConditionTemplate", "specTemplate", obj.SpecTemplate, "field is required", nil)
    73  	}
    74  	if subobj, ok := interface{}(obj.SpecTemplate).(gotenvalidate.Validator); ok {
    75  		if err := subobj.GotenValidate(); err != nil {
    76  			return gotenvalidate.NewValidationError("LogConditionTemplate", "specTemplate", obj.SpecTemplate, "nested object validation failed", err)
    77  		}
    78  	}
    79  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
    80  		return cvobj.GotenCustomValidate()
    81  	}
    82  	return nil
    83  }