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

     1  // Code generated by protoc-gen-goten-validate
     2  // File: edgelq/alerting/proto/v1/ts_condition.proto
     3  // DO NOT EDIT!!!
     4  
     5  package ts_condition
     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  	log_condition_template "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/log_condition_template"
    26  	policy "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/policy"
    27  	meta "github.com/cloudwan/goten-sdk/types/meta"
    28  	fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
    29  )
    30  
    31  var (
    32  	_ = bytes.Equal
    33  	_ = errors.New
    34  	_ = fmt.Errorf
    35  	_ = net.ParseIP
    36  	_ = regexp.Match
    37  	_ = strings.Split
    38  	_ = time.Now
    39  	_ = utf8.RuneCountInString
    40  	_ = url.Parse
    41  	_ = gotenvalidate.NewValidationError
    42  )
    43  
    44  // make sure we're using proto imports
    45  var (
    46  	_ = &document.Document{}
    47  	_ = &log_condition_template.LogConditionTemplate{}
    48  	_ = &policy.Policy{}
    49  	_ = &rcommon.LogCndSpec{}
    50  	_ = &fieldmaskpb.FieldMask{}
    51  	_ = &meta.Meta{}
    52  )
    53  
    54  func (obj *TsCondition) GotenValidate() error {
    55  	if obj == nil {
    56  		return nil
    57  	}
    58  	if subobj, ok := interface{}(obj.Metadata).(gotenvalidate.Validator); ok {
    59  		if err := subobj.GotenValidate(); err != nil {
    60  			return gotenvalidate.NewValidationError("TsCondition", "metadata", obj.Metadata, "nested object validation failed", err)
    61  		}
    62  	}
    63  	{
    64  		rlen := utf8.RuneCountInString(obj.DisplayName)
    65  		if rlen > 256 {
    66  			return gotenvalidate.NewValidationError("TsCondition", "displayName", obj.DisplayName, "field must contain at most 256 characters", nil)
    67  		}
    68  	}
    69  	{
    70  		rlen := utf8.RuneCountInString(obj.Description)
    71  		if rlen > 512 {
    72  			return gotenvalidate.NewValidationError("TsCondition", "description", obj.Description, "field must contain at most 512 characters", nil)
    73  		}
    74  	}
    75  	if obj.Spec == nil {
    76  		return gotenvalidate.NewValidationError("TsCondition", "spec", obj.Spec, "field is required", nil)
    77  	}
    78  	if subobj, ok := interface{}(obj.Spec).(gotenvalidate.Validator); ok {
    79  		if err := subobj.GotenValidate(); err != nil {
    80  			return gotenvalidate.NewValidationError("TsCondition", "spec", obj.Spec, "nested object validation failed", err)
    81  		}
    82  	}
    83  	if subobj, ok := interface{}(obj.Internal).(gotenvalidate.Validator); ok {
    84  		if err := subobj.GotenValidate(); err != nil {
    85  			return gotenvalidate.NewValidationError("TsCondition", "internal", obj.Internal, "nested object validation failed", err)
    86  		}
    87  	}
    88  	if subobj, ok := interface{}(obj.FilterSelector).(gotenvalidate.Validator); ok {
    89  		if err := subobj.GotenValidate(); err != nil {
    90  			return gotenvalidate.NewValidationError("TsCondition", "filterSelector", obj.FilterSelector, "nested object validation failed", err)
    91  		}
    92  	}
    93  	if subobj, ok := interface{}(obj.TemplateSource).(gotenvalidate.Validator); ok {
    94  		if err := subobj.GotenValidate(); err != nil {
    95  			return gotenvalidate.NewValidationError("TsCondition", "templateSource", obj.TemplateSource, "nested object validation failed", err)
    96  		}
    97  	}
    98  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
    99  		return cvobj.GotenCustomValidate()
   100  	}
   101  	return nil
   102  }
   103  func (obj *TsCondition_Internal) GotenValidate() error {
   104  	if obj == nil {
   105  		return nil
   106  	}
   107  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   108  		return cvobj.GotenCustomValidate()
   109  	}
   110  	return nil
   111  }
   112  func (obj *TsCondition_Selector) GotenValidate() error {
   113  	if obj == nil {
   114  		return nil
   115  	}
   116  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   117  		return cvobj.GotenCustomValidate()
   118  	}
   119  	return nil
   120  }
   121  func (obj *TsCondition_TemplateSource) GotenValidate() error {
   122  	if obj == nil {
   123  		return nil
   124  	}
   125  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   126  		return cvobj.GotenCustomValidate()
   127  	}
   128  	return nil
   129  }
   130  func (obj *TsCondition_Selector_Strings) GotenValidate() error {
   131  	if obj == nil {
   132  		return nil
   133  	}
   134  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   135  		return cvobj.GotenCustomValidate()
   136  	}
   137  	return nil
   138  }