github.com/cloudwan/edgelq-sdk@v1.15.4/monitoring/resources/v4/notification/notification.pb.validate.go (about)

     1  // Code generated by protoc-gen-goten-validate
     2  // File: edgelq/monitoring/proto/v4/notification.proto
     3  // DO NOT EDIT!!!
     4  
     5  package notification
     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  	alert "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/alert"
    24  	alerting_condition "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/alerting_condition"
    25  	alerting_policy "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/alerting_policy"
    26  	common "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/common"
    27  	notification_channel "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/notification_channel"
    28  	project "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/project"
    29  	meta "github.com/cloudwan/goten-sdk/types/meta"
    30  )
    31  
    32  var (
    33  	_ = bytes.Equal
    34  	_ = errors.New
    35  	_ = fmt.Errorf
    36  	_ = net.ParseIP
    37  	_ = regexp.Match
    38  	_ = strings.Split
    39  	_ = time.Now
    40  	_ = utf8.RuneCountInString
    41  	_ = url.Parse
    42  	_ = gotenvalidate.NewValidationError
    43  )
    44  
    45  // make sure we're using proto imports
    46  var (
    47  	_ = &alert.Alert{}
    48  	_ = &alerting_condition.AlertingCondition{}
    49  	_ = &alerting_policy.AlertingPolicy{}
    50  	_ = &common.LabelDescriptor{}
    51  	_ = &notification_channel.NotificationChannel{}
    52  	_ = &project.Project{}
    53  	_ = &meta.Meta{}
    54  )
    55  
    56  func (obj *Notification) GotenValidate() error {
    57  	if obj == nil {
    58  		return nil
    59  	}
    60  	if subobj, ok := interface{}(obj.Metadata).(gotenvalidate.Validator); ok {
    61  		if err := subobj.GotenValidate(); err != nil {
    62  			return gotenvalidate.NewValidationError("Notification", "metadata", obj.Metadata, "nested object validation failed", err)
    63  		}
    64  	}
    65  	for idx, elem := range obj.AlertSets {
    66  		if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok {
    67  			if err := subobj.GotenValidate(); err != nil {
    68  				return gotenvalidate.NewValidationError("Notification", "alertSets", obj.AlertSets[idx], "nested object validation failed", err)
    69  			}
    70  		}
    71  	}
    72  	if subobj, ok := interface{}(obj.State).(gotenvalidate.Validator); ok {
    73  		if err := subobj.GotenValidate(); err != nil {
    74  			return gotenvalidate.NewValidationError("Notification", "state", obj.State, "nested object validation failed", err)
    75  		}
    76  	}
    77  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
    78  		return cvobj.GotenCustomValidate()
    79  	}
    80  	return nil
    81  }
    82  func (obj *Notification_AlertsSet) GotenValidate() error {
    83  	if obj == nil {
    84  		return nil
    85  	}
    86  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
    87  		return cvobj.GotenCustomValidate()
    88  	}
    89  	return nil
    90  }
    91  func (obj *Notification_State) GotenValidate() error {
    92  	if obj == nil {
    93  		return nil
    94  	}
    95  	for idx, elem := range obj.NotificationState {
    96  		if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok {
    97  			if err := subobj.GotenValidate(); err != nil {
    98  				return gotenvalidate.NewValidationError("State", "notificationState", obj.NotificationState[idx], "nested object validation failed", err)
    99  			}
   100  		}
   101  	}
   102  	if subobj, ok := interface{}(obj.AlertsLifetime).(gotenvalidate.Validator); ok {
   103  		if err := subobj.GotenValidate(); err != nil {
   104  			return gotenvalidate.NewValidationError("State", "alertsLifetime", obj.AlertsLifetime, "nested object validation failed", err)
   105  		}
   106  	}
   107  	for idx, elem := range obj.ResolutionNotificationState {
   108  		if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok {
   109  			if err := subobj.GotenValidate(); err != nil {
   110  				return gotenvalidate.NewValidationError("State", "resolutionNotificationState", obj.ResolutionNotificationState[idx], "nested object validation failed", err)
   111  			}
   112  		}
   113  	}
   114  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   115  		return cvobj.GotenCustomValidate()
   116  	}
   117  	return nil
   118  }
   119  func (obj *Notification_State_NotificationState) GotenValidate() error {
   120  	if obj == nil {
   121  		return nil
   122  	}
   123  	if subobj, ok := interface{}(obj.ProviderData).(gotenvalidate.Validator); ok {
   124  		if err := subobj.GotenValidate(); err != nil {
   125  			return gotenvalidate.NewValidationError("NotificationState", "providerData", obj.ProviderData, "nested object validation failed", err)
   126  		}
   127  	}
   128  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   129  		return cvobj.GotenCustomValidate()
   130  	}
   131  	return nil
   132  }
   133  func (obj *Notification_State_NotificationState_ProviderData) GotenValidate() error {
   134  	if obj == nil {
   135  		return nil
   136  	}
   137  	if subobj, ok := interface{}(obj.Slack).(gotenvalidate.Validator); ok {
   138  		if err := subobj.GotenValidate(); err != nil {
   139  			return gotenvalidate.NewValidationError("ProviderData", "slack", obj.Slack, "nested object validation failed", err)
   140  		}
   141  	}
   142  	if subobj, ok := interface{}(obj.PagerDuty).(gotenvalidate.Validator); ok {
   143  		if err := subobj.GotenValidate(); err != nil {
   144  			return gotenvalidate.NewValidationError("ProviderData", "pagerDuty", obj.PagerDuty, "nested object validation failed", err)
   145  		}
   146  	}
   147  	if subobj, ok := interface{}(obj.Webhook).(gotenvalidate.Validator); ok {
   148  		if err := subobj.GotenValidate(); err != nil {
   149  			return gotenvalidate.NewValidationError("ProviderData", "webhook", obj.Webhook, "nested object validation failed", err)
   150  		}
   151  	}
   152  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   153  		return cvobj.GotenCustomValidate()
   154  	}
   155  	return nil
   156  }
   157  func (obj *Notification_State_NotificationState_ProviderData_Slack) GotenValidate() error {
   158  	if obj == nil {
   159  		return nil
   160  	}
   161  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   162  		return cvobj.GotenCustomValidate()
   163  	}
   164  	return nil
   165  }
   166  func (obj *Notification_State_NotificationState_ProviderData_PagerDuty) GotenValidate() error {
   167  	if obj == nil {
   168  		return nil
   169  	}
   170  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   171  		return cvobj.GotenCustomValidate()
   172  	}
   173  	return nil
   174  }
   175  func (obj *Notification_State_NotificationState_ProviderData_WebHook) GotenValidate() error {
   176  	if obj == nil {
   177  		return nil
   178  	}
   179  	for idx, elem := range obj.FailedChunks {
   180  		if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok {
   181  			if err := subobj.GotenValidate(); err != nil {
   182  				return gotenvalidate.NewValidationError("WebHook", "failedChunks", obj.FailedChunks[idx], "nested object validation failed", err)
   183  			}
   184  		}
   185  	}
   186  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   187  		return cvobj.GotenCustomValidate()
   188  	}
   189  	return nil
   190  }
   191  func (obj *Notification_State_NotificationState_ProviderData_WebHook_FailedChunks) GotenValidate() error {
   192  	if obj == nil {
   193  		return nil
   194  	}
   195  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   196  		return cvobj.GotenCustomValidate()
   197  	}
   198  	return nil
   199  }