github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/admin/v2alpha/server_info.pb.validate.go (about)

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/admin/v2alpha/server_info.proto
     3  
     4  package envoy_admin_v2alpha
     5  
     6  import (
     7  	"bytes"
     8  	"errors"
     9  	"fmt"
    10  	"net"
    11  	"net/mail"
    12  	"net/url"
    13  	"regexp"
    14  	"strings"
    15  	"time"
    16  	"unicode/utf8"
    17  
    18  	"google.golang.org/protobuf/types/known/anypb"
    19  )
    20  
    21  // ensure the imports are used
    22  var (
    23  	_ = bytes.MinRead
    24  	_ = errors.New("")
    25  	_ = fmt.Print
    26  	_ = utf8.UTFMax
    27  	_ = (*regexp.Regexp)(nil)
    28  	_ = (*strings.Reader)(nil)
    29  	_ = net.IPv4len
    30  	_ = time.Duration(0)
    31  	_ = (*url.URL)(nil)
    32  	_ = (*mail.Address)(nil)
    33  	_ = anypb.Any{}
    34  )
    35  
    36  // Validate checks the field values on ServerInfo with the rules defined in the
    37  // proto definition for this message. If any rules are violated, an error is returned.
    38  func (m *ServerInfo) Validate() error {
    39  	if m == nil {
    40  		return nil
    41  	}
    42  
    43  	// no validation rules for Version
    44  
    45  	// no validation rules for State
    46  
    47  	if v, ok := interface{}(m.GetUptimeCurrentEpoch()).(interface{ Validate() error }); ok {
    48  		if err := v.Validate(); err != nil {
    49  			return ServerInfoValidationError{
    50  				field:  "UptimeCurrentEpoch",
    51  				reason: "embedded message failed validation",
    52  				cause:  err,
    53  			}
    54  		}
    55  	}
    56  
    57  	if v, ok := interface{}(m.GetUptimeAllEpochs()).(interface{ Validate() error }); ok {
    58  		if err := v.Validate(); err != nil {
    59  			return ServerInfoValidationError{
    60  				field:  "UptimeAllEpochs",
    61  				reason: "embedded message failed validation",
    62  				cause:  err,
    63  			}
    64  		}
    65  	}
    66  
    67  	// no validation rules for HotRestartVersion
    68  
    69  	if v, ok := interface{}(m.GetCommandLineOptions()).(interface{ Validate() error }); ok {
    70  		if err := v.Validate(); err != nil {
    71  			return ServerInfoValidationError{
    72  				field:  "CommandLineOptions",
    73  				reason: "embedded message failed validation",
    74  				cause:  err,
    75  			}
    76  		}
    77  	}
    78  
    79  	return nil
    80  }
    81  
    82  // ServerInfoValidationError is the validation error returned by
    83  // ServerInfo.Validate if the designated constraints aren't met.
    84  type ServerInfoValidationError struct {
    85  	field  string
    86  	reason string
    87  	cause  error
    88  	key    bool
    89  }
    90  
    91  // Field function returns field value.
    92  func (e ServerInfoValidationError) Field() string { return e.field }
    93  
    94  // Reason function returns reason value.
    95  func (e ServerInfoValidationError) Reason() string { return e.reason }
    96  
    97  // Cause function returns cause value.
    98  func (e ServerInfoValidationError) Cause() error { return e.cause }
    99  
   100  // Key function returns key value.
   101  func (e ServerInfoValidationError) Key() bool { return e.key }
   102  
   103  // ErrorName returns error name.
   104  func (e ServerInfoValidationError) ErrorName() string { return "ServerInfoValidationError" }
   105  
   106  // Error satisfies the builtin error interface
   107  func (e ServerInfoValidationError) Error() string {
   108  	cause := ""
   109  	if e.cause != nil {
   110  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   111  	}
   112  
   113  	key := ""
   114  	if e.key {
   115  		key = "key for "
   116  	}
   117  
   118  	return fmt.Sprintf(
   119  		"invalid %sServerInfo.%s: %s%s",
   120  		key,
   121  		e.field,
   122  		e.reason,
   123  		cause)
   124  }
   125  
   126  var _ error = ServerInfoValidationError{}
   127  
   128  var _ interface {
   129  	Field() string
   130  	Reason() string
   131  	Key() bool
   132  	Cause() error
   133  	ErrorName() string
   134  } = ServerInfoValidationError{}
   135  
   136  // Validate checks the field values on CommandLineOptions with the rules
   137  // defined in the proto definition for this message. If any rules are
   138  // violated, an error is returned.
   139  func (m *CommandLineOptions) Validate() error {
   140  	if m == nil {
   141  		return nil
   142  	}
   143  
   144  	// no validation rules for BaseId
   145  
   146  	// no validation rules for Concurrency
   147  
   148  	// no validation rules for ConfigPath
   149  
   150  	// no validation rules for ConfigYaml
   151  
   152  	// no validation rules for AllowUnknownStaticFields
   153  
   154  	// no validation rules for RejectUnknownDynamicFields
   155  
   156  	// no validation rules for AdminAddressPath
   157  
   158  	// no validation rules for LocalAddressIpVersion
   159  
   160  	// no validation rules for LogLevel
   161  
   162  	// no validation rules for ComponentLogLevel
   163  
   164  	// no validation rules for LogFormat
   165  
   166  	// no validation rules for LogFormatEscaped
   167  
   168  	// no validation rules for LogPath
   169  
   170  	// no validation rules for ServiceCluster
   171  
   172  	// no validation rules for ServiceNode
   173  
   174  	// no validation rules for ServiceZone
   175  
   176  	if v, ok := interface{}(m.GetFileFlushInterval()).(interface{ Validate() error }); ok {
   177  		if err := v.Validate(); err != nil {
   178  			return CommandLineOptionsValidationError{
   179  				field:  "FileFlushInterval",
   180  				reason: "embedded message failed validation",
   181  				cause:  err,
   182  			}
   183  		}
   184  	}
   185  
   186  	if v, ok := interface{}(m.GetDrainTime()).(interface{ Validate() error }); ok {
   187  		if err := v.Validate(); err != nil {
   188  			return CommandLineOptionsValidationError{
   189  				field:  "DrainTime",
   190  				reason: "embedded message failed validation",
   191  				cause:  err,
   192  			}
   193  		}
   194  	}
   195  
   196  	if v, ok := interface{}(m.GetParentShutdownTime()).(interface{ Validate() error }); ok {
   197  		if err := v.Validate(); err != nil {
   198  			return CommandLineOptionsValidationError{
   199  				field:  "ParentShutdownTime",
   200  				reason: "embedded message failed validation",
   201  				cause:  err,
   202  			}
   203  		}
   204  	}
   205  
   206  	// no validation rules for Mode
   207  
   208  	// no validation rules for MaxStats
   209  
   210  	// no validation rules for MaxObjNameLen
   211  
   212  	// no validation rules for DisableHotRestart
   213  
   214  	// no validation rules for EnableMutexTracing
   215  
   216  	// no validation rules for RestartEpoch
   217  
   218  	// no validation rules for CpusetThreads
   219  
   220  	return nil
   221  }
   222  
   223  // CommandLineOptionsValidationError is the validation error returned by
   224  // CommandLineOptions.Validate if the designated constraints aren't met.
   225  type CommandLineOptionsValidationError struct {
   226  	field  string
   227  	reason string
   228  	cause  error
   229  	key    bool
   230  }
   231  
   232  // Field function returns field value.
   233  func (e CommandLineOptionsValidationError) Field() string { return e.field }
   234  
   235  // Reason function returns reason value.
   236  func (e CommandLineOptionsValidationError) Reason() string { return e.reason }
   237  
   238  // Cause function returns cause value.
   239  func (e CommandLineOptionsValidationError) Cause() error { return e.cause }
   240  
   241  // Key function returns key value.
   242  func (e CommandLineOptionsValidationError) Key() bool { return e.key }
   243  
   244  // ErrorName returns error name.
   245  func (e CommandLineOptionsValidationError) ErrorName() string {
   246  	return "CommandLineOptionsValidationError"
   247  }
   248  
   249  // Error satisfies the builtin error interface
   250  func (e CommandLineOptionsValidationError) Error() string {
   251  	cause := ""
   252  	if e.cause != nil {
   253  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   254  	}
   255  
   256  	key := ""
   257  	if e.key {
   258  		key = "key for "
   259  	}
   260  
   261  	return fmt.Sprintf(
   262  		"invalid %sCommandLineOptions.%s: %s%s",
   263  		key,
   264  		e.field,
   265  		e.reason,
   266  		cause)
   267  }
   268  
   269  var _ error = CommandLineOptionsValidationError{}
   270  
   271  var _ interface {
   272  	Field() string
   273  	Reason() string
   274  	Key() bool
   275  	Cause() error
   276  	ErrorName() string
   277  } = CommandLineOptionsValidationError{}