mirror of
https://github.com/siderolabs/talos.git
synced 2025-09-12 17:31:13 +02:00
Instead of patching in the machine config, provide a new interface in the platforms to supply platform-specific network configuration. Configuration will be cached in the `/state` across reboots, and configuration might be even updated in real time (e.g. on GCP). Network configuration on platform level can be overridden with user-supplied machine configuration. Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
64 lines
1.6 KiB
Go
64 lines
1.6 KiB
Go
// Code generated by "enumer -type=Operator -linecomment -text"; DO NOT EDIT.
|
|
|
|
//
|
|
package network
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
const _OperatorName = "dhcp4dhcp6vip"
|
|
|
|
var _OperatorIndex = [...]uint8{0, 5, 10, 13}
|
|
|
|
func (i Operator) String() string {
|
|
if i < 0 || i >= Operator(len(_OperatorIndex)-1) {
|
|
return fmt.Sprintf("Operator(%d)", i)
|
|
}
|
|
return _OperatorName[_OperatorIndex[i]:_OperatorIndex[i+1]]
|
|
}
|
|
|
|
var _OperatorValues = []Operator{0, 1, 2}
|
|
|
|
var _OperatorNameToValueMap = map[string]Operator{
|
|
_OperatorName[0:5]: 0,
|
|
_OperatorName[5:10]: 1,
|
|
_OperatorName[10:13]: 2,
|
|
}
|
|
|
|
// OperatorString retrieves an enum value from the enum constants string name.
|
|
// Throws an error if the param is not part of the enum.
|
|
func OperatorString(s string) (Operator, error) {
|
|
if val, ok := _OperatorNameToValueMap[s]; ok {
|
|
return val, nil
|
|
}
|
|
return 0, fmt.Errorf("%s does not belong to Operator values", s)
|
|
}
|
|
|
|
// OperatorValues returns all values of the enum
|
|
func OperatorValues() []Operator {
|
|
return _OperatorValues
|
|
}
|
|
|
|
// IsAOperator returns "true" if the value is listed in the enum definition. "false" otherwise
|
|
func (i Operator) IsAOperator() bool {
|
|
for _, v := range _OperatorValues {
|
|
if i == v {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// MarshalText implements the encoding.TextMarshaler interface for Operator
|
|
func (i Operator) MarshalText() ([]byte, error) {
|
|
return []byte(i.String()), nil
|
|
}
|
|
|
|
// UnmarshalText implements the encoding.TextUnmarshaler interface for Operator
|
|
func (i *Operator) UnmarshalText(text []byte) error {
|
|
var err error
|
|
*i, err = OperatorString(string(text))
|
|
return err
|
|
}
|