github.com/cloudwan/edgelq-sdk@v1.15.4/monitoring/client/v4/metric_descriptor/metric_descriptor_custom.pb.validate.go (about)

     1  // Code generated by protoc-gen-goten-validate
     2  // File: edgelq/monitoring/proto/v4/metric_descriptor_custom.proto
     3  // DO NOT EDIT!!!
     4  
     5  package metric_descriptor_client
     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  	metric_descriptor "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/metric_descriptor"
    24  	project "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/project"
    25  	view "github.com/cloudwan/goten-sdk/types/view"
    26  	fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
    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  	_ = &metric_descriptor.MetricDescriptor{}
    45  	_ = &project.Project{}
    46  	_ = &fieldmaskpb.FieldMask{}
    47  	_ = view.View(0)
    48  )
    49  
    50  func (obj *GetMetricDescriptorRequest) GotenValidate() error {
    51  	if obj == nil {
    52  		return nil
    53  	}
    54  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
    55  		return cvobj.GotenCustomValidate()
    56  	}
    57  	return nil
    58  }
    59  func (obj *CreateMetricDescriptorRequest) GotenValidate() error {
    60  	if obj == nil {
    61  		return nil
    62  	}
    63  	if obj.MetricDescriptor == nil {
    64  		return gotenvalidate.NewValidationError("CreateMetricDescriptorRequest", "metricDescriptor", obj.MetricDescriptor, "field is required", nil)
    65  	}
    66  	if subobj, ok := interface{}(obj.MetricDescriptor).(gotenvalidate.Validator); ok {
    67  		if err := subobj.GotenValidate(); err != nil {
    68  			return gotenvalidate.NewValidationError("CreateMetricDescriptorRequest", "metricDescriptor", obj.MetricDescriptor, "nested object validation failed", err)
    69  		}
    70  	}
    71  	if subobj, ok := interface{}(obj.ResponseMask).(gotenvalidate.Validator); ok {
    72  		if err := subobj.GotenValidate(); err != nil {
    73  			return gotenvalidate.NewValidationError("CreateMetricDescriptorRequest", "responseMask", obj.ResponseMask, "nested object validation failed", err)
    74  		}
    75  	}
    76  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
    77  		return cvobj.GotenCustomValidate()
    78  	}
    79  	return nil
    80  }
    81  func (obj *CreateMetricDescriptorRequest_ResponseMask) GotenValidate() error {
    82  	if obj == nil {
    83  		return nil
    84  	}
    85  	switch opt := obj.Masking.(type) {
    86  	case *CreateMetricDescriptorRequest_ResponseMask_SkipEntireResponseBody:
    87  	case *CreateMetricDescriptorRequest_ResponseMask_BodyMask:
    88  	default:
    89  		_ = opt
    90  	}
    91  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
    92  		return cvobj.GotenCustomValidate()
    93  	}
    94  	return nil
    95  }
    96  func (obj *UpdateMetricDescriptorRequest) GotenValidate() error {
    97  	if obj == nil {
    98  		return nil
    99  	}
   100  	if obj.MetricDescriptor == nil {
   101  		return gotenvalidate.NewValidationError("UpdateMetricDescriptorRequest", "metricDescriptor", obj.MetricDescriptor, "field is required", nil)
   102  	}
   103  	if subobj, ok := interface{}(obj.MetricDescriptor).(gotenvalidate.Validator); ok {
   104  		if err := subobj.GotenValidate(); err != nil {
   105  			return gotenvalidate.NewValidationError("UpdateMetricDescriptorRequest", "metricDescriptor", obj.MetricDescriptor, "nested object validation failed", err)
   106  		}
   107  	}
   108  	if subobj, ok := interface{}(obj.Cas).(gotenvalidate.Validator); ok {
   109  		if err := subobj.GotenValidate(); err != nil {
   110  			return gotenvalidate.NewValidationError("UpdateMetricDescriptorRequest", "cas", obj.Cas, "nested object validation failed", err)
   111  		}
   112  	}
   113  	if subobj, ok := interface{}(obj.ResponseMask).(gotenvalidate.Validator); ok {
   114  		if err := subobj.GotenValidate(); err != nil {
   115  			return gotenvalidate.NewValidationError("UpdateMetricDescriptorRequest", "responseMask", obj.ResponseMask, "nested object validation failed", err)
   116  		}
   117  	}
   118  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   119  		return cvobj.GotenCustomValidate()
   120  	}
   121  	return nil
   122  }
   123  func (obj *UpdateMetricDescriptorRequest_CAS) GotenValidate() error {
   124  	if obj == nil {
   125  		return nil
   126  	}
   127  	if subobj, ok := interface{}(obj.ConditionalState).(gotenvalidate.Validator); ok {
   128  		if err := subobj.GotenValidate(); err != nil {
   129  			return gotenvalidate.NewValidationError("CAS", "conditionalState", obj.ConditionalState, "nested object validation failed", err)
   130  		}
   131  	}
   132  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   133  		return cvobj.GotenCustomValidate()
   134  	}
   135  	return nil
   136  }
   137  func (obj *UpdateMetricDescriptorRequest_ResponseMask) GotenValidate() error {
   138  	if obj == nil {
   139  		return nil
   140  	}
   141  	switch opt := obj.Masking.(type) {
   142  	case *UpdateMetricDescriptorRequest_ResponseMask_SkipEntireResponseBody:
   143  	case *UpdateMetricDescriptorRequest_ResponseMask_UpdatedFieldsOnly:
   144  	case *UpdateMetricDescriptorRequest_ResponseMask_BodyMask:
   145  	default:
   146  		_ = opt
   147  	}
   148  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   149  		return cvobj.GotenCustomValidate()
   150  	}
   151  	return nil
   152  }
   153  func (obj *DeleteMetricDescriptorRequest) GotenValidate() error {
   154  	if obj == nil {
   155  		return nil
   156  	}
   157  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   158  		return cvobj.GotenCustomValidate()
   159  	}
   160  	return nil
   161  }
   162  func (obj *ListMetricDescriptorsRequest) GotenValidate() error {
   163  	if obj == nil {
   164  		return nil
   165  	}
   166  	if !(obj.PageSize >= 0) {
   167  		return gotenvalidate.NewValidationError("ListMetricDescriptorsRequest", "pageSize", obj.PageSize, "field must be greater or equal to 0", nil)
   168  	}
   169  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   170  		return cvobj.GotenCustomValidate()
   171  	}
   172  	return nil
   173  }
   174  func (obj *ListMetricDescriptorsResponse) GotenValidate() error {
   175  	if obj == nil {
   176  		return nil
   177  	}
   178  	for idx, elem := range obj.MetricDescriptors {
   179  		if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok {
   180  			if err := subobj.GotenValidate(); err != nil {
   181  				return gotenvalidate.NewValidationError("ListMetricDescriptorsResponse", "metricDescriptors", obj.MetricDescriptors[idx], "nested object validation failed", err)
   182  			}
   183  		}
   184  	}
   185  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   186  		return cvobj.GotenCustomValidate()
   187  	}
   188  	return nil
   189  }