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

     1  // Code generated by protoc-gen-goten-validate
     2  // File: edgelq/alerting/proto/v1/notification_channel.proto
     3  // DO NOT EDIT!!!
     4  
     5  package notification_channel
     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  	iam_project "github.com/cloudwan/edgelq-sdk/iam/resources/v1/project"
    25  	meta "github.com/cloudwan/goten-sdk/types/meta"
    26  	timestamppb "google.golang.org/protobuf/types/known/timestamppb"
    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  	_ = &rcommon.LogCndSpec{}
    45  	_ = &iam_project.Project{}
    46  	_ = &timestamppb.Timestamp{}
    47  	_ = &meta.Meta{}
    48  )
    49  
    50  func (obj *NotificationChannel) 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("NotificationChannel", "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("NotificationChannel", "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("NotificationChannel", "description", obj.Description, "field must contain at most 512 characters", nil)
    69  		}
    70  	}
    71  	if subobj, ok := interface{}(obj.Spec).(gotenvalidate.Validator); ok {
    72  		if err := subobj.GotenValidate(); err != nil {
    73  			return gotenvalidate.NewValidationError("NotificationChannel", "spec", obj.Spec, "nested object validation failed", err)
    74  		}
    75  	}
    76  	if subobj, ok := interface{}(obj.State).(gotenvalidate.Validator); ok {
    77  		if err := subobj.GotenValidate(); err != nil {
    78  			return gotenvalidate.NewValidationError("NotificationChannel", "state", obj.State, "nested object validation failed", err)
    79  		}
    80  	}
    81  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
    82  		return cvobj.GotenCustomValidate()
    83  	}
    84  	return nil
    85  }
    86  func (obj *NotificationChannel_State) GotenValidate() error {
    87  	if obj == nil {
    88  		return nil
    89  	}
    90  	if subobj, ok := interface{}(obj.Error).(gotenvalidate.Validator); ok {
    91  		if err := subobj.GotenValidate(); err != nil {
    92  			return gotenvalidate.NewValidationError("State", "error", obj.Error, "nested object validation failed", err)
    93  		}
    94  	}
    95  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
    96  		return cvobj.GotenCustomValidate()
    97  	}
    98  	return nil
    99  }
   100  func (obj *NotificationChannel_State_Error) GotenValidate() error {
   101  	if obj == nil {
   102  		return nil
   103  	}
   104  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   105  		return cvobj.GotenCustomValidate()
   106  	}
   107  	return nil
   108  }