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

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/admin/v3/server_info.proto
     3  
     4  package envoy_admin_v3
     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  	if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok {
    80  		if err := v.Validate(); err != nil {
    81  			return ServerInfoValidationError{
    82  				field:  "Node",
    83  				reason: "embedded message failed validation",
    84  				cause:  err,
    85  			}
    86  		}
    87  	}
    88  
    89  	return nil
    90  }
    91  
    92  // ServerInfoValidationError is the validation error returned by
    93  // ServerInfo.Validate if the designated constraints aren't met.
    94  type ServerInfoValidationError struct {
    95  	field  string
    96  	reason string
    97  	cause  error
    98  	key    bool
    99  }
   100  
   101  // Field function returns field value.
   102  func (e ServerInfoValidationError) Field() string { return e.field }
   103  
   104  // Reason function returns reason value.
   105  func (e ServerInfoValidationError) Reason() string { return e.reason }
   106  
   107  // Cause function returns cause value.
   108  func (e ServerInfoValidationError) Cause() error { return e.cause }
   109  
   110  // Key function returns key value.
   111  func (e ServerInfoValidationError) Key() bool { return e.key }
   112  
   113  // ErrorName returns error name.
   114  func (e ServerInfoValidationError) ErrorName() string { return "ServerInfoValidationError" }
   115  
   116  // Error satisfies the builtin error interface
   117  func (e ServerInfoValidationError) Error() string {
   118  	cause := ""
   119  	if e.cause != nil {
   120  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   121  	}
   122  
   123  	key := ""
   124  	if e.key {
   125  		key = "key for "
   126  	}
   127  
   128  	return fmt.Sprintf(
   129  		"invalid %sServerInfo.%s: %s%s",
   130  		key,
   131  		e.field,
   132  		e.reason,
   133  		cause)
   134  }
   135  
   136  var _ error = ServerInfoValidationError{}
   137  
   138  var _ interface {
   139  	Field() string
   140  	Reason() string
   141  	Key() bool
   142  	Cause() error
   143  	ErrorName() string
   144  } = ServerInfoValidationError{}
   145  
   146  // Validate checks the field values on CommandLineOptions with the rules
   147  // defined in the proto definition for this message. If any rules are
   148  // violated, an error is returned.
   149  func (m *CommandLineOptions) Validate() error {
   150  	if m == nil {
   151  		return nil
   152  	}
   153  
   154  	// no validation rules for BaseId
   155  
   156  	// no validation rules for UseDynamicBaseId
   157  
   158  	// no validation rules for BaseIdPath
   159  
   160  	// no validation rules for Concurrency
   161  
   162  	// no validation rules for ConfigPath
   163  
   164  	// no validation rules for ConfigYaml
   165  
   166  	// no validation rules for AllowUnknownStaticFields
   167  
   168  	// no validation rules for RejectUnknownDynamicFields
   169  
   170  	// no validation rules for IgnoreUnknownDynamicFields
   171  
   172  	// no validation rules for AdminAddressPath
   173  
   174  	// no validation rules for LocalAddressIpVersion
   175  
   176  	// no validation rules for LogLevel
   177  
   178  	// no validation rules for ComponentLogLevel
   179  
   180  	// no validation rules for LogFormat
   181  
   182  	// no validation rules for LogFormatEscaped
   183  
   184  	// no validation rules for LogPath
   185  
   186  	// no validation rules for ServiceCluster
   187  
   188  	// no validation rules for ServiceNode
   189  
   190  	// no validation rules for ServiceZone
   191  
   192  	if v, ok := interface{}(m.GetFileFlushInterval()).(interface{ Validate() error }); ok {
   193  		if err := v.Validate(); err != nil {
   194  			return CommandLineOptionsValidationError{
   195  				field:  "FileFlushInterval",
   196  				reason: "embedded message failed validation",
   197  				cause:  err,
   198  			}
   199  		}
   200  	}
   201  
   202  	if v, ok := interface{}(m.GetDrainTime()).(interface{ Validate() error }); ok {
   203  		if err := v.Validate(); err != nil {
   204  			return CommandLineOptionsValidationError{
   205  				field:  "DrainTime",
   206  				reason: "embedded message failed validation",
   207  				cause:  err,
   208  			}
   209  		}
   210  	}
   211  
   212  	// no validation rules for DrainStrategy
   213  
   214  	if v, ok := interface{}(m.GetParentShutdownTime()).(interface{ Validate() error }); ok {
   215  		if err := v.Validate(); err != nil {
   216  			return CommandLineOptionsValidationError{
   217  				field:  "ParentShutdownTime",
   218  				reason: "embedded message failed validation",
   219  				cause:  err,
   220  			}
   221  		}
   222  	}
   223  
   224  	// no validation rules for Mode
   225  
   226  	// no validation rules for DisableHotRestart
   227  
   228  	// no validation rules for EnableMutexTracing
   229  
   230  	// no validation rules for RestartEpoch
   231  
   232  	// no validation rules for CpusetThreads
   233  
   234  	// no validation rules for EnableFineGrainLogging
   235  
   236  	// no validation rules for SocketPath
   237  
   238  	// no validation rules for SocketMode
   239  
   240  	// no validation rules for EnableCoreDump
   241  
   242  	// no validation rules for HiddenEnvoyDeprecatedMaxStats
   243  
   244  	// no validation rules for HiddenEnvoyDeprecatedMaxObjNameLen
   245  
   246  	return nil
   247  }
   248  
   249  // CommandLineOptionsValidationError is the validation error returned by
   250  // CommandLineOptions.Validate if the designated constraints aren't met.
   251  type CommandLineOptionsValidationError struct {
   252  	field  string
   253  	reason string
   254  	cause  error
   255  	key    bool
   256  }
   257  
   258  // Field function returns field value.
   259  func (e CommandLineOptionsValidationError) Field() string { return e.field }
   260  
   261  // Reason function returns reason value.
   262  func (e CommandLineOptionsValidationError) Reason() string { return e.reason }
   263  
   264  // Cause function returns cause value.
   265  func (e CommandLineOptionsValidationError) Cause() error { return e.cause }
   266  
   267  // Key function returns key value.
   268  func (e CommandLineOptionsValidationError) Key() bool { return e.key }
   269  
   270  // ErrorName returns error name.
   271  func (e CommandLineOptionsValidationError) ErrorName() string {
   272  	return "CommandLineOptionsValidationError"
   273  }
   274  
   275  // Error satisfies the builtin error interface
   276  func (e CommandLineOptionsValidationError) Error() string {
   277  	cause := ""
   278  	if e.cause != nil {
   279  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   280  	}
   281  
   282  	key := ""
   283  	if e.key {
   284  		key = "key for "
   285  	}
   286  
   287  	return fmt.Sprintf(
   288  		"invalid %sCommandLineOptions.%s: %s%s",
   289  		key,
   290  		e.field,
   291  		e.reason,
   292  		cause)
   293  }
   294  
   295  var _ error = CommandLineOptionsValidationError{}
   296  
   297  var _ interface {
   298  	Field() string
   299  	Reason() string
   300  	Key() bool
   301  	Cause() error
   302  	ErrorName() string
   303  } = CommandLineOptionsValidationError{}