From a1ec1705bc5d1f7c66dbb8549af42fc3b4778400 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Fri, 9 Feb 2024 21:52:58 +0400 Subject: [PATCH] chore: update Go to 1.22.0 Finally! Signed-off-by: Andrey Smirnov --- Dockerfile | 3 +- Makefile | 16 +- go.mod | 2 +- go.work | 2 +- hack/cloud-image-uploader/go.mod | 2 +- hack/docgen/go.mod | 2 +- hack/gotagsrewrite/go.mod | 2 +- hack/module-sig-verify/go.mod | 2 +- hack/release.toml | 4 +- hack/structprotogen/go.mod | 2 +- pkg/imager/profile/diskformat_enumer.go | 50 ++- pkg/imager/profile/outformat_enumer.go | 50 ++- pkg/imager/profile/outputkind_enumer.go | 65 ++- pkg/imager/profile/sdbootenrollkeys_enumer.go | 45 +- pkg/machinery/constants/constants.go | 4 +- .../extensions/services/restartkind_enumer.go | 40 +- pkg/machinery/gendata/data/extras | 2 +- pkg/machinery/gendata/data/pkgs | 2 +- pkg/machinery/go.mod | 2 +- .../nethelpers/addressflag_enumer.go | 84 +++- pkg/machinery/nethelpers/adselect_enumer.go | 40 +- .../nethelpers/arpalltargets_enumer.go | 35 +- .../nethelpers/arpvalidate_enumer.go | 45 +- pkg/machinery/nethelpers/bondmode_enumer.go | 60 ++- .../nethelpers/bondxmithashpolicy_enumer.go | 50 ++- .../nethelpers/conntrackstate_enumer.go | 52 ++- .../nethelpers/defaultaction_enumer.go | 35 +- pkg/machinery/nethelpers/duplex_enumer.go | 44 +- .../nethelpers/failovermac_enumer.go | 40 +- pkg/machinery/nethelpers/family_enumer.go | 39 +- pkg/machinery/nethelpers/lacprate_enumer.go | 35 +- pkg/machinery/nethelpers/linkflag_enumer.go | 119 +++++- pkg/machinery/nethelpers/linktype_enumer.go | 404 ++++++++++++++---- .../nethelpers/matchoperator_enumer.go | 35 +- .../nethelpers/nftableschainhook_enumer.go | 50 ++- .../nftableschainpriority_enumer.go | 89 +++- .../nethelpers/nftablesverdict_enumer.go | 35 +- .../nethelpers/operationalstate_enumer.go | 60 ++- pkg/machinery/nethelpers/port_enumer.go | 72 +++- .../nethelpers/primaryreselect_enumer.go | 40 +- pkg/machinery/nethelpers/protocol_enumer.go | 55 ++- pkg/machinery/nethelpers/routeflag_enumer.go | 87 +++- .../nethelpers/routeprotocol_enumer.go | 151 +++++-- pkg/machinery/nethelpers/routetype_enumer.go | 85 +++- .../nethelpers/routingtable_enumer.go | 49 ++- pkg/machinery/nethelpers/scope_enumer.go | 57 ++- pkg/machinery/nethelpers/status_enumer.go | 45 +- .../nethelpers/vlanprotocol_enumer.go | 39 +- .../resources/network/configlayer_enumer.go | 50 ++- .../resources/network/operator_enumer.go | 40 +- .../resources/runtime/machinestage_enumer.go | 70 ++- website/content/v1.6/_index.md | 2 +- 52 files changed, 2106 insertions(+), 384 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9a97ac4857..6dc97531e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -127,7 +127,6 @@ FROM --platform=${BUILDPLATFORM} $TOOLS AS tools ENV PATH /toolchain/bin:/toolchain/go/bin ENV LD_LIBRARY_PATH /toolchain/lib ENV GOTOOLCHAIN local -ENV GOEXPERIMENT loopvar RUN ["/toolchain/bin/mkdir", "/bin", "/tmp"] RUN ["/toolchain/bin/ln", "-svf", "/toolchain/bin/bash", "/bin/sh"] RUN ["/toolchain/bin/ln", "-svf", "/toolchain/etc/ssl", "/etc/ssl"] @@ -147,7 +146,7 @@ ARG STRINGER_VERSION RUN --mount=type=cache,target=/.cache go install golang.org/x/tools/cmd/stringer@${STRINGER_VERSION} \ && mv /go/bin/stringer /toolchain/go/bin/stringer ARG ENUMER_VERSION -RUN --mount=type=cache,target=/.cache go install github.com/alvaroloes/enumer@${ENUMER_VERSION} \ +RUN --mount=type=cache,target=/.cache go install github.com/dmarkham/enumer@${ENUMER_VERSION} \ && mv /go/bin/enumer /toolchain/go/bin/enumer ARG DEEPCOPY_GEN_VERSION RUN --mount=type=cache,target=/.cache go install k8s.io/code-generator/cmd/deepcopy-gen@${DEEPCOPY_GEN_VERSION} \ diff --git a/Makefile b/Makefile index 0ff4278dc0..5b7e77fff7 100644 --- a/Makefile +++ b/Makefile @@ -15,11 +15,11 @@ NAME = Talos CLOUD_IMAGES_EXTRA_ARGS ?= "" ARTIFACTS := _out -TOOLS ?= ghcr.io/siderolabs/tools:v1.7.0-alpha.0-5-gf4b41d1 +TOOLS ?= ghcr.io/siderolabs/tools:v1.7.0-alpha.0-6-gb6b4d9e PKGS_PREFIX ?= ghcr.io/siderolabs -PKGS ?= v1.7.0-alpha.0-19-g96cc841 -EXTRAS ?= v1.7.0-alpha.0 +PKGS ?= v1.7.0-alpha.0-22-g0ec4cc3 +EXTRAS ?= v1.7.0-alpha.0-1-gc4934e1 PKG_FHS ?= $(PKGS_PREFIX)/fhs:$(PKGS) PKG_CA_CERTIFICATES ?= $(PKGS_PREFIX)/ca-certificates:$(PKGS) @@ -51,7 +51,7 @@ PKG_KERNEL ?= $(PKGS_PREFIX)/kernel:$(PKGS) PKG_TALOSCTL_CNI_BUNDLE_INSTALL ?= $(PKGS_PREFIX)/talosctl-cni-bundle-install:$(EXTRAS) # renovate: datasource=github-tags depName=golang/go -GO_VERSION ?= 1.21 +GO_VERSION ?= 1.22 # renovate: datasource=go depName=golang.org/x/tools GOIMPORTS_VERSION ?= v0.17.0 # renovate: datasource=go depName=mvdan.cc/gofumpt @@ -60,16 +60,16 @@ GOFUMPT_VERSION ?= v0.6.0 GOLANGCILINT_VERSION ?= v1.56.1 # renovate: datasource=go depName=golang.org/x/tools STRINGER_VERSION ?= v0.17.0 -# renovate: datasource=go depName=github.com/alvaroloes/enumer -ENUMER_VERSION ?= v1.1.2 +# renovate: datasource=go depName=github.com/dmarkham/enumer +ENUMER_VERSION ?= v1.5.9 # renovate: datasource=go depName=k8s.io/code-generator DEEPCOPY_GEN_VERSION ?= v0.29.1 # renovate: datasource=go depName=github.com/planetscale/vtprotobuf VTPROTOBUF_VERSION ?= v0.6.0 # renovate: datasource=go depName=github.com/siderolabs/deep-copy -DEEPCOPY_VERSION ?= v0.5.5 +DEEPCOPY_VERSION ?= v0.5.6 # renovate: datasource=go depName=github.com/siderolabs/importvet -IMPORTVET_VERSION ?= v0.1.0 +IMPORTVET_VERSION ?= v0.2.0 # renovate: datasource=npm depName=markdownlint-cli MARKDOWNLINTCLI_VERSION ?= 0.39.0 # renovate: datasource=npm depName=textlint diff --git a/go.mod b/go.mod index 0ec2475710..b2ebad9351 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/siderolabs/talos -go 1.21.6 +go 1.22.0 replace ( // forked coredns so we don't carry caddy and other stuff into the Talos diff --git a/go.work b/go.work index 6a9a1632db..e47abd5e8a 100644 --- a/go.work +++ b/go.work @@ -1,4 +1,4 @@ -go 1.21.6 +go 1.22.0 use ( . diff --git a/hack/cloud-image-uploader/go.mod b/hack/cloud-image-uploader/go.mod index 3fa23f2c05..215d2654b1 100644 --- a/hack/cloud-image-uploader/go.mod +++ b/hack/cloud-image-uploader/go.mod @@ -1,6 +1,6 @@ module github.com/siderolabs/cloud-image-uploader -go 1.21.6 +go 1.22.0 require ( github.com/Azure/azure-sdk-for-go v68.0.0+incompatible diff --git a/hack/docgen/go.mod b/hack/docgen/go.mod index 307d24c3ec..2f35a697c4 100644 --- a/hack/docgen/go.mod +++ b/hack/docgen/go.mod @@ -1,6 +1,6 @@ module github.com/siderolabs/talos-hack-docgen -go 1.21.6 +go 1.22.0 // forked go-yaml that introduces RawYAML interface, which can be used to populate YAML fields using bytes // which are then encoded as a valid YAML blocks with proper indentiation diff --git a/hack/gotagsrewrite/go.mod b/hack/gotagsrewrite/go.mod index 32cd83dd6c..defd2ad2d0 100644 --- a/hack/gotagsrewrite/go.mod +++ b/hack/gotagsrewrite/go.mod @@ -1,6 +1,6 @@ module github.com/siderolabs/gotagsrewrite -go 1.21.6 +go 1.22.0 require ( github.com/fatih/structtag v1.2.0 diff --git a/hack/module-sig-verify/go.mod b/hack/module-sig-verify/go.mod index 53791a4841..3723c80af6 100644 --- a/hack/module-sig-verify/go.mod +++ b/hack/module-sig-verify/go.mod @@ -1,5 +1,5 @@ module module-sig-verify -go 1.21.6 +go 1.22.0 require go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 diff --git a/hack/release.toml b/hack/release.toml index e919da02ae..500aae6184 100644 --- a/hack/release.toml +++ b/hack/release.toml @@ -17,14 +17,14 @@ preface = """\ [notes.updates] title = "Component Updates" description = """\ -Linux: 6.6.14 +Linux: 6.6.16 etcd: 3.5.11 Kubernetes: 1.29.1 containerd: 1.7.13 runc: 1.1.12 Flannel: 0.24.1 -Talos is built with Go 1.21.6. +Talos is built with Go 1.22.0. """ [notes.device_selectors] diff --git a/hack/structprotogen/go.mod b/hack/structprotogen/go.mod index bc9762a7b1..3907cea720 100644 --- a/hack/structprotogen/go.mod +++ b/hack/structprotogen/go.mod @@ -1,6 +1,6 @@ module github.com/siderolabs/structprotogen -go 1.21.6 +go 1.22.0 require ( github.com/fatih/structtag v1.2.0 diff --git a/pkg/imager/profile/diskformat_enumer.go b/pkg/imager/profile/diskformat_enumer.go index b01a25edca..f2312847c1 100644 --- a/pkg/imager/profile/diskformat_enumer.go +++ b/pkg/imager/profile/diskformat_enumer.go @@ -4,12 +4,15 @@ package profile import ( "fmt" + "strings" ) const _DiskFormatName = "unknownrawqcow2vhdova" var _DiskFormatIndex = [...]uint8{0, 7, 10, 15, 18, 21} +const _DiskFormatLowerName = "unknownrawqcow2vhdova" + func (i DiskFormat) String() string { if i < 0 || i >= DiskFormat(len(_DiskFormatIndex)-1) { return fmt.Sprintf("DiskFormat(%d)", i) @@ -17,14 +20,38 @@ func (i DiskFormat) String() string { return _DiskFormatName[_DiskFormatIndex[i]:_DiskFormatIndex[i+1]] } -var _DiskFormatValues = []DiskFormat{0, 1, 2, 3, 4} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _DiskFormatNoOp() { + var x [1]struct{} + _ = x[DiskFormatUnknown-(0)] + _ = x[DiskFormatRaw-(1)] + _ = x[DiskFormatQCOW2-(2)] + _ = x[DiskFormatVPC-(3)] + _ = x[DiskFormatOVA-(4)] +} + +var _DiskFormatValues = []DiskFormat{DiskFormatUnknown, DiskFormatRaw, DiskFormatQCOW2, DiskFormatVPC, DiskFormatOVA} var _DiskFormatNameToValueMap = map[string]DiskFormat{ - _DiskFormatName[0:7]: 0, - _DiskFormatName[7:10]: 1, - _DiskFormatName[10:15]: 2, - _DiskFormatName[15:18]: 3, - _DiskFormatName[18:21]: 4, + _DiskFormatName[0:7]: DiskFormatUnknown, + _DiskFormatLowerName[0:7]: DiskFormatUnknown, + _DiskFormatName[7:10]: DiskFormatRaw, + _DiskFormatLowerName[7:10]: DiskFormatRaw, + _DiskFormatName[10:15]: DiskFormatQCOW2, + _DiskFormatLowerName[10:15]: DiskFormatQCOW2, + _DiskFormatName[15:18]: DiskFormatVPC, + _DiskFormatLowerName[15:18]: DiskFormatVPC, + _DiskFormatName[18:21]: DiskFormatOVA, + _DiskFormatLowerName[18:21]: DiskFormatOVA, +} + +var _DiskFormatNames = []string{ + _DiskFormatName[0:7], + _DiskFormatName[7:10], + _DiskFormatName[10:15], + _DiskFormatName[15:18], + _DiskFormatName[18:21], } // DiskFormatString retrieves an enum value from the enum constants string name. @@ -33,6 +60,10 @@ func DiskFormatString(s string) (DiskFormat, error) { if val, ok := _DiskFormatNameToValueMap[s]; ok { return val, nil } + + if val, ok := _DiskFormatNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to DiskFormat values", s) } @@ -41,6 +72,13 @@ func DiskFormatValues() []DiskFormat { return _DiskFormatValues } +// DiskFormatStrings returns a slice of all String values of the enum +func DiskFormatStrings() []string { + strs := make([]string, len(_DiskFormatNames)) + copy(strs, _DiskFormatNames) + return strs +} + // IsADiskFormat returns "true" if the value is listed in the enum definition. "false" otherwise func (i DiskFormat) IsADiskFormat() bool { for _, v := range _DiskFormatValues { diff --git a/pkg/imager/profile/outformat_enumer.go b/pkg/imager/profile/outformat_enumer.go index 025fb89ed9..f062e9d03e 100644 --- a/pkg/imager/profile/outformat_enumer.go +++ b/pkg/imager/profile/outformat_enumer.go @@ -4,12 +4,15 @@ package profile import ( "fmt" + "strings" ) const _OutFormatName = "unknownraw.tar.gz.xz.gz" var _OutFormatIndex = [...]uint8{0, 7, 10, 17, 20, 23} +const _OutFormatLowerName = "unknownraw.tar.gz.xz.gz" + func (i OutFormat) String() string { if i < 0 || i >= OutFormat(len(_OutFormatIndex)-1) { return fmt.Sprintf("OutFormat(%d)", i) @@ -17,14 +20,38 @@ func (i OutFormat) String() string { return _OutFormatName[_OutFormatIndex[i]:_OutFormatIndex[i+1]] } -var _OutFormatValues = []OutFormat{0, 1, 2, 3, 4} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _OutFormatNoOp() { + var x [1]struct{} + _ = x[OutFormatUnknown-(0)] + _ = x[OutFormatRaw-(1)] + _ = x[OutFormatTar-(2)] + _ = x[OutFormatXZ-(3)] + _ = x[OutFormatGZ-(4)] +} + +var _OutFormatValues = []OutFormat{OutFormatUnknown, OutFormatRaw, OutFormatTar, OutFormatXZ, OutFormatGZ} var _OutFormatNameToValueMap = map[string]OutFormat{ - _OutFormatName[0:7]: 0, - _OutFormatName[7:10]: 1, - _OutFormatName[10:17]: 2, - _OutFormatName[17:20]: 3, - _OutFormatName[20:23]: 4, + _OutFormatName[0:7]: OutFormatUnknown, + _OutFormatLowerName[0:7]: OutFormatUnknown, + _OutFormatName[7:10]: OutFormatRaw, + _OutFormatLowerName[7:10]: OutFormatRaw, + _OutFormatName[10:17]: OutFormatTar, + _OutFormatLowerName[10:17]: OutFormatTar, + _OutFormatName[17:20]: OutFormatXZ, + _OutFormatLowerName[17:20]: OutFormatXZ, + _OutFormatName[20:23]: OutFormatGZ, + _OutFormatLowerName[20:23]: OutFormatGZ, +} + +var _OutFormatNames = []string{ + _OutFormatName[0:7], + _OutFormatName[7:10], + _OutFormatName[10:17], + _OutFormatName[17:20], + _OutFormatName[20:23], } // OutFormatString retrieves an enum value from the enum constants string name. @@ -33,6 +60,10 @@ func OutFormatString(s string) (OutFormat, error) { if val, ok := _OutFormatNameToValueMap[s]; ok { return val, nil } + + if val, ok := _OutFormatNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to OutFormat values", s) } @@ -41,6 +72,13 @@ func OutFormatValues() []OutFormat { return _OutFormatValues } +// OutFormatStrings returns a slice of all String values of the enum +func OutFormatStrings() []string { + strs := make([]string, len(_OutFormatNames)) + copy(strs, _OutFormatNames) + return strs +} + // IsAOutFormat returns "true" if the value is listed in the enum definition. "false" otherwise func (i OutFormat) IsAOutFormat() bool { for _, v := range _OutFormatValues { diff --git a/pkg/imager/profile/outputkind_enumer.go b/pkg/imager/profile/outputkind_enumer.go index a7e5fb1a6d..78ca6339a3 100644 --- a/pkg/imager/profile/outputkind_enumer.go +++ b/pkg/imager/profile/outputkind_enumer.go @@ -4,12 +4,15 @@ package profile import ( "fmt" + "strings" ) const _OutputKindName = "unknownisoimageinstallerkernelinitramfsukicmdline" var _OutputKindIndex = [...]uint8{0, 7, 10, 15, 24, 30, 39, 42, 49} +const _OutputKindLowerName = "unknownisoimageinstallerkernelinitramfsukicmdline" + func (i OutputKind) String() string { if i < 0 || i >= OutputKind(len(_OutputKindIndex)-1) { return fmt.Sprintf("OutputKind(%d)", i) @@ -17,17 +20,50 @@ func (i OutputKind) String() string { return _OutputKindName[_OutputKindIndex[i]:_OutputKindIndex[i+1]] } -var _OutputKindValues = []OutputKind{0, 1, 2, 3, 4, 5, 6, 7} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _OutputKindNoOp() { + var x [1]struct{} + _ = x[OutKindUnknown-(0)] + _ = x[OutKindISO-(1)] + _ = x[OutKindImage-(2)] + _ = x[OutKindInstaller-(3)] + _ = x[OutKindKernel-(4)] + _ = x[OutKindInitramfs-(5)] + _ = x[OutKindUKI-(6)] + _ = x[OutKindCmdline-(7)] +} + +var _OutputKindValues = []OutputKind{OutKindUnknown, OutKindISO, OutKindImage, OutKindInstaller, OutKindKernel, OutKindInitramfs, OutKindUKI, OutKindCmdline} var _OutputKindNameToValueMap = map[string]OutputKind{ - _OutputKindName[0:7]: 0, - _OutputKindName[7:10]: 1, - _OutputKindName[10:15]: 2, - _OutputKindName[15:24]: 3, - _OutputKindName[24:30]: 4, - _OutputKindName[30:39]: 5, - _OutputKindName[39:42]: 6, - _OutputKindName[42:49]: 7, + _OutputKindName[0:7]: OutKindUnknown, + _OutputKindLowerName[0:7]: OutKindUnknown, + _OutputKindName[7:10]: OutKindISO, + _OutputKindLowerName[7:10]: OutKindISO, + _OutputKindName[10:15]: OutKindImage, + _OutputKindLowerName[10:15]: OutKindImage, + _OutputKindName[15:24]: OutKindInstaller, + _OutputKindLowerName[15:24]: OutKindInstaller, + _OutputKindName[24:30]: OutKindKernel, + _OutputKindLowerName[24:30]: OutKindKernel, + _OutputKindName[30:39]: OutKindInitramfs, + _OutputKindLowerName[30:39]: OutKindInitramfs, + _OutputKindName[39:42]: OutKindUKI, + _OutputKindLowerName[39:42]: OutKindUKI, + _OutputKindName[42:49]: OutKindCmdline, + _OutputKindLowerName[42:49]: OutKindCmdline, +} + +var _OutputKindNames = []string{ + _OutputKindName[0:7], + _OutputKindName[7:10], + _OutputKindName[10:15], + _OutputKindName[15:24], + _OutputKindName[24:30], + _OutputKindName[30:39], + _OutputKindName[39:42], + _OutputKindName[42:49], } // OutputKindString retrieves an enum value from the enum constants string name. @@ -36,6 +72,10 @@ func OutputKindString(s string) (OutputKind, error) { if val, ok := _OutputKindNameToValueMap[s]; ok { return val, nil } + + if val, ok := _OutputKindNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to OutputKind values", s) } @@ -44,6 +84,13 @@ func OutputKindValues() []OutputKind { return _OutputKindValues } +// OutputKindStrings returns a slice of all String values of the enum +func OutputKindStrings() []string { + strs := make([]string, len(_OutputKindNames)) + copy(strs, _OutputKindNames) + return strs +} + // IsAOutputKind returns "true" if the value is listed in the enum definition. "false" otherwise func (i OutputKind) IsAOutputKind() bool { for _, v := range _OutputKindValues { diff --git a/pkg/imager/profile/sdbootenrollkeys_enumer.go b/pkg/imager/profile/sdbootenrollkeys_enumer.go index c120aba902..b0bc274d33 100644 --- a/pkg/imager/profile/sdbootenrollkeys_enumer.go +++ b/pkg/imager/profile/sdbootenrollkeys_enumer.go @@ -4,12 +4,15 @@ package profile import ( "fmt" + "strings" ) const _SDBootEnrollKeysName = "if-safemanualforceoff" var _SDBootEnrollKeysIndex = [...]uint8{0, 7, 13, 18, 21} +const _SDBootEnrollKeysLowerName = "if-safemanualforceoff" + func (i SDBootEnrollKeys) String() string { if i < 0 || i >= SDBootEnrollKeys(len(_SDBootEnrollKeysIndex)-1) { return fmt.Sprintf("SDBootEnrollKeys(%d)", i) @@ -17,13 +20,34 @@ func (i SDBootEnrollKeys) String() string { return _SDBootEnrollKeysName[_SDBootEnrollKeysIndex[i]:_SDBootEnrollKeysIndex[i+1]] } -var _SDBootEnrollKeysValues = []SDBootEnrollKeys{0, 1, 2, 3} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _SDBootEnrollKeysNoOp() { + var x [1]struct{} + _ = x[SDBootEnrollKeysIfSafe-(0)] + _ = x[SDBootEnrollKeysManual-(1)] + _ = x[SDBootEnrollKeysForce-(2)] + _ = x[SDBootEnrollKeysOff-(3)] +} + +var _SDBootEnrollKeysValues = []SDBootEnrollKeys{SDBootEnrollKeysIfSafe, SDBootEnrollKeysManual, SDBootEnrollKeysForce, SDBootEnrollKeysOff} var _SDBootEnrollKeysNameToValueMap = map[string]SDBootEnrollKeys{ - _SDBootEnrollKeysName[0:7]: 0, - _SDBootEnrollKeysName[7:13]: 1, - _SDBootEnrollKeysName[13:18]: 2, - _SDBootEnrollKeysName[18:21]: 3, + _SDBootEnrollKeysName[0:7]: SDBootEnrollKeysIfSafe, + _SDBootEnrollKeysLowerName[0:7]: SDBootEnrollKeysIfSafe, + _SDBootEnrollKeysName[7:13]: SDBootEnrollKeysManual, + _SDBootEnrollKeysLowerName[7:13]: SDBootEnrollKeysManual, + _SDBootEnrollKeysName[13:18]: SDBootEnrollKeysForce, + _SDBootEnrollKeysLowerName[13:18]: SDBootEnrollKeysForce, + _SDBootEnrollKeysName[18:21]: SDBootEnrollKeysOff, + _SDBootEnrollKeysLowerName[18:21]: SDBootEnrollKeysOff, +} + +var _SDBootEnrollKeysNames = []string{ + _SDBootEnrollKeysName[0:7], + _SDBootEnrollKeysName[7:13], + _SDBootEnrollKeysName[13:18], + _SDBootEnrollKeysName[18:21], } // SDBootEnrollKeysString retrieves an enum value from the enum constants string name. @@ -32,6 +56,10 @@ func SDBootEnrollKeysString(s string) (SDBootEnrollKeys, error) { if val, ok := _SDBootEnrollKeysNameToValueMap[s]; ok { return val, nil } + + if val, ok := _SDBootEnrollKeysNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to SDBootEnrollKeys values", s) } @@ -40,6 +68,13 @@ func SDBootEnrollKeysValues() []SDBootEnrollKeys { return _SDBootEnrollKeysValues } +// SDBootEnrollKeysStrings returns a slice of all String values of the enum +func SDBootEnrollKeysStrings() []string { + strs := make([]string, len(_SDBootEnrollKeysNames)) + copy(strs, _SDBootEnrollKeysNames) + return strs +} + // IsASDBootEnrollKeys returns "true" if the value is listed in the enum definition. "false" otherwise func (i SDBootEnrollKeys) IsASDBootEnrollKeys() bool { for _, v := range _SDBootEnrollKeysValues { diff --git a/pkg/machinery/constants/constants.go b/pkg/machinery/constants/constants.go index 15d2cc153b..aeb1308359 100644 --- a/pkg/machinery/constants/constants.go +++ b/pkg/machinery/constants/constants.go @@ -16,7 +16,7 @@ import ( const ( // DefaultKernelVersion is the default Linux kernel version. - DefaultKernelVersion = "6.6.14-talos" + DefaultKernelVersion = "6.6.16-talos" // KernelModulesPath is the default path to the kernel modules without the kernel version. KernelModulesPath = "/lib/modules" @@ -868,7 +868,7 @@ const ( DBusClientSocketPath = "/run/dbus/system_bus_socket" // GoVersion is the version of Go compiler this release was built with. - GoVersion = "go1.21.6 X:loopvar" + GoVersion = "go1.22.0" // KubernetesTalosAPIServiceName is the name of the Kubernetes service to access Talos API. KubernetesTalosAPIServiceName = "talos" diff --git a/pkg/machinery/extensions/services/restartkind_enumer.go b/pkg/machinery/extensions/services/restartkind_enumer.go index 5ccb0b17fb..6e9195e4fe 100644 --- a/pkg/machinery/extensions/services/restartkind_enumer.go +++ b/pkg/machinery/extensions/services/restartkind_enumer.go @@ -4,12 +4,15 @@ package services import ( "fmt" + "strings" ) const _RestartKindName = "alwaysneveruntilSuccess" var _RestartKindIndex = [...]uint8{0, 6, 11, 23} +const _RestartKindLowerName = "alwaysneveruntilsuccess" + func (i RestartKind) String() string { i -= 1 if i < 0 || i >= RestartKind(len(_RestartKindIndex)-1) { @@ -18,12 +21,30 @@ func (i RestartKind) String() string { return _RestartKindName[_RestartKindIndex[i]:_RestartKindIndex[i+1]] } -var _RestartKindValues = []RestartKind{1, 2, 3} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _RestartKindNoOp() { + var x [1]struct{} + _ = x[RestartAlways-(1)] + _ = x[RestartNever-(2)] + _ = x[RestartUntilSuccess-(3)] +} + +var _RestartKindValues = []RestartKind{RestartAlways, RestartNever, RestartUntilSuccess} var _RestartKindNameToValueMap = map[string]RestartKind{ - _RestartKindName[0:6]: 1, - _RestartKindName[6:11]: 2, - _RestartKindName[11:23]: 3, + _RestartKindName[0:6]: RestartAlways, + _RestartKindLowerName[0:6]: RestartAlways, + _RestartKindName[6:11]: RestartNever, + _RestartKindLowerName[6:11]: RestartNever, + _RestartKindName[11:23]: RestartUntilSuccess, + _RestartKindLowerName[11:23]: RestartUntilSuccess, +} + +var _RestartKindNames = []string{ + _RestartKindName[0:6], + _RestartKindName[6:11], + _RestartKindName[11:23], } // RestartKindString retrieves an enum value from the enum constants string name. @@ -32,6 +53,10 @@ func RestartKindString(s string) (RestartKind, error) { if val, ok := _RestartKindNameToValueMap[s]; ok { return val, nil } + + if val, ok := _RestartKindNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to RestartKind values", s) } @@ -40,6 +65,13 @@ func RestartKindValues() []RestartKind { return _RestartKindValues } +// RestartKindStrings returns a slice of all String values of the enum +func RestartKindStrings() []string { + strs := make([]string, len(_RestartKindNames)) + copy(strs, _RestartKindNames) + return strs +} + // IsARestartKind returns "true" if the value is listed in the enum definition. "false" otherwise func (i RestartKind) IsARestartKind() bool { for _, v := range _RestartKindValues { diff --git a/pkg/machinery/gendata/data/extras b/pkg/machinery/gendata/data/extras index ea4c9a12e7..dfda672bae 100644 --- a/pkg/machinery/gendata/data/extras +++ b/pkg/machinery/gendata/data/extras @@ -1 +1 @@ -v1.7.0-alpha.0 \ No newline at end of file +v1.7.0-alpha.0-1-gc4934e1 \ No newline at end of file diff --git a/pkg/machinery/gendata/data/pkgs b/pkg/machinery/gendata/data/pkgs index 47025e0596..9513446227 100644 --- a/pkg/machinery/gendata/data/pkgs +++ b/pkg/machinery/gendata/data/pkgs @@ -1 +1 @@ -v1.7.0-alpha.0-19-g96cc841 \ No newline at end of file +v1.7.0-alpha.0-22-g0ec4cc3 \ No newline at end of file diff --git a/pkg/machinery/go.mod b/pkg/machinery/go.mod index 59ed6bcc17..9542ec140b 100644 --- a/pkg/machinery/go.mod +++ b/pkg/machinery/go.mod @@ -1,6 +1,6 @@ module github.com/siderolabs/talos/pkg/machinery -go 1.21.6 +go 1.22.0 // forked go-yaml that introduces RawYAML interface, which can be used to populate YAML fields using bytes // which are then encoded as a valid YAML blocks with proper indentiation diff --git a/pkg/machinery/nethelpers/addressflag_enumer.go b/pkg/machinery/nethelpers/addressflag_enumer.go index 74f6ab8704..6694569b2d 100644 --- a/pkg/machinery/nethelpers/addressflag_enumer.go +++ b/pkg/machinery/nethelpers/addressflag_enumer.go @@ -4,9 +4,11 @@ package nethelpers import ( "fmt" + "strings" ) const _AddressFlagName = "temporarynodadoptimisticdadfailedhomeaddressdeprecatedtentativepermanentmngmtmpaddrnoprefixroutemcautojoinstableprivacy" +const _AddressFlagLowerName = "temporarynodadoptimisticdadfailedhomeaddressdeprecatedtentativepermanentmngmtmpaddrnoprefixroutemcautojoinstableprivacy" var _AddressFlagMap = map[AddressFlag]string{ 1: _AddressFlagName[0:9], @@ -30,21 +32,66 @@ func (i AddressFlag) String() string { return fmt.Sprintf("AddressFlag(%d)", i) } -var _AddressFlagValues = []AddressFlag{1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _AddressFlagNoOp() { + var x [1]struct{} + _ = x[AddressTemporary-(1)] + _ = x[AddressNoDAD-(2)] + _ = x[AddressOptimistic-(4)] + _ = x[AddressDADFailed-(8)] + _ = x[AddressHome-(16)] + _ = x[AddressDeprecated-(32)] + _ = x[AddressTentative-(64)] + _ = x[AddressPermanent-(128)] + _ = x[AddressManagementTemp-(256)] + _ = x[AddressNoPrefixRoute-(512)] + _ = x[AddressMCAutoJoin-(1024)] + _ = x[AddressStablePrivacy-(2048)] +} + +var _AddressFlagValues = []AddressFlag{AddressTemporary, AddressNoDAD, AddressOptimistic, AddressDADFailed, AddressHome, AddressDeprecated, AddressTentative, AddressPermanent, AddressManagementTemp, AddressNoPrefixRoute, AddressMCAutoJoin, AddressStablePrivacy} var _AddressFlagNameToValueMap = map[string]AddressFlag{ - _AddressFlagName[0:9]: 1, - _AddressFlagName[9:14]: 2, - _AddressFlagName[14:24]: 4, - _AddressFlagName[24:33]: 8, - _AddressFlagName[33:44]: 16, - _AddressFlagName[44:54]: 32, - _AddressFlagName[54:63]: 64, - _AddressFlagName[63:72]: 128, - _AddressFlagName[72:83]: 256, - _AddressFlagName[83:96]: 512, - _AddressFlagName[96:106]: 1024, - _AddressFlagName[106:119]: 2048, + _AddressFlagName[0:9]: AddressTemporary, + _AddressFlagLowerName[0:9]: AddressTemporary, + _AddressFlagName[9:14]: AddressNoDAD, + _AddressFlagLowerName[9:14]: AddressNoDAD, + _AddressFlagName[14:24]: AddressOptimistic, + _AddressFlagLowerName[14:24]: AddressOptimistic, + _AddressFlagName[24:33]: AddressDADFailed, + _AddressFlagLowerName[24:33]: AddressDADFailed, + _AddressFlagName[33:44]: AddressHome, + _AddressFlagLowerName[33:44]: AddressHome, + _AddressFlagName[44:54]: AddressDeprecated, + _AddressFlagLowerName[44:54]: AddressDeprecated, + _AddressFlagName[54:63]: AddressTentative, + _AddressFlagLowerName[54:63]: AddressTentative, + _AddressFlagName[63:72]: AddressPermanent, + _AddressFlagLowerName[63:72]: AddressPermanent, + _AddressFlagName[72:83]: AddressManagementTemp, + _AddressFlagLowerName[72:83]: AddressManagementTemp, + _AddressFlagName[83:96]: AddressNoPrefixRoute, + _AddressFlagLowerName[83:96]: AddressNoPrefixRoute, + _AddressFlagName[96:106]: AddressMCAutoJoin, + _AddressFlagLowerName[96:106]: AddressMCAutoJoin, + _AddressFlagName[106:119]: AddressStablePrivacy, + _AddressFlagLowerName[106:119]: AddressStablePrivacy, +} + +var _AddressFlagNames = []string{ + _AddressFlagName[0:9], + _AddressFlagName[9:14], + _AddressFlagName[14:24], + _AddressFlagName[24:33], + _AddressFlagName[33:44], + _AddressFlagName[44:54], + _AddressFlagName[54:63], + _AddressFlagName[63:72], + _AddressFlagName[72:83], + _AddressFlagName[83:96], + _AddressFlagName[96:106], + _AddressFlagName[106:119], } // AddressFlagString retrieves an enum value from the enum constants string name. @@ -53,6 +100,10 @@ func AddressFlagString(s string) (AddressFlag, error) { if val, ok := _AddressFlagNameToValueMap[s]; ok { return val, nil } + + if val, ok := _AddressFlagNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to AddressFlag values", s) } @@ -61,6 +112,13 @@ func AddressFlagValues() []AddressFlag { return _AddressFlagValues } +// AddressFlagStrings returns a slice of all String values of the enum +func AddressFlagStrings() []string { + strs := make([]string, len(_AddressFlagNames)) + copy(strs, _AddressFlagNames) + return strs +} + // IsAAddressFlag returns "true" if the value is listed in the enum definition. "false" otherwise func (i AddressFlag) IsAAddressFlag() bool { _, ok := _AddressFlagMap[i] diff --git a/pkg/machinery/nethelpers/adselect_enumer.go b/pkg/machinery/nethelpers/adselect_enumer.go index 0145ec89ef..4f15597f5c 100644 --- a/pkg/machinery/nethelpers/adselect_enumer.go +++ b/pkg/machinery/nethelpers/adselect_enumer.go @@ -4,12 +4,15 @@ package nethelpers import ( "fmt" + "strings" ) const _ADSelectName = "stablebandwidthcount" var _ADSelectIndex = [...]uint8{0, 6, 15, 20} +const _ADSelectLowerName = "stablebandwidthcount" + func (i ADSelect) String() string { if i >= ADSelect(len(_ADSelectIndex)-1) { return fmt.Sprintf("ADSelect(%d)", i) @@ -17,12 +20,30 @@ func (i ADSelect) String() string { return _ADSelectName[_ADSelectIndex[i]:_ADSelectIndex[i+1]] } -var _ADSelectValues = []ADSelect{0, 1, 2} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _ADSelectNoOp() { + var x [1]struct{} + _ = x[ADSelectStable-(0)] + _ = x[ADSelectBandwidth-(1)] + _ = x[ADSelectCount-(2)] +} + +var _ADSelectValues = []ADSelect{ADSelectStable, ADSelectBandwidth, ADSelectCount} var _ADSelectNameToValueMap = map[string]ADSelect{ - _ADSelectName[0:6]: 0, - _ADSelectName[6:15]: 1, - _ADSelectName[15:20]: 2, + _ADSelectName[0:6]: ADSelectStable, + _ADSelectLowerName[0:6]: ADSelectStable, + _ADSelectName[6:15]: ADSelectBandwidth, + _ADSelectLowerName[6:15]: ADSelectBandwidth, + _ADSelectName[15:20]: ADSelectCount, + _ADSelectLowerName[15:20]: ADSelectCount, +} + +var _ADSelectNames = []string{ + _ADSelectName[0:6], + _ADSelectName[6:15], + _ADSelectName[15:20], } // ADSelectString retrieves an enum value from the enum constants string name. @@ -31,6 +52,10 @@ func ADSelectString(s string) (ADSelect, error) { if val, ok := _ADSelectNameToValueMap[s]; ok { return val, nil } + + if val, ok := _ADSelectNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to ADSelect values", s) } @@ -39,6 +64,13 @@ func ADSelectValues() []ADSelect { return _ADSelectValues } +// ADSelectStrings returns a slice of all String values of the enum +func ADSelectStrings() []string { + strs := make([]string, len(_ADSelectNames)) + copy(strs, _ADSelectNames) + return strs +} + // IsAADSelect returns "true" if the value is listed in the enum definition. "false" otherwise func (i ADSelect) IsAADSelect() bool { for _, v := range _ADSelectValues { diff --git a/pkg/machinery/nethelpers/arpalltargets_enumer.go b/pkg/machinery/nethelpers/arpalltargets_enumer.go index 6dfdec70ce..5036cb7635 100644 --- a/pkg/machinery/nethelpers/arpalltargets_enumer.go +++ b/pkg/machinery/nethelpers/arpalltargets_enumer.go @@ -4,12 +4,15 @@ package nethelpers import ( "fmt" + "strings" ) const _ARPAllTargetsName = "anyall" var _ARPAllTargetsIndex = [...]uint8{0, 3, 6} +const _ARPAllTargetsLowerName = "anyall" + func (i ARPAllTargets) String() string { if i >= ARPAllTargets(len(_ARPAllTargetsIndex)-1) { return fmt.Sprintf("ARPAllTargets(%d)", i) @@ -17,11 +20,26 @@ func (i ARPAllTargets) String() string { return _ARPAllTargetsName[_ARPAllTargetsIndex[i]:_ARPAllTargetsIndex[i+1]] } -var _ARPAllTargetsValues = []ARPAllTargets{0, 1} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _ARPAllTargetsNoOp() { + var x [1]struct{} + _ = x[ARPAllTargetsAny-(0)] + _ = x[ARPAllTargetsAll-(1)] +} + +var _ARPAllTargetsValues = []ARPAllTargets{ARPAllTargetsAny, ARPAllTargetsAll} var _ARPAllTargetsNameToValueMap = map[string]ARPAllTargets{ - _ARPAllTargetsName[0:3]: 0, - _ARPAllTargetsName[3:6]: 1, + _ARPAllTargetsName[0:3]: ARPAllTargetsAny, + _ARPAllTargetsLowerName[0:3]: ARPAllTargetsAny, + _ARPAllTargetsName[3:6]: ARPAllTargetsAll, + _ARPAllTargetsLowerName[3:6]: ARPAllTargetsAll, +} + +var _ARPAllTargetsNames = []string{ + _ARPAllTargetsName[0:3], + _ARPAllTargetsName[3:6], } // ARPAllTargetsString retrieves an enum value from the enum constants string name. @@ -30,6 +48,10 @@ func ARPAllTargetsString(s string) (ARPAllTargets, error) { if val, ok := _ARPAllTargetsNameToValueMap[s]; ok { return val, nil } + + if val, ok := _ARPAllTargetsNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to ARPAllTargets values", s) } @@ -38,6 +60,13 @@ func ARPAllTargetsValues() []ARPAllTargets { return _ARPAllTargetsValues } +// ARPAllTargetsStrings returns a slice of all String values of the enum +func ARPAllTargetsStrings() []string { + strs := make([]string, len(_ARPAllTargetsNames)) + copy(strs, _ARPAllTargetsNames) + return strs +} + // IsAARPAllTargets returns "true" if the value is listed in the enum definition. "false" otherwise func (i ARPAllTargets) IsAARPAllTargets() bool { for _, v := range _ARPAllTargetsValues { diff --git a/pkg/machinery/nethelpers/arpvalidate_enumer.go b/pkg/machinery/nethelpers/arpvalidate_enumer.go index 9b50bda6ed..dfc2fd813f 100644 --- a/pkg/machinery/nethelpers/arpvalidate_enumer.go +++ b/pkg/machinery/nethelpers/arpvalidate_enumer.go @@ -4,12 +4,15 @@ package nethelpers import ( "fmt" + "strings" ) const _ARPValidateName = "noneactivebackupall" var _ARPValidateIndex = [...]uint8{0, 4, 10, 16, 19} +const _ARPValidateLowerName = "noneactivebackupall" + func (i ARPValidate) String() string { if i >= ARPValidate(len(_ARPValidateIndex)-1) { return fmt.Sprintf("ARPValidate(%d)", i) @@ -17,13 +20,34 @@ func (i ARPValidate) String() string { return _ARPValidateName[_ARPValidateIndex[i]:_ARPValidateIndex[i+1]] } -var _ARPValidateValues = []ARPValidate{0, 1, 2, 3} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _ARPValidateNoOp() { + var x [1]struct{} + _ = x[ARPValidateNone-(0)] + _ = x[ARPValidateActive-(1)] + _ = x[ARPValidateBackup-(2)] + _ = x[ARPValidateAll-(3)] +} + +var _ARPValidateValues = []ARPValidate{ARPValidateNone, ARPValidateActive, ARPValidateBackup, ARPValidateAll} var _ARPValidateNameToValueMap = map[string]ARPValidate{ - _ARPValidateName[0:4]: 0, - _ARPValidateName[4:10]: 1, - _ARPValidateName[10:16]: 2, - _ARPValidateName[16:19]: 3, + _ARPValidateName[0:4]: ARPValidateNone, + _ARPValidateLowerName[0:4]: ARPValidateNone, + _ARPValidateName[4:10]: ARPValidateActive, + _ARPValidateLowerName[4:10]: ARPValidateActive, + _ARPValidateName[10:16]: ARPValidateBackup, + _ARPValidateLowerName[10:16]: ARPValidateBackup, + _ARPValidateName[16:19]: ARPValidateAll, + _ARPValidateLowerName[16:19]: ARPValidateAll, +} + +var _ARPValidateNames = []string{ + _ARPValidateName[0:4], + _ARPValidateName[4:10], + _ARPValidateName[10:16], + _ARPValidateName[16:19], } // ARPValidateString retrieves an enum value from the enum constants string name. @@ -32,6 +56,10 @@ func ARPValidateString(s string) (ARPValidate, error) { if val, ok := _ARPValidateNameToValueMap[s]; ok { return val, nil } + + if val, ok := _ARPValidateNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to ARPValidate values", s) } @@ -40,6 +68,13 @@ func ARPValidateValues() []ARPValidate { return _ARPValidateValues } +// ARPValidateStrings returns a slice of all String values of the enum +func ARPValidateStrings() []string { + strs := make([]string, len(_ARPValidateNames)) + copy(strs, _ARPValidateNames) + return strs +} + // IsAARPValidate returns "true" if the value is listed in the enum definition. "false" otherwise func (i ARPValidate) IsAARPValidate() bool { for _, v := range _ARPValidateValues { diff --git a/pkg/machinery/nethelpers/bondmode_enumer.go b/pkg/machinery/nethelpers/bondmode_enumer.go index 3d5f493fd7..8095e9527d 100644 --- a/pkg/machinery/nethelpers/bondmode_enumer.go +++ b/pkg/machinery/nethelpers/bondmode_enumer.go @@ -4,12 +4,15 @@ package nethelpers import ( "fmt" + "strings" ) const _BondModeName = "balance-rractive-backupbalance-xorbroadcast802.3adbalance-tlbbalance-alb" var _BondModeIndex = [...]uint8{0, 10, 23, 34, 43, 50, 61, 72} +const _BondModeLowerName = "balance-rractive-backupbalance-xorbroadcast802.3adbalance-tlbbalance-alb" + func (i BondMode) String() string { if i >= BondMode(len(_BondModeIndex)-1) { return fmt.Sprintf("BondMode(%d)", i) @@ -17,16 +20,46 @@ func (i BondMode) String() string { return _BondModeName[_BondModeIndex[i]:_BondModeIndex[i+1]] } -var _BondModeValues = []BondMode{0, 1, 2, 3, 4, 5, 6} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _BondModeNoOp() { + var x [1]struct{} + _ = x[BondModeRoundrobin-(0)] + _ = x[BondModeActiveBackup-(1)] + _ = x[BondModeXOR-(2)] + _ = x[BondModeBroadcast-(3)] + _ = x[BondMode8023AD-(4)] + _ = x[BondModeTLB-(5)] + _ = x[BondModeALB-(6)] +} + +var _BondModeValues = []BondMode{BondModeRoundrobin, BondModeActiveBackup, BondModeXOR, BondModeBroadcast, BondMode8023AD, BondModeTLB, BondModeALB} var _BondModeNameToValueMap = map[string]BondMode{ - _BondModeName[0:10]: 0, - _BondModeName[10:23]: 1, - _BondModeName[23:34]: 2, - _BondModeName[34:43]: 3, - _BondModeName[43:50]: 4, - _BondModeName[50:61]: 5, - _BondModeName[61:72]: 6, + _BondModeName[0:10]: BondModeRoundrobin, + _BondModeLowerName[0:10]: BondModeRoundrobin, + _BondModeName[10:23]: BondModeActiveBackup, + _BondModeLowerName[10:23]: BondModeActiveBackup, + _BondModeName[23:34]: BondModeXOR, + _BondModeLowerName[23:34]: BondModeXOR, + _BondModeName[34:43]: BondModeBroadcast, + _BondModeLowerName[34:43]: BondModeBroadcast, + _BondModeName[43:50]: BondMode8023AD, + _BondModeLowerName[43:50]: BondMode8023AD, + _BondModeName[50:61]: BondModeTLB, + _BondModeLowerName[50:61]: BondModeTLB, + _BondModeName[61:72]: BondModeALB, + _BondModeLowerName[61:72]: BondModeALB, +} + +var _BondModeNames = []string{ + _BondModeName[0:10], + _BondModeName[10:23], + _BondModeName[23:34], + _BondModeName[34:43], + _BondModeName[43:50], + _BondModeName[50:61], + _BondModeName[61:72], } // BondModeString retrieves an enum value from the enum constants string name. @@ -35,6 +68,10 @@ func BondModeString(s string) (BondMode, error) { if val, ok := _BondModeNameToValueMap[s]; ok { return val, nil } + + if val, ok := _BondModeNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to BondMode values", s) } @@ -43,6 +80,13 @@ func BondModeValues() []BondMode { return _BondModeValues } +// BondModeStrings returns a slice of all String values of the enum +func BondModeStrings() []string { + strs := make([]string, len(_BondModeNames)) + copy(strs, _BondModeNames) + return strs +} + // IsABondMode returns "true" if the value is listed in the enum definition. "false" otherwise func (i BondMode) IsABondMode() bool { for _, v := range _BondModeValues { diff --git a/pkg/machinery/nethelpers/bondxmithashpolicy_enumer.go b/pkg/machinery/nethelpers/bondxmithashpolicy_enumer.go index 12e179d31d..6fa28af27f 100644 --- a/pkg/machinery/nethelpers/bondxmithashpolicy_enumer.go +++ b/pkg/machinery/nethelpers/bondxmithashpolicy_enumer.go @@ -4,12 +4,15 @@ package nethelpers import ( "fmt" + "strings" ) const _BondXmitHashPolicyName = "layer2layer3+4layer2+3encap2+3encap3+4" var _BondXmitHashPolicyIndex = [...]uint8{0, 6, 14, 22, 30, 38} +const _BondXmitHashPolicyLowerName = "layer2layer3+4layer2+3encap2+3encap3+4" + func (i BondXmitHashPolicy) String() string { if i >= BondXmitHashPolicy(len(_BondXmitHashPolicyIndex)-1) { return fmt.Sprintf("BondXmitHashPolicy(%d)", i) @@ -17,14 +20,38 @@ func (i BondXmitHashPolicy) String() string { return _BondXmitHashPolicyName[_BondXmitHashPolicyIndex[i]:_BondXmitHashPolicyIndex[i+1]] } -var _BondXmitHashPolicyValues = []BondXmitHashPolicy{0, 1, 2, 3, 4} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _BondXmitHashPolicyNoOp() { + var x [1]struct{} + _ = x[BondXmitPolicyLayer2-(0)] + _ = x[BondXmitPolicyLayer34-(1)] + _ = x[BondXmitPolicyLayer23-(2)] + _ = x[BondXmitPolicyEncap23-(3)] + _ = x[BondXmitPolicyEncap34-(4)] +} + +var _BondXmitHashPolicyValues = []BondXmitHashPolicy{BondXmitPolicyLayer2, BondXmitPolicyLayer34, BondXmitPolicyLayer23, BondXmitPolicyEncap23, BondXmitPolicyEncap34} var _BondXmitHashPolicyNameToValueMap = map[string]BondXmitHashPolicy{ - _BondXmitHashPolicyName[0:6]: 0, - _BondXmitHashPolicyName[6:14]: 1, - _BondXmitHashPolicyName[14:22]: 2, - _BondXmitHashPolicyName[22:30]: 3, - _BondXmitHashPolicyName[30:38]: 4, + _BondXmitHashPolicyName[0:6]: BondXmitPolicyLayer2, + _BondXmitHashPolicyLowerName[0:6]: BondXmitPolicyLayer2, + _BondXmitHashPolicyName[6:14]: BondXmitPolicyLayer34, + _BondXmitHashPolicyLowerName[6:14]: BondXmitPolicyLayer34, + _BondXmitHashPolicyName[14:22]: BondXmitPolicyLayer23, + _BondXmitHashPolicyLowerName[14:22]: BondXmitPolicyLayer23, + _BondXmitHashPolicyName[22:30]: BondXmitPolicyEncap23, + _BondXmitHashPolicyLowerName[22:30]: BondXmitPolicyEncap23, + _BondXmitHashPolicyName[30:38]: BondXmitPolicyEncap34, + _BondXmitHashPolicyLowerName[30:38]: BondXmitPolicyEncap34, +} + +var _BondXmitHashPolicyNames = []string{ + _BondXmitHashPolicyName[0:6], + _BondXmitHashPolicyName[6:14], + _BondXmitHashPolicyName[14:22], + _BondXmitHashPolicyName[22:30], + _BondXmitHashPolicyName[30:38], } // BondXmitHashPolicyString retrieves an enum value from the enum constants string name. @@ -33,6 +60,10 @@ func BondXmitHashPolicyString(s string) (BondXmitHashPolicy, error) { if val, ok := _BondXmitHashPolicyNameToValueMap[s]; ok { return val, nil } + + if val, ok := _BondXmitHashPolicyNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to BondXmitHashPolicy values", s) } @@ -41,6 +72,13 @@ func BondXmitHashPolicyValues() []BondXmitHashPolicy { return _BondXmitHashPolicyValues } +// BondXmitHashPolicyStrings returns a slice of all String values of the enum +func BondXmitHashPolicyStrings() []string { + strs := make([]string, len(_BondXmitHashPolicyNames)) + copy(strs, _BondXmitHashPolicyNames) + return strs +} + // IsABondXmitHashPolicy returns "true" if the value is listed in the enum definition. "false" otherwise func (i BondXmitHashPolicy) IsABondXmitHashPolicy() bool { for _, v := range _BondXmitHashPolicyValues { diff --git a/pkg/machinery/nethelpers/conntrackstate_enumer.go b/pkg/machinery/nethelpers/conntrackstate_enumer.go index 0b3023e591..31cfa85b70 100644 --- a/pkg/machinery/nethelpers/conntrackstate_enumer.go +++ b/pkg/machinery/nethelpers/conntrackstate_enumer.go @@ -4,12 +4,16 @@ package nethelpers import ( "fmt" + "strings" ) const ( - _ConntrackStateName_0 = "invalidestablished" - _ConntrackStateName_1 = "related" - _ConntrackStateName_2 = "new" + _ConntrackStateName_0 = "invalidestablished" + _ConntrackStateLowerName_0 = "invalidestablished" + _ConntrackStateName_1 = "related" + _ConntrackStateLowerName_1 = "related" + _ConntrackStateName_2 = "new" + _ConntrackStateLowerName_2 = "new" ) var ( @@ -32,13 +36,34 @@ func (i ConntrackState) String() string { } } -var _ConntrackStateValues = []ConntrackState{1, 2, 4, 8} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _ConntrackStateNoOp() { + var x [1]struct{} + _ = x[ConntrackStateInvalid-(1)] + _ = x[ConntrackStateEstablished-(2)] + _ = x[ConntrackStateRelated-(4)] + _ = x[ConntrackStateNew-(8)] +} + +var _ConntrackStateValues = []ConntrackState{ConntrackStateInvalid, ConntrackStateEstablished, ConntrackStateRelated, ConntrackStateNew} var _ConntrackStateNameToValueMap = map[string]ConntrackState{ - _ConntrackStateName_0[0:7]: 1, - _ConntrackStateName_0[7:18]: 2, - _ConntrackStateName_1[0:7]: 4, - _ConntrackStateName_2[0:3]: 8, + _ConntrackStateName_0[0:7]: ConntrackStateInvalid, + _ConntrackStateLowerName_0[0:7]: ConntrackStateInvalid, + _ConntrackStateName_0[7:18]: ConntrackStateEstablished, + _ConntrackStateLowerName_0[7:18]: ConntrackStateEstablished, + _ConntrackStateName_1[0:7]: ConntrackStateRelated, + _ConntrackStateLowerName_1[0:7]: ConntrackStateRelated, + _ConntrackStateName_2[0:3]: ConntrackStateNew, + _ConntrackStateLowerName_2[0:3]: ConntrackStateNew, +} + +var _ConntrackStateNames = []string{ + _ConntrackStateName_0[0:7], + _ConntrackStateName_0[7:18], + _ConntrackStateName_1[0:7], + _ConntrackStateName_2[0:3], } // ConntrackStateString retrieves an enum value from the enum constants string name. @@ -47,6 +72,10 @@ func ConntrackStateString(s string) (ConntrackState, error) { if val, ok := _ConntrackStateNameToValueMap[s]; ok { return val, nil } + + if val, ok := _ConntrackStateNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to ConntrackState values", s) } @@ -55,6 +84,13 @@ func ConntrackStateValues() []ConntrackState { return _ConntrackStateValues } +// ConntrackStateStrings returns a slice of all String values of the enum +func ConntrackStateStrings() []string { + strs := make([]string, len(_ConntrackStateNames)) + copy(strs, _ConntrackStateNames) + return strs +} + // IsAConntrackState returns "true" if the value is listed in the enum definition. "false" otherwise func (i ConntrackState) IsAConntrackState() bool { for _, v := range _ConntrackStateValues { diff --git a/pkg/machinery/nethelpers/defaultaction_enumer.go b/pkg/machinery/nethelpers/defaultaction_enumer.go index a755493d2b..9f86ccf3f0 100644 --- a/pkg/machinery/nethelpers/defaultaction_enumer.go +++ b/pkg/machinery/nethelpers/defaultaction_enumer.go @@ -4,12 +4,15 @@ package nethelpers import ( "fmt" + "strings" ) const _DefaultActionName = "acceptblock" var _DefaultActionIndex = [...]uint8{0, 6, 11} +const _DefaultActionLowerName = "acceptblock" + func (i DefaultAction) String() string { if i < 0 || i >= DefaultAction(len(_DefaultActionIndex)-1) { return fmt.Sprintf("DefaultAction(%d)", i) @@ -17,11 +20,26 @@ func (i DefaultAction) String() string { return _DefaultActionName[_DefaultActionIndex[i]:_DefaultActionIndex[i+1]] } -var _DefaultActionValues = []DefaultAction{0, 1} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _DefaultActionNoOp() { + var x [1]struct{} + _ = x[DefaultActionAccept-(0)] + _ = x[DefaultActionBlock-(1)] +} + +var _DefaultActionValues = []DefaultAction{DefaultActionAccept, DefaultActionBlock} var _DefaultActionNameToValueMap = map[string]DefaultAction{ - _DefaultActionName[0:6]: 0, - _DefaultActionName[6:11]: 1, + _DefaultActionName[0:6]: DefaultActionAccept, + _DefaultActionLowerName[0:6]: DefaultActionAccept, + _DefaultActionName[6:11]: DefaultActionBlock, + _DefaultActionLowerName[6:11]: DefaultActionBlock, +} + +var _DefaultActionNames = []string{ + _DefaultActionName[0:6], + _DefaultActionName[6:11], } // DefaultActionString retrieves an enum value from the enum constants string name. @@ -30,6 +48,10 @@ func DefaultActionString(s string) (DefaultAction, error) { if val, ok := _DefaultActionNameToValueMap[s]; ok { return val, nil } + + if val, ok := _DefaultActionNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to DefaultAction values", s) } @@ -38,6 +60,13 @@ func DefaultActionValues() []DefaultAction { return _DefaultActionValues } +// DefaultActionStrings returns a slice of all String values of the enum +func DefaultActionStrings() []string { + strs := make([]string, len(_DefaultActionNames)) + copy(strs, _DefaultActionNames) + return strs +} + // IsADefaultAction returns "true" if the value is listed in the enum definition. "false" otherwise func (i DefaultAction) IsADefaultAction() bool { for _, v := range _DefaultActionValues { diff --git a/pkg/machinery/nethelpers/duplex_enumer.go b/pkg/machinery/nethelpers/duplex_enumer.go index 78327a25f8..9b5effe642 100644 --- a/pkg/machinery/nethelpers/duplex_enumer.go +++ b/pkg/machinery/nethelpers/duplex_enumer.go @@ -4,11 +4,14 @@ package nethelpers import ( "fmt" + "strings" ) const ( - _DuplexName_0 = "HalfFull" - _DuplexName_1 = "Unknown" + _DuplexName_0 = "HalfFull" + _DuplexLowerName_0 = "halffull" + _DuplexName_1 = "Unknown" + _DuplexLowerName_1 = "unknown" ) var ( @@ -27,12 +30,30 @@ func (i Duplex) String() string { } } -var _DuplexValues = []Duplex{0, 1, 255} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _DuplexNoOp() { + var x [1]struct{} + _ = x[Half-(0)] + _ = x[Full-(1)] + _ = x[Unknown-(255)] +} + +var _DuplexValues = []Duplex{Half, Full, Unknown} var _DuplexNameToValueMap = map[string]Duplex{ - _DuplexName_0[0:4]: 0, - _DuplexName_0[4:8]: 1, - _DuplexName_1[0:7]: 255, + _DuplexName_0[0:4]: Half, + _DuplexLowerName_0[0:4]: Half, + _DuplexName_0[4:8]: Full, + _DuplexLowerName_0[4:8]: Full, + _DuplexName_1[0:7]: Unknown, + _DuplexLowerName_1[0:7]: Unknown, +} + +var _DuplexNames = []string{ + _DuplexName_0[0:4], + _DuplexName_0[4:8], + _DuplexName_1[0:7], } // DuplexString retrieves an enum value from the enum constants string name. @@ -41,6 +62,10 @@ func DuplexString(s string) (Duplex, error) { if val, ok := _DuplexNameToValueMap[s]; ok { return val, nil } + + if val, ok := _DuplexNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to Duplex values", s) } @@ -49,6 +74,13 @@ func DuplexValues() []Duplex { return _DuplexValues } +// DuplexStrings returns a slice of all String values of the enum +func DuplexStrings() []string { + strs := make([]string, len(_DuplexNames)) + copy(strs, _DuplexNames) + return strs +} + // IsADuplex returns "true" if the value is listed in the enum definition. "false" otherwise func (i Duplex) IsADuplex() bool { for _, v := range _DuplexValues { diff --git a/pkg/machinery/nethelpers/failovermac_enumer.go b/pkg/machinery/nethelpers/failovermac_enumer.go index a450905f50..3f6d0a6a00 100644 --- a/pkg/machinery/nethelpers/failovermac_enumer.go +++ b/pkg/machinery/nethelpers/failovermac_enumer.go @@ -4,12 +4,15 @@ package nethelpers import ( "fmt" + "strings" ) const _FailOverMACName = "noneactivefollow" var _FailOverMACIndex = [...]uint8{0, 4, 10, 16} +const _FailOverMACLowerName = "noneactivefollow" + func (i FailOverMAC) String() string { if i >= FailOverMAC(len(_FailOverMACIndex)-1) { return fmt.Sprintf("FailOverMAC(%d)", i) @@ -17,12 +20,30 @@ func (i FailOverMAC) String() string { return _FailOverMACName[_FailOverMACIndex[i]:_FailOverMACIndex[i+1]] } -var _FailOverMACValues = []FailOverMAC{0, 1, 2} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _FailOverMACNoOp() { + var x [1]struct{} + _ = x[FailOverMACNone-(0)] + _ = x[FailOverMACActive-(1)] + _ = x[FailOverMACFollow-(2)] +} + +var _FailOverMACValues = []FailOverMAC{FailOverMACNone, FailOverMACActive, FailOverMACFollow} var _FailOverMACNameToValueMap = map[string]FailOverMAC{ - _FailOverMACName[0:4]: 0, - _FailOverMACName[4:10]: 1, - _FailOverMACName[10:16]: 2, + _FailOverMACName[0:4]: FailOverMACNone, + _FailOverMACLowerName[0:4]: FailOverMACNone, + _FailOverMACName[4:10]: FailOverMACActive, + _FailOverMACLowerName[4:10]: FailOverMACActive, + _FailOverMACName[10:16]: FailOverMACFollow, + _FailOverMACLowerName[10:16]: FailOverMACFollow, +} + +var _FailOverMACNames = []string{ + _FailOverMACName[0:4], + _FailOverMACName[4:10], + _FailOverMACName[10:16], } // FailOverMACString retrieves an enum value from the enum constants string name. @@ -31,6 +52,10 @@ func FailOverMACString(s string) (FailOverMAC, error) { if val, ok := _FailOverMACNameToValueMap[s]; ok { return val, nil } + + if val, ok := _FailOverMACNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to FailOverMAC values", s) } @@ -39,6 +64,13 @@ func FailOverMACValues() []FailOverMAC { return _FailOverMACValues } +// FailOverMACStrings returns a slice of all String values of the enum +func FailOverMACStrings() []string { + strs := make([]string, len(_FailOverMACNames)) + copy(strs, _FailOverMACNames) + return strs +} + // IsAFailOverMAC returns "true" if the value is listed in the enum definition. "false" otherwise func (i FailOverMAC) IsAFailOverMAC() bool { for _, v := range _FailOverMACValues { diff --git a/pkg/machinery/nethelpers/family_enumer.go b/pkg/machinery/nethelpers/family_enumer.go index 4cd0bf9705..9584fe4f61 100644 --- a/pkg/machinery/nethelpers/family_enumer.go +++ b/pkg/machinery/nethelpers/family_enumer.go @@ -4,11 +4,14 @@ package nethelpers import ( "fmt" + "strings" ) const ( - _FamilyName_0 = "inet4" - _FamilyName_1 = "inet6" + _FamilyName_0 = "inet4" + _FamilyLowerName_0 = "inet4" + _FamilyName_1 = "inet6" + _FamilyLowerName_1 = "inet6" ) var ( @@ -27,11 +30,26 @@ func (i Family) String() string { } } -var _FamilyValues = []Family{2, 10} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _FamilyNoOp() { + var x [1]struct{} + _ = x[FamilyInet4-(2)] + _ = x[FamilyInet6-(10)] +} + +var _FamilyValues = []Family{FamilyInet4, FamilyInet6} var _FamilyNameToValueMap = map[string]Family{ - _FamilyName_0[0:5]: 2, - _FamilyName_1[0:5]: 10, + _FamilyName_0[0:5]: FamilyInet4, + _FamilyLowerName_0[0:5]: FamilyInet4, + _FamilyName_1[0:5]: FamilyInet6, + _FamilyLowerName_1[0:5]: FamilyInet6, +} + +var _FamilyNames = []string{ + _FamilyName_0[0:5], + _FamilyName_1[0:5], } // FamilyString retrieves an enum value from the enum constants string name. @@ -40,6 +58,10 @@ func FamilyString(s string) (Family, error) { if val, ok := _FamilyNameToValueMap[s]; ok { return val, nil } + + if val, ok := _FamilyNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to Family values", s) } @@ -48,6 +70,13 @@ func FamilyValues() []Family { return _FamilyValues } +// FamilyStrings returns a slice of all String values of the enum +func FamilyStrings() []string { + strs := make([]string, len(_FamilyNames)) + copy(strs, _FamilyNames) + return strs +} + // IsAFamily returns "true" if the value is listed in the enum definition. "false" otherwise func (i Family) IsAFamily() bool { for _, v := range _FamilyValues { diff --git a/pkg/machinery/nethelpers/lacprate_enumer.go b/pkg/machinery/nethelpers/lacprate_enumer.go index 782f04ab2d..fedfa7900a 100644 --- a/pkg/machinery/nethelpers/lacprate_enumer.go +++ b/pkg/machinery/nethelpers/lacprate_enumer.go @@ -4,12 +4,15 @@ package nethelpers import ( "fmt" + "strings" ) const _LACPRateName = "slowfast" var _LACPRateIndex = [...]uint8{0, 4, 8} +const _LACPRateLowerName = "slowfast" + func (i LACPRate) String() string { if i >= LACPRate(len(_LACPRateIndex)-1) { return fmt.Sprintf("LACPRate(%d)", i) @@ -17,11 +20,26 @@ func (i LACPRate) String() string { return _LACPRateName[_LACPRateIndex[i]:_LACPRateIndex[i+1]] } -var _LACPRateValues = []LACPRate{0, 1} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _LACPRateNoOp() { + var x [1]struct{} + _ = x[LACPRateSlow-(0)] + _ = x[LACPRateFast-(1)] +} + +var _LACPRateValues = []LACPRate{LACPRateSlow, LACPRateFast} var _LACPRateNameToValueMap = map[string]LACPRate{ - _LACPRateName[0:4]: 0, - _LACPRateName[4:8]: 1, + _LACPRateName[0:4]: LACPRateSlow, + _LACPRateLowerName[0:4]: LACPRateSlow, + _LACPRateName[4:8]: LACPRateFast, + _LACPRateLowerName[4:8]: LACPRateFast, +} + +var _LACPRateNames = []string{ + _LACPRateName[0:4], + _LACPRateName[4:8], } // LACPRateString retrieves an enum value from the enum constants string name. @@ -30,6 +48,10 @@ func LACPRateString(s string) (LACPRate, error) { if val, ok := _LACPRateNameToValueMap[s]; ok { return val, nil } + + if val, ok := _LACPRateNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to LACPRate values", s) } @@ -38,6 +60,13 @@ func LACPRateValues() []LACPRate { return _LACPRateValues } +// LACPRateStrings returns a slice of all String values of the enum +func LACPRateStrings() []string { + strs := make([]string, len(_LACPRateNames)) + copy(strs, _LACPRateNames) + return strs +} + // IsALACPRate returns "true" if the value is listed in the enum definition. "false" otherwise func (i LACPRate) IsALACPRate() bool { for _, v := range _LACPRateValues { diff --git a/pkg/machinery/nethelpers/linkflag_enumer.go b/pkg/machinery/nethelpers/linkflag_enumer.go index b8190e72ad..51210886b6 100644 --- a/pkg/machinery/nethelpers/linkflag_enumer.go +++ b/pkg/machinery/nethelpers/linkflag_enumer.go @@ -4,9 +4,11 @@ package nethelpers import ( "fmt" + "strings" ) const _LinkFlagName = "UPBROADCASTDEBUGLOOPBACKPOINTTOPOINTNOTRAILERSRUNNINGNOARPPROMISCALLMULTIMASTERSLAVEMULTICASTPORTSELAUTOMEDIADYNAMICLOWER_UPDORMANTECHO" +const _LinkFlagLowerName = "upbroadcastdebugloopbackpointtopointnotrailersrunningnoarppromiscallmultimasterslavemulticastportselautomediadynamiclower_updormantecho" var _LinkFlagMap = map[LinkFlag]string{ 1: _LinkFlagName[0:2], @@ -37,28 +39,94 @@ func (i LinkFlag) String() string { return fmt.Sprintf("LinkFlag(%d)", i) } -var _LinkFlagValues = []LinkFlag{1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _LinkFlagNoOp() { + var x [1]struct{} + _ = x[LinkUp-(1)] + _ = x[LinkBroadcast-(2)] + _ = x[LinkDebug-(4)] + _ = x[LinkLoopback-(8)] + _ = x[LinkPointToPoint-(16)] + _ = x[LinkNoTrailers-(32)] + _ = x[LinkRunning-(64)] + _ = x[LinkNoArp-(128)] + _ = x[LinkPromisc-(256)] + _ = x[LinkAllMulti-(512)] + _ = x[LinkMaster-(1024)] + _ = x[LinkSlave-(2048)] + _ = x[LinkMulticase-(4096)] + _ = x[LinkPortsel-(8192)] + _ = x[LinKAutoMedia-(16384)] + _ = x[LinkDynamic-(32768)] + _ = x[LinkLowerUp-(65536)] + _ = x[LinkDormant-(131072)] + _ = x[LinkEcho-(262144)] +} + +var _LinkFlagValues = []LinkFlag{LinkUp, LinkBroadcast, LinkDebug, LinkLoopback, LinkPointToPoint, LinkNoTrailers, LinkRunning, LinkNoArp, LinkPromisc, LinkAllMulti, LinkMaster, LinkSlave, LinkMulticase, LinkPortsel, LinKAutoMedia, LinkDynamic, LinkLowerUp, LinkDormant, LinkEcho} var _LinkFlagNameToValueMap = map[string]LinkFlag{ - _LinkFlagName[0:2]: 1, - _LinkFlagName[2:11]: 2, - _LinkFlagName[11:16]: 4, - _LinkFlagName[16:24]: 8, - _LinkFlagName[24:36]: 16, - _LinkFlagName[36:46]: 32, - _LinkFlagName[46:53]: 64, - _LinkFlagName[53:58]: 128, - _LinkFlagName[58:65]: 256, - _LinkFlagName[65:73]: 512, - _LinkFlagName[73:79]: 1024, - _LinkFlagName[79:84]: 2048, - _LinkFlagName[84:93]: 4096, - _LinkFlagName[93:100]: 8192, - _LinkFlagName[100:109]: 16384, - _LinkFlagName[109:116]: 32768, - _LinkFlagName[116:124]: 65536, - _LinkFlagName[124:131]: 131072, - _LinkFlagName[131:135]: 262144, + _LinkFlagName[0:2]: LinkUp, + _LinkFlagLowerName[0:2]: LinkUp, + _LinkFlagName[2:11]: LinkBroadcast, + _LinkFlagLowerName[2:11]: LinkBroadcast, + _LinkFlagName[11:16]: LinkDebug, + _LinkFlagLowerName[11:16]: LinkDebug, + _LinkFlagName[16:24]: LinkLoopback, + _LinkFlagLowerName[16:24]: LinkLoopback, + _LinkFlagName[24:36]: LinkPointToPoint, + _LinkFlagLowerName[24:36]: LinkPointToPoint, + _LinkFlagName[36:46]: LinkNoTrailers, + _LinkFlagLowerName[36:46]: LinkNoTrailers, + _LinkFlagName[46:53]: LinkRunning, + _LinkFlagLowerName[46:53]: LinkRunning, + _LinkFlagName[53:58]: LinkNoArp, + _LinkFlagLowerName[53:58]: LinkNoArp, + _LinkFlagName[58:65]: LinkPromisc, + _LinkFlagLowerName[58:65]: LinkPromisc, + _LinkFlagName[65:73]: LinkAllMulti, + _LinkFlagLowerName[65:73]: LinkAllMulti, + _LinkFlagName[73:79]: LinkMaster, + _LinkFlagLowerName[73:79]: LinkMaster, + _LinkFlagName[79:84]: LinkSlave, + _LinkFlagLowerName[79:84]: LinkSlave, + _LinkFlagName[84:93]: LinkMulticase, + _LinkFlagLowerName[84:93]: LinkMulticase, + _LinkFlagName[93:100]: LinkPortsel, + _LinkFlagLowerName[93:100]: LinkPortsel, + _LinkFlagName[100:109]: LinKAutoMedia, + _LinkFlagLowerName[100:109]: LinKAutoMedia, + _LinkFlagName[109:116]: LinkDynamic, + _LinkFlagLowerName[109:116]: LinkDynamic, + _LinkFlagName[116:124]: LinkLowerUp, + _LinkFlagLowerName[116:124]: LinkLowerUp, + _LinkFlagName[124:131]: LinkDormant, + _LinkFlagLowerName[124:131]: LinkDormant, + _LinkFlagName[131:135]: LinkEcho, + _LinkFlagLowerName[131:135]: LinkEcho, +} + +var _LinkFlagNames = []string{ + _LinkFlagName[0:2], + _LinkFlagName[2:11], + _LinkFlagName[11:16], + _LinkFlagName[16:24], + _LinkFlagName[24:36], + _LinkFlagName[36:46], + _LinkFlagName[46:53], + _LinkFlagName[53:58], + _LinkFlagName[58:65], + _LinkFlagName[65:73], + _LinkFlagName[73:79], + _LinkFlagName[79:84], + _LinkFlagName[84:93], + _LinkFlagName[93:100], + _LinkFlagName[100:109], + _LinkFlagName[109:116], + _LinkFlagName[116:124], + _LinkFlagName[124:131], + _LinkFlagName[131:135], } // LinkFlagString retrieves an enum value from the enum constants string name. @@ -67,6 +135,10 @@ func LinkFlagString(s string) (LinkFlag, error) { if val, ok := _LinkFlagNameToValueMap[s]; ok { return val, nil } + + if val, ok := _LinkFlagNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to LinkFlag values", s) } @@ -75,6 +147,13 @@ func LinkFlagValues() []LinkFlag { return _LinkFlagValues } +// LinkFlagStrings returns a slice of all String values of the enum +func LinkFlagStrings() []string { + strs := make([]string, len(_LinkFlagNames)) + copy(strs, _LinkFlagNames) + return strs +} + // IsALinkFlag returns "true" if the value is listed in the enum definition. "false" otherwise func (i LinkFlag) IsALinkFlag() bool { _, ok := _LinkFlagMap[i] diff --git a/pkg/machinery/nethelpers/linktype_enumer.go b/pkg/machinery/nethelpers/linktype_enumer.go index 15075a44d3..f9ce8aaaae 100644 --- a/pkg/machinery/nethelpers/linktype_enumer.go +++ b/pkg/machinery/nethelpers/linktype_enumer.go @@ -4,9 +4,11 @@ package nethelpers import ( "fmt" + "strings" ) const _LinkTypeName = "netromethereetherax25pronetchaosieee802arcnetatalkdlciatmmetricomieee1394eui64infinibandslipcslipslip6cslip6rsrvdadaptrosex25hwx25canpppciscolapbddcmprawhdlcipiptunnel6fradskiploopbacklocaltlkfddibifsitip/ddpgrepimreghippiasheconetirdafcppfcalfcplfcfb_0fcfb_1fcfb_2fcfb_3fcfb_4fcfb_5fcfb_6fcfb_7fcfb_8fcfb_9fcfb_10fcfb_11fcfb_12trieee802.11ieee802.11_prismieee802.11_radiotapieee802.15.4ieee802.15.4_monitorphonetphonet_pipecaifip6grenetlink6lowpannohdrvoid" +const _LinkTypeLowerName = "netromethereetherax25pronetchaosieee802arcnetatalkdlciatmmetricomieee1394eui64infinibandslipcslipslip6cslip6rsrvdadaptrosex25hwx25canpppciscolapbddcmprawhdlcipiptunnel6fradskiploopbacklocaltlkfddibifsitip/ddpgrepimreghippiasheconetirdafcppfcalfcplfcfb_0fcfb_1fcfb_2fcfb_3fcfb_4fcfb_5fcfb_6fcfb_7fcfb_8fcfb_9fcfb_10fcfb_11fcfb_12trieee802.11ieee802.11_prismieee802.11_radiotapieee802.15.4ieee802.15.4_monitorphonetphonet_pipecaifip6grenetlink6lowpannohdrvoid" var _LinkTypeMap = map[LinkType]string{ 0: _LinkTypeName[0:6], @@ -94,85 +96,322 @@ func (i LinkType) String() string { return fmt.Sprintf("LinkType(%d)", i) } -var _LinkTypeValues = []LinkType{0, 1, 2, 3, 4, 5, 6, 7, 8, 15, 19, 23, 24, 27, 32, 256, 257, 258, 259, 260, 264, 270, 271, 272, 280, 512, 513, 516, 517, 518, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 820, 821, 822, 823, 824, 825, 65534, 65535} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _LinkTypeNoOp() { + var x [1]struct{} + _ = x[LinkNetrom-(0)] + _ = x[LinkEther-(1)] + _ = x[LinkEether-(2)] + _ = x[LinkAx25-(3)] + _ = x[LinkPronet-(4)] + _ = x[LinkChaos-(5)] + _ = x[LinkIee802-(6)] + _ = x[LinkArcnet-(7)] + _ = x[LinkAtalk-(8)] + _ = x[LinkDlci-(15)] + _ = x[LinkAtm-(19)] + _ = x[LinkMetricom-(23)] + _ = x[LinkIeee1394-(24)] + _ = x[LinkEui64-(27)] + _ = x[LinkInfiniband-(32)] + _ = x[LinkSlip-(256)] + _ = x[LinkCslip-(257)] + _ = x[LinkSlip6-(258)] + _ = x[LinkCslip6-(259)] + _ = x[LinkRsrvd-(260)] + _ = x[LinkAdapt-(264)] + _ = x[LinkRose-(270)] + _ = x[LinkX25-(271)] + _ = x[LinkHwx25-(272)] + _ = x[LinkCan-(280)] + _ = x[LinkPpp-(512)] + _ = x[LinkCisco-(513)] + _ = x[LinkLapb-(516)] + _ = x[LinkDdcmp-(517)] + _ = x[LinkRawhdlc-(518)] + _ = x[LinkTunnel-(768)] + _ = x[LinkTunnel6-(769)] + _ = x[LinkFrad-(770)] + _ = x[LinkSkip-(771)] + _ = x[LinkLoopbck-(772)] + _ = x[LinkLocaltlk-(773)] + _ = x[LinkFddi-(774)] + _ = x[LinkBif-(775)] + _ = x[LinkSit-(776)] + _ = x[LinkIpddp-(777)] + _ = x[LinkIpgre-(778)] + _ = x[LinkPimreg-(779)] + _ = x[LinkHippi-(780)] + _ = x[LinkAsh-(781)] + _ = x[LinkEconet-(782)] + _ = x[LinkIrda-(783)] + _ = x[LinkFcpp-(784)] + _ = x[LinkFcal-(785)] + _ = x[LinkFcpl-(786)] + _ = x[LinkFcfabric-(787)] + _ = x[LinkFcfabric1-(788)] + _ = x[LinkFcfabric2-(789)] + _ = x[LinkFcfabric3-(790)] + _ = x[LinkFcfabric4-(791)] + _ = x[LinkFcfabric5-(792)] + _ = x[LinkFcfabric6-(793)] + _ = x[LinkFcfabric7-(794)] + _ = x[LinkFcfabric8-(795)] + _ = x[LinkFcfabric9-(796)] + _ = x[LinkFcfabric10-(797)] + _ = x[LinkFcfabric11-(798)] + _ = x[LinkFcfabric12-(799)] + _ = x[LinkIee802tr-(800)] + _ = x[LinkIee80211-(801)] + _ = x[LinkIee80211prism-(802)] + _ = x[LinkIee80211Radiotap-(803)] + _ = x[LinkIee8021154-(804)] + _ = x[LinkIee8021154monitor-(805)] + _ = x[LinkPhonet-(820)] + _ = x[LinkPhonetpipe-(821)] + _ = x[LinkCaif-(822)] + _ = x[LinkIP6gre-(823)] + _ = x[LinkNetlink-(824)] + _ = x[Link6Lowpan-(825)] + _ = x[LinkNone-(65534)] + _ = x[LinkVoid-(65535)] +} + +var _LinkTypeValues = []LinkType{LinkNetrom, LinkEther, LinkEether, LinkAx25, LinkPronet, LinkChaos, LinkIee802, LinkArcnet, LinkAtalk, LinkDlci, LinkAtm, LinkMetricom, LinkIeee1394, LinkEui64, LinkInfiniband, LinkSlip, LinkCslip, LinkSlip6, LinkCslip6, LinkRsrvd, LinkAdapt, LinkRose, LinkX25, LinkHwx25, LinkCan, LinkPpp, LinkCisco, LinkLapb, LinkDdcmp, LinkRawhdlc, LinkTunnel, LinkTunnel6, LinkFrad, LinkSkip, LinkLoopbck, LinkLocaltlk, LinkFddi, LinkBif, LinkSit, LinkIpddp, LinkIpgre, LinkPimreg, LinkHippi, LinkAsh, LinkEconet, LinkIrda, LinkFcpp, LinkFcal, LinkFcpl, LinkFcfabric, LinkFcfabric1, LinkFcfabric2, LinkFcfabric3, LinkFcfabric4, LinkFcfabric5, LinkFcfabric6, LinkFcfabric7, LinkFcfabric8, LinkFcfabric9, LinkFcfabric10, LinkFcfabric11, LinkFcfabric12, LinkIee802tr, LinkIee80211, LinkIee80211prism, LinkIee80211Radiotap, LinkIee8021154, LinkIee8021154monitor, LinkPhonet, LinkPhonetpipe, LinkCaif, LinkIP6gre, LinkNetlink, Link6Lowpan, LinkNone, LinkVoid} var _LinkTypeNameToValueMap = map[string]LinkType{ - _LinkTypeName[0:6]: 0, - _LinkTypeName[6:11]: 1, - _LinkTypeName[11:17]: 2, - _LinkTypeName[17:21]: 3, - _LinkTypeName[21:27]: 4, - _LinkTypeName[27:32]: 5, - _LinkTypeName[32:39]: 6, - _LinkTypeName[39:45]: 7, - _LinkTypeName[45:50]: 8, - _LinkTypeName[50:54]: 15, - _LinkTypeName[54:57]: 19, - _LinkTypeName[57:65]: 23, - _LinkTypeName[65:73]: 24, - _LinkTypeName[73:78]: 27, - _LinkTypeName[78:88]: 32, - _LinkTypeName[88:92]: 256, - _LinkTypeName[92:97]: 257, - _LinkTypeName[97:102]: 258, - _LinkTypeName[102:108]: 259, - _LinkTypeName[108:113]: 260, - _LinkTypeName[113:118]: 264, - _LinkTypeName[118:122]: 270, - _LinkTypeName[122:125]: 271, - _LinkTypeName[125:130]: 272, - _LinkTypeName[130:133]: 280, - _LinkTypeName[133:136]: 512, - _LinkTypeName[136:141]: 513, - _LinkTypeName[141:145]: 516, - _LinkTypeName[145:150]: 517, - _LinkTypeName[150:157]: 518, - _LinkTypeName[157:161]: 768, - _LinkTypeName[161:168]: 769, - _LinkTypeName[168:172]: 770, - _LinkTypeName[172:176]: 771, - _LinkTypeName[176:184]: 772, - _LinkTypeName[184:192]: 773, - _LinkTypeName[192:196]: 774, - _LinkTypeName[196:199]: 775, - _LinkTypeName[199:202]: 776, - _LinkTypeName[202:208]: 777, - _LinkTypeName[208:211]: 778, - _LinkTypeName[211:217]: 779, - _LinkTypeName[217:222]: 780, - _LinkTypeName[222:225]: 781, - _LinkTypeName[225:231]: 782, - _LinkTypeName[231:235]: 783, - _LinkTypeName[235:239]: 784, - _LinkTypeName[239:243]: 785, - _LinkTypeName[243:247]: 786, - _LinkTypeName[247:253]: 787, - _LinkTypeName[253:259]: 788, - _LinkTypeName[259:265]: 789, - _LinkTypeName[265:271]: 790, - _LinkTypeName[271:277]: 791, - _LinkTypeName[277:283]: 792, - _LinkTypeName[283:289]: 793, - _LinkTypeName[289:295]: 794, - _LinkTypeName[295:301]: 795, - _LinkTypeName[301:307]: 796, - _LinkTypeName[307:314]: 797, - _LinkTypeName[314:321]: 798, - _LinkTypeName[321:328]: 799, - _LinkTypeName[328:330]: 800, - _LinkTypeName[330:340]: 801, - _LinkTypeName[340:356]: 802, - _LinkTypeName[356:375]: 803, - _LinkTypeName[375:387]: 804, - _LinkTypeName[387:407]: 805, - _LinkTypeName[407:413]: 820, - _LinkTypeName[413:424]: 821, - _LinkTypeName[424:428]: 822, - _LinkTypeName[428:434]: 823, - _LinkTypeName[434:441]: 824, - _LinkTypeName[441:448]: 825, - _LinkTypeName[448:453]: 65534, - _LinkTypeName[453:457]: 65535, + _LinkTypeName[0:6]: LinkNetrom, + _LinkTypeLowerName[0:6]: LinkNetrom, + _LinkTypeName[6:11]: LinkEther, + _LinkTypeLowerName[6:11]: LinkEther, + _LinkTypeName[11:17]: LinkEether, + _LinkTypeLowerName[11:17]: LinkEether, + _LinkTypeName[17:21]: LinkAx25, + _LinkTypeLowerName[17:21]: LinkAx25, + _LinkTypeName[21:27]: LinkPronet, + _LinkTypeLowerName[21:27]: LinkPronet, + _LinkTypeName[27:32]: LinkChaos, + _LinkTypeLowerName[27:32]: LinkChaos, + _LinkTypeName[32:39]: LinkIee802, + _LinkTypeLowerName[32:39]: LinkIee802, + _LinkTypeName[39:45]: LinkArcnet, + _LinkTypeLowerName[39:45]: LinkArcnet, + _LinkTypeName[45:50]: LinkAtalk, + _LinkTypeLowerName[45:50]: LinkAtalk, + _LinkTypeName[50:54]: LinkDlci, + _LinkTypeLowerName[50:54]: LinkDlci, + _LinkTypeName[54:57]: LinkAtm, + _LinkTypeLowerName[54:57]: LinkAtm, + _LinkTypeName[57:65]: LinkMetricom, + _LinkTypeLowerName[57:65]: LinkMetricom, + _LinkTypeName[65:73]: LinkIeee1394, + _LinkTypeLowerName[65:73]: LinkIeee1394, + _LinkTypeName[73:78]: LinkEui64, + _LinkTypeLowerName[73:78]: LinkEui64, + _LinkTypeName[78:88]: LinkInfiniband, + _LinkTypeLowerName[78:88]: LinkInfiniband, + _LinkTypeName[88:92]: LinkSlip, + _LinkTypeLowerName[88:92]: LinkSlip, + _LinkTypeName[92:97]: LinkCslip, + _LinkTypeLowerName[92:97]: LinkCslip, + _LinkTypeName[97:102]: LinkSlip6, + _LinkTypeLowerName[97:102]: LinkSlip6, + _LinkTypeName[102:108]: LinkCslip6, + _LinkTypeLowerName[102:108]: LinkCslip6, + _LinkTypeName[108:113]: LinkRsrvd, + _LinkTypeLowerName[108:113]: LinkRsrvd, + _LinkTypeName[113:118]: LinkAdapt, + _LinkTypeLowerName[113:118]: LinkAdapt, + _LinkTypeName[118:122]: LinkRose, + _LinkTypeLowerName[118:122]: LinkRose, + _LinkTypeName[122:125]: LinkX25, + _LinkTypeLowerName[122:125]: LinkX25, + _LinkTypeName[125:130]: LinkHwx25, + _LinkTypeLowerName[125:130]: LinkHwx25, + _LinkTypeName[130:133]: LinkCan, + _LinkTypeLowerName[130:133]: LinkCan, + _LinkTypeName[133:136]: LinkPpp, + _LinkTypeLowerName[133:136]: LinkPpp, + _LinkTypeName[136:141]: LinkCisco, + _LinkTypeLowerName[136:141]: LinkCisco, + _LinkTypeName[141:145]: LinkLapb, + _LinkTypeLowerName[141:145]: LinkLapb, + _LinkTypeName[145:150]: LinkDdcmp, + _LinkTypeLowerName[145:150]: LinkDdcmp, + _LinkTypeName[150:157]: LinkRawhdlc, + _LinkTypeLowerName[150:157]: LinkRawhdlc, + _LinkTypeName[157:161]: LinkTunnel, + _LinkTypeLowerName[157:161]: LinkTunnel, + _LinkTypeName[161:168]: LinkTunnel6, + _LinkTypeLowerName[161:168]: LinkTunnel6, + _LinkTypeName[168:172]: LinkFrad, + _LinkTypeLowerName[168:172]: LinkFrad, + _LinkTypeName[172:176]: LinkSkip, + _LinkTypeLowerName[172:176]: LinkSkip, + _LinkTypeName[176:184]: LinkLoopbck, + _LinkTypeLowerName[176:184]: LinkLoopbck, + _LinkTypeName[184:192]: LinkLocaltlk, + _LinkTypeLowerName[184:192]: LinkLocaltlk, + _LinkTypeName[192:196]: LinkFddi, + _LinkTypeLowerName[192:196]: LinkFddi, + _LinkTypeName[196:199]: LinkBif, + _LinkTypeLowerName[196:199]: LinkBif, + _LinkTypeName[199:202]: LinkSit, + _LinkTypeLowerName[199:202]: LinkSit, + _LinkTypeName[202:208]: LinkIpddp, + _LinkTypeLowerName[202:208]: LinkIpddp, + _LinkTypeName[208:211]: LinkIpgre, + _LinkTypeLowerName[208:211]: LinkIpgre, + _LinkTypeName[211:217]: LinkPimreg, + _LinkTypeLowerName[211:217]: LinkPimreg, + _LinkTypeName[217:222]: LinkHippi, + _LinkTypeLowerName[217:222]: LinkHippi, + _LinkTypeName[222:225]: LinkAsh, + _LinkTypeLowerName[222:225]: LinkAsh, + _LinkTypeName[225:231]: LinkEconet, + _LinkTypeLowerName[225:231]: LinkEconet, + _LinkTypeName[231:235]: LinkIrda, + _LinkTypeLowerName[231:235]: LinkIrda, + _LinkTypeName[235:239]: LinkFcpp, + _LinkTypeLowerName[235:239]: LinkFcpp, + _LinkTypeName[239:243]: LinkFcal, + _LinkTypeLowerName[239:243]: LinkFcal, + _LinkTypeName[243:247]: LinkFcpl, + _LinkTypeLowerName[243:247]: LinkFcpl, + _LinkTypeName[247:253]: LinkFcfabric, + _LinkTypeLowerName[247:253]: LinkFcfabric, + _LinkTypeName[253:259]: LinkFcfabric1, + _LinkTypeLowerName[253:259]: LinkFcfabric1, + _LinkTypeName[259:265]: LinkFcfabric2, + _LinkTypeLowerName[259:265]: LinkFcfabric2, + _LinkTypeName[265:271]: LinkFcfabric3, + _LinkTypeLowerName[265:271]: LinkFcfabric3, + _LinkTypeName[271:277]: LinkFcfabric4, + _LinkTypeLowerName[271:277]: LinkFcfabric4, + _LinkTypeName[277:283]: LinkFcfabric5, + _LinkTypeLowerName[277:283]: LinkFcfabric5, + _LinkTypeName[283:289]: LinkFcfabric6, + _LinkTypeLowerName[283:289]: LinkFcfabric6, + _LinkTypeName[289:295]: LinkFcfabric7, + _LinkTypeLowerName[289:295]: LinkFcfabric7, + _LinkTypeName[295:301]: LinkFcfabric8, + _LinkTypeLowerName[295:301]: LinkFcfabric8, + _LinkTypeName[301:307]: LinkFcfabric9, + _LinkTypeLowerName[301:307]: LinkFcfabric9, + _LinkTypeName[307:314]: LinkFcfabric10, + _LinkTypeLowerName[307:314]: LinkFcfabric10, + _LinkTypeName[314:321]: LinkFcfabric11, + _LinkTypeLowerName[314:321]: LinkFcfabric11, + _LinkTypeName[321:328]: LinkFcfabric12, + _LinkTypeLowerName[321:328]: LinkFcfabric12, + _LinkTypeName[328:330]: LinkIee802tr, + _LinkTypeLowerName[328:330]: LinkIee802tr, + _LinkTypeName[330:340]: LinkIee80211, + _LinkTypeLowerName[330:340]: LinkIee80211, + _LinkTypeName[340:356]: LinkIee80211prism, + _LinkTypeLowerName[340:356]: LinkIee80211prism, + _LinkTypeName[356:375]: LinkIee80211Radiotap, + _LinkTypeLowerName[356:375]: LinkIee80211Radiotap, + _LinkTypeName[375:387]: LinkIee8021154, + _LinkTypeLowerName[375:387]: LinkIee8021154, + _LinkTypeName[387:407]: LinkIee8021154monitor, + _LinkTypeLowerName[387:407]: LinkIee8021154monitor, + _LinkTypeName[407:413]: LinkPhonet, + _LinkTypeLowerName[407:413]: LinkPhonet, + _LinkTypeName[413:424]: LinkPhonetpipe, + _LinkTypeLowerName[413:424]: LinkPhonetpipe, + _LinkTypeName[424:428]: LinkCaif, + _LinkTypeLowerName[424:428]: LinkCaif, + _LinkTypeName[428:434]: LinkIP6gre, + _LinkTypeLowerName[428:434]: LinkIP6gre, + _LinkTypeName[434:441]: LinkNetlink, + _LinkTypeLowerName[434:441]: LinkNetlink, + _LinkTypeName[441:448]: Link6Lowpan, + _LinkTypeLowerName[441:448]: Link6Lowpan, + _LinkTypeName[448:453]: LinkNone, + _LinkTypeLowerName[448:453]: LinkNone, + _LinkTypeName[453:457]: LinkVoid, + _LinkTypeLowerName[453:457]: LinkVoid, +} + +var _LinkTypeNames = []string{ + _LinkTypeName[0:6], + _LinkTypeName[6:11], + _LinkTypeName[11:17], + _LinkTypeName[17:21], + _LinkTypeName[21:27], + _LinkTypeName[27:32], + _LinkTypeName[32:39], + _LinkTypeName[39:45], + _LinkTypeName[45:50], + _LinkTypeName[50:54], + _LinkTypeName[54:57], + _LinkTypeName[57:65], + _LinkTypeName[65:73], + _LinkTypeName[73:78], + _LinkTypeName[78:88], + _LinkTypeName[88:92], + _LinkTypeName[92:97], + _LinkTypeName[97:102], + _LinkTypeName[102:108], + _LinkTypeName[108:113], + _LinkTypeName[113:118], + _LinkTypeName[118:122], + _LinkTypeName[122:125], + _LinkTypeName[125:130], + _LinkTypeName[130:133], + _LinkTypeName[133:136], + _LinkTypeName[136:141], + _LinkTypeName[141:145], + _LinkTypeName[145:150], + _LinkTypeName[150:157], + _LinkTypeName[157:161], + _LinkTypeName[161:168], + _LinkTypeName[168:172], + _LinkTypeName[172:176], + _LinkTypeName[176:184], + _LinkTypeName[184:192], + _LinkTypeName[192:196], + _LinkTypeName[196:199], + _LinkTypeName[199:202], + _LinkTypeName[202:208], + _LinkTypeName[208:211], + _LinkTypeName[211:217], + _LinkTypeName[217:222], + _LinkTypeName[222:225], + _LinkTypeName[225:231], + _LinkTypeName[231:235], + _LinkTypeName[235:239], + _LinkTypeName[239:243], + _LinkTypeName[243:247], + _LinkTypeName[247:253], + _LinkTypeName[253:259], + _LinkTypeName[259:265], + _LinkTypeName[265:271], + _LinkTypeName[271:277], + _LinkTypeName[277:283], + _LinkTypeName[283:289], + _LinkTypeName[289:295], + _LinkTypeName[295:301], + _LinkTypeName[301:307], + _LinkTypeName[307:314], + _LinkTypeName[314:321], + _LinkTypeName[321:328], + _LinkTypeName[328:330], + _LinkTypeName[330:340], + _LinkTypeName[340:356], + _LinkTypeName[356:375], + _LinkTypeName[375:387], + _LinkTypeName[387:407], + _LinkTypeName[407:413], + _LinkTypeName[413:424], + _LinkTypeName[424:428], + _LinkTypeName[428:434], + _LinkTypeName[434:441], + _LinkTypeName[441:448], + _LinkTypeName[448:453], + _LinkTypeName[453:457], } // LinkTypeString retrieves an enum value from the enum constants string name. @@ -181,6 +420,10 @@ func LinkTypeString(s string) (LinkType, error) { if val, ok := _LinkTypeNameToValueMap[s]; ok { return val, nil } + + if val, ok := _LinkTypeNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to LinkType values", s) } @@ -189,6 +432,13 @@ func LinkTypeValues() []LinkType { return _LinkTypeValues } +// LinkTypeStrings returns a slice of all String values of the enum +func LinkTypeStrings() []string { + strs := make([]string, len(_LinkTypeNames)) + copy(strs, _LinkTypeNames) + return strs +} + // IsALinkType returns "true" if the value is listed in the enum definition. "false" otherwise func (i LinkType) IsALinkType() bool { _, ok := _LinkTypeMap[i] diff --git a/pkg/machinery/nethelpers/matchoperator_enumer.go b/pkg/machinery/nethelpers/matchoperator_enumer.go index 4f65d1c565..d4598acb16 100644 --- a/pkg/machinery/nethelpers/matchoperator_enumer.go +++ b/pkg/machinery/nethelpers/matchoperator_enumer.go @@ -4,12 +4,15 @@ package nethelpers import ( "fmt" + "strings" ) const _MatchOperatorName = "==!=" var _MatchOperatorIndex = [...]uint8{0, 2, 4} +const _MatchOperatorLowerName = "==!=" + func (i MatchOperator) String() string { if i < 0 || i >= MatchOperator(len(_MatchOperatorIndex)-1) { return fmt.Sprintf("MatchOperator(%d)", i) @@ -17,11 +20,26 @@ func (i MatchOperator) String() string { return _MatchOperatorName[_MatchOperatorIndex[i]:_MatchOperatorIndex[i+1]] } -var _MatchOperatorValues = []MatchOperator{0, 1} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _MatchOperatorNoOp() { + var x [1]struct{} + _ = x[OperatorEqual-(0)] + _ = x[OperatorNotEqual-(1)] +} + +var _MatchOperatorValues = []MatchOperator{OperatorEqual, OperatorNotEqual} var _MatchOperatorNameToValueMap = map[string]MatchOperator{ - _MatchOperatorName[0:2]: 0, - _MatchOperatorName[2:4]: 1, + _MatchOperatorName[0:2]: OperatorEqual, + _MatchOperatorLowerName[0:2]: OperatorEqual, + _MatchOperatorName[2:4]: OperatorNotEqual, + _MatchOperatorLowerName[2:4]: OperatorNotEqual, +} + +var _MatchOperatorNames = []string{ + _MatchOperatorName[0:2], + _MatchOperatorName[2:4], } // MatchOperatorString retrieves an enum value from the enum constants string name. @@ -30,6 +48,10 @@ func MatchOperatorString(s string) (MatchOperator, error) { if val, ok := _MatchOperatorNameToValueMap[s]; ok { return val, nil } + + if val, ok := _MatchOperatorNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to MatchOperator values", s) } @@ -38,6 +60,13 @@ func MatchOperatorValues() []MatchOperator { return _MatchOperatorValues } +// MatchOperatorStrings returns a slice of all String values of the enum +func MatchOperatorStrings() []string { + strs := make([]string, len(_MatchOperatorNames)) + copy(strs, _MatchOperatorNames) + return strs +} + // IsAMatchOperator returns "true" if the value is listed in the enum definition. "false" otherwise func (i MatchOperator) IsAMatchOperator() bool { for _, v := range _MatchOperatorValues { diff --git a/pkg/machinery/nethelpers/nftableschainhook_enumer.go b/pkg/machinery/nethelpers/nftableschainhook_enumer.go index 9f3f5d7e6f..0ddbf73f66 100644 --- a/pkg/machinery/nethelpers/nftableschainhook_enumer.go +++ b/pkg/machinery/nethelpers/nftableschainhook_enumer.go @@ -4,12 +4,15 @@ package nethelpers import ( "fmt" + "strings" ) const _NfTablesChainHookName = "preroutinginputforwardoutputpostrouting" var _NfTablesChainHookIndex = [...]uint8{0, 10, 15, 22, 28, 39} +const _NfTablesChainHookLowerName = "preroutinginputforwardoutputpostrouting" + func (i NfTablesChainHook) String() string { if i >= NfTablesChainHook(len(_NfTablesChainHookIndex)-1) { return fmt.Sprintf("NfTablesChainHook(%d)", i) @@ -17,14 +20,38 @@ func (i NfTablesChainHook) String() string { return _NfTablesChainHookName[_NfTablesChainHookIndex[i]:_NfTablesChainHookIndex[i+1]] } -var _NfTablesChainHookValues = []NfTablesChainHook{0, 1, 2, 3, 4} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _NfTablesChainHookNoOp() { + var x [1]struct{} + _ = x[ChainHookPrerouting-(0)] + _ = x[ChainHookInput-(1)] + _ = x[ChainHookForward-(2)] + _ = x[ChainHookOutput-(3)] + _ = x[ChainHookPostrouting-(4)] +} + +var _NfTablesChainHookValues = []NfTablesChainHook{ChainHookPrerouting, ChainHookInput, ChainHookForward, ChainHookOutput, ChainHookPostrouting} var _NfTablesChainHookNameToValueMap = map[string]NfTablesChainHook{ - _NfTablesChainHookName[0:10]: 0, - _NfTablesChainHookName[10:15]: 1, - _NfTablesChainHookName[15:22]: 2, - _NfTablesChainHookName[22:28]: 3, - _NfTablesChainHookName[28:39]: 4, + _NfTablesChainHookName[0:10]: ChainHookPrerouting, + _NfTablesChainHookLowerName[0:10]: ChainHookPrerouting, + _NfTablesChainHookName[10:15]: ChainHookInput, + _NfTablesChainHookLowerName[10:15]: ChainHookInput, + _NfTablesChainHookName[15:22]: ChainHookForward, + _NfTablesChainHookLowerName[15:22]: ChainHookForward, + _NfTablesChainHookName[22:28]: ChainHookOutput, + _NfTablesChainHookLowerName[22:28]: ChainHookOutput, + _NfTablesChainHookName[28:39]: ChainHookPostrouting, + _NfTablesChainHookLowerName[28:39]: ChainHookPostrouting, +} + +var _NfTablesChainHookNames = []string{ + _NfTablesChainHookName[0:10], + _NfTablesChainHookName[10:15], + _NfTablesChainHookName[15:22], + _NfTablesChainHookName[22:28], + _NfTablesChainHookName[28:39], } // NfTablesChainHookString retrieves an enum value from the enum constants string name. @@ -33,6 +60,10 @@ func NfTablesChainHookString(s string) (NfTablesChainHook, error) { if val, ok := _NfTablesChainHookNameToValueMap[s]; ok { return val, nil } + + if val, ok := _NfTablesChainHookNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to NfTablesChainHook values", s) } @@ -41,6 +72,13 @@ func NfTablesChainHookValues() []NfTablesChainHook { return _NfTablesChainHookValues } +// NfTablesChainHookStrings returns a slice of all String values of the enum +func NfTablesChainHookStrings() []string { + strs := make([]string, len(_NfTablesChainHookNames)) + copy(strs, _NfTablesChainHookNames) + return strs +} + // IsANfTablesChainHook returns "true" if the value is listed in the enum definition. "false" otherwise func (i NfTablesChainHook) IsANfTablesChainHook() bool { for _, v := range _NfTablesChainHookValues { diff --git a/pkg/machinery/nethelpers/nftableschainpriority_enumer.go b/pkg/machinery/nethelpers/nftableschainpriority_enumer.go index 445ef3d5dc..e0e8aeffba 100644 --- a/pkg/machinery/nethelpers/nftableschainpriority_enumer.go +++ b/pkg/machinery/nethelpers/nftableschainpriority_enumer.go @@ -4,9 +4,11 @@ package nethelpers import ( "fmt" + "strings" ) const _NfTablesChainPriorityName = "firstconntrack-defragrawselinux-firstconntrackmanglenat-destfiltersecuritynat-sourceselinux-lastconntrack-helperlast" +const _NfTablesChainPriorityLowerName = "firstconntrack-defragrawselinux-firstconntrackmanglenat-destfiltersecuritynat-sourceselinux-lastconntrack-helperlast" var _NfTablesChainPriorityMap = map[NfTablesChainPriority]string{ -2147483648: _NfTablesChainPriorityName[0:5], @@ -31,22 +33,70 @@ func (i NfTablesChainPriority) String() string { return fmt.Sprintf("NfTablesChainPriority(%d)", i) } -var _NfTablesChainPriorityValues = []NfTablesChainPriority{-2147483648, -400, -300, -225, -200, -150, -100, 0, 50, 100, 225, 300, 2147483647} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _NfTablesChainPriorityNoOp() { + var x [1]struct{} + _ = x[ChainPriorityFirst-(-2147483648)] + _ = x[ChainPriorityConntrackDefrag-(-400)] + _ = x[ChainPriorityRaw-(-300)] + _ = x[ChainPrioritySELinuxFirst-(-225)] + _ = x[ChainPriorityConntrack-(-200)] + _ = x[ChainPriorityMangle-(-150)] + _ = x[ChainPriorityNATDest-(-100)] + _ = x[ChainPriorityFilter-(0)] + _ = x[ChainPrioritySecurity-(50)] + _ = x[ChainPriorityNATSource-(100)] + _ = x[ChainPrioritySELinuxLast-(225)] + _ = x[ChainPriorityConntrackHelper-(300)] + _ = x[ChainPriorityLast-(2147483647)] +} + +var _NfTablesChainPriorityValues = []NfTablesChainPriority{ChainPriorityFirst, ChainPriorityConntrackDefrag, ChainPriorityRaw, ChainPrioritySELinuxFirst, ChainPriorityConntrack, ChainPriorityMangle, ChainPriorityNATDest, ChainPriorityFilter, ChainPrioritySecurity, ChainPriorityNATSource, ChainPrioritySELinuxLast, ChainPriorityConntrackHelper, ChainPriorityLast} var _NfTablesChainPriorityNameToValueMap = map[string]NfTablesChainPriority{ - _NfTablesChainPriorityName[0:5]: -2147483648, - _NfTablesChainPriorityName[5:21]: -400, - _NfTablesChainPriorityName[21:24]: -300, - _NfTablesChainPriorityName[24:37]: -225, - _NfTablesChainPriorityName[37:46]: -200, - _NfTablesChainPriorityName[46:52]: -150, - _NfTablesChainPriorityName[52:60]: -100, - _NfTablesChainPriorityName[60:66]: 0, - _NfTablesChainPriorityName[66:74]: 50, - _NfTablesChainPriorityName[74:84]: 100, - _NfTablesChainPriorityName[84:96]: 225, - _NfTablesChainPriorityName[96:112]: 300, - _NfTablesChainPriorityName[112:116]: 2147483647, + _NfTablesChainPriorityName[0:5]: ChainPriorityFirst, + _NfTablesChainPriorityLowerName[0:5]: ChainPriorityFirst, + _NfTablesChainPriorityName[5:21]: ChainPriorityConntrackDefrag, + _NfTablesChainPriorityLowerName[5:21]: ChainPriorityConntrackDefrag, + _NfTablesChainPriorityName[21:24]: ChainPriorityRaw, + _NfTablesChainPriorityLowerName[21:24]: ChainPriorityRaw, + _NfTablesChainPriorityName[24:37]: ChainPrioritySELinuxFirst, + _NfTablesChainPriorityLowerName[24:37]: ChainPrioritySELinuxFirst, + _NfTablesChainPriorityName[37:46]: ChainPriorityConntrack, + _NfTablesChainPriorityLowerName[37:46]: ChainPriorityConntrack, + _NfTablesChainPriorityName[46:52]: ChainPriorityMangle, + _NfTablesChainPriorityLowerName[46:52]: ChainPriorityMangle, + _NfTablesChainPriorityName[52:60]: ChainPriorityNATDest, + _NfTablesChainPriorityLowerName[52:60]: ChainPriorityNATDest, + _NfTablesChainPriorityName[60:66]: ChainPriorityFilter, + _NfTablesChainPriorityLowerName[60:66]: ChainPriorityFilter, + _NfTablesChainPriorityName[66:74]: ChainPrioritySecurity, + _NfTablesChainPriorityLowerName[66:74]: ChainPrioritySecurity, + _NfTablesChainPriorityName[74:84]: ChainPriorityNATSource, + _NfTablesChainPriorityLowerName[74:84]: ChainPriorityNATSource, + _NfTablesChainPriorityName[84:96]: ChainPrioritySELinuxLast, + _NfTablesChainPriorityLowerName[84:96]: ChainPrioritySELinuxLast, + _NfTablesChainPriorityName[96:112]: ChainPriorityConntrackHelper, + _NfTablesChainPriorityLowerName[96:112]: ChainPriorityConntrackHelper, + _NfTablesChainPriorityName[112:116]: ChainPriorityLast, + _NfTablesChainPriorityLowerName[112:116]: ChainPriorityLast, +} + +var _NfTablesChainPriorityNames = []string{ + _NfTablesChainPriorityName[0:5], + _NfTablesChainPriorityName[5:21], + _NfTablesChainPriorityName[21:24], + _NfTablesChainPriorityName[24:37], + _NfTablesChainPriorityName[37:46], + _NfTablesChainPriorityName[46:52], + _NfTablesChainPriorityName[52:60], + _NfTablesChainPriorityName[60:66], + _NfTablesChainPriorityName[66:74], + _NfTablesChainPriorityName[74:84], + _NfTablesChainPriorityName[84:96], + _NfTablesChainPriorityName[96:112], + _NfTablesChainPriorityName[112:116], } // NfTablesChainPriorityString retrieves an enum value from the enum constants string name. @@ -55,6 +105,10 @@ func NfTablesChainPriorityString(s string) (NfTablesChainPriority, error) { if val, ok := _NfTablesChainPriorityNameToValueMap[s]; ok { return val, nil } + + if val, ok := _NfTablesChainPriorityNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to NfTablesChainPriority values", s) } @@ -63,6 +117,13 @@ func NfTablesChainPriorityValues() []NfTablesChainPriority { return _NfTablesChainPriorityValues } +// NfTablesChainPriorityStrings returns a slice of all String values of the enum +func NfTablesChainPriorityStrings() []string { + strs := make([]string, len(_NfTablesChainPriorityNames)) + copy(strs, _NfTablesChainPriorityNames) + return strs +} + // IsANfTablesChainPriority returns "true" if the value is listed in the enum definition. "false" otherwise func (i NfTablesChainPriority) IsANfTablesChainPriority() bool { _, ok := _NfTablesChainPriorityMap[i] diff --git a/pkg/machinery/nethelpers/nftablesverdict_enumer.go b/pkg/machinery/nethelpers/nftablesverdict_enumer.go index bd69af0df5..ca80341b9c 100644 --- a/pkg/machinery/nethelpers/nftablesverdict_enumer.go +++ b/pkg/machinery/nethelpers/nftablesverdict_enumer.go @@ -4,12 +4,15 @@ package nethelpers import ( "fmt" + "strings" ) const _NfTablesVerdictName = "dropaccept" var _NfTablesVerdictIndex = [...]uint8{0, 4, 10} +const _NfTablesVerdictLowerName = "dropaccept" + func (i NfTablesVerdict) String() string { if i < 0 || i >= NfTablesVerdict(len(_NfTablesVerdictIndex)-1) { return fmt.Sprintf("NfTablesVerdict(%d)", i) @@ -17,11 +20,26 @@ func (i NfTablesVerdict) String() string { return _NfTablesVerdictName[_NfTablesVerdictIndex[i]:_NfTablesVerdictIndex[i+1]] } -var _NfTablesVerdictValues = []NfTablesVerdict{0, 1} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _NfTablesVerdictNoOp() { + var x [1]struct{} + _ = x[VerdictDrop-(0)] + _ = x[VerdictAccept-(1)] +} + +var _NfTablesVerdictValues = []NfTablesVerdict{VerdictDrop, VerdictAccept} var _NfTablesVerdictNameToValueMap = map[string]NfTablesVerdict{ - _NfTablesVerdictName[0:4]: 0, - _NfTablesVerdictName[4:10]: 1, + _NfTablesVerdictName[0:4]: VerdictDrop, + _NfTablesVerdictLowerName[0:4]: VerdictDrop, + _NfTablesVerdictName[4:10]: VerdictAccept, + _NfTablesVerdictLowerName[4:10]: VerdictAccept, +} + +var _NfTablesVerdictNames = []string{ + _NfTablesVerdictName[0:4], + _NfTablesVerdictName[4:10], } // NfTablesVerdictString retrieves an enum value from the enum constants string name. @@ -30,6 +48,10 @@ func NfTablesVerdictString(s string) (NfTablesVerdict, error) { if val, ok := _NfTablesVerdictNameToValueMap[s]; ok { return val, nil } + + if val, ok := _NfTablesVerdictNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to NfTablesVerdict values", s) } @@ -38,6 +60,13 @@ func NfTablesVerdictValues() []NfTablesVerdict { return _NfTablesVerdictValues } +// NfTablesVerdictStrings returns a slice of all String values of the enum +func NfTablesVerdictStrings() []string { + strs := make([]string, len(_NfTablesVerdictNames)) + copy(strs, _NfTablesVerdictNames) + return strs +} + // IsANfTablesVerdict returns "true" if the value is listed in the enum definition. "false" otherwise func (i NfTablesVerdict) IsANfTablesVerdict() bool { for _, v := range _NfTablesVerdictValues { diff --git a/pkg/machinery/nethelpers/operationalstate_enumer.go b/pkg/machinery/nethelpers/operationalstate_enumer.go index b919872c3c..fadfaf1f1f 100644 --- a/pkg/machinery/nethelpers/operationalstate_enumer.go +++ b/pkg/machinery/nethelpers/operationalstate_enumer.go @@ -4,12 +4,15 @@ package nethelpers import ( "fmt" + "strings" ) const _OperationalStateName = "unknownnotPresentdownlowerLayerDowntestingdormantup" var _OperationalStateIndex = [...]uint8{0, 7, 17, 21, 35, 42, 49, 51} +const _OperationalStateLowerName = "unknownnotpresentdownlowerlayerdowntestingdormantup" + func (i OperationalState) String() string { if i >= OperationalState(len(_OperationalStateIndex)-1) { return fmt.Sprintf("OperationalState(%d)", i) @@ -17,16 +20,46 @@ func (i OperationalState) String() string { return _OperationalStateName[_OperationalStateIndex[i]:_OperationalStateIndex[i+1]] } -var _OperationalStateValues = []OperationalState{0, 1, 2, 3, 4, 5, 6} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _OperationalStateNoOp() { + var x [1]struct{} + _ = x[OperStateUnknown-(0)] + _ = x[OperStateNotPresent-(1)] + _ = x[OperStateDown-(2)] + _ = x[OperStateLowerLayerDown-(3)] + _ = x[OperStateTesting-(4)] + _ = x[OperStateDormant-(5)] + _ = x[OperStateUp-(6)] +} + +var _OperationalStateValues = []OperationalState{OperStateUnknown, OperStateNotPresent, OperStateDown, OperStateLowerLayerDown, OperStateTesting, OperStateDormant, OperStateUp} var _OperationalStateNameToValueMap = map[string]OperationalState{ - _OperationalStateName[0:7]: 0, - _OperationalStateName[7:17]: 1, - _OperationalStateName[17:21]: 2, - _OperationalStateName[21:35]: 3, - _OperationalStateName[35:42]: 4, - _OperationalStateName[42:49]: 5, - _OperationalStateName[49:51]: 6, + _OperationalStateName[0:7]: OperStateUnknown, + _OperationalStateLowerName[0:7]: OperStateUnknown, + _OperationalStateName[7:17]: OperStateNotPresent, + _OperationalStateLowerName[7:17]: OperStateNotPresent, + _OperationalStateName[17:21]: OperStateDown, + _OperationalStateLowerName[17:21]: OperStateDown, + _OperationalStateName[21:35]: OperStateLowerLayerDown, + _OperationalStateLowerName[21:35]: OperStateLowerLayerDown, + _OperationalStateName[35:42]: OperStateTesting, + _OperationalStateLowerName[35:42]: OperStateTesting, + _OperationalStateName[42:49]: OperStateDormant, + _OperationalStateLowerName[42:49]: OperStateDormant, + _OperationalStateName[49:51]: OperStateUp, + _OperationalStateLowerName[49:51]: OperStateUp, +} + +var _OperationalStateNames = []string{ + _OperationalStateName[0:7], + _OperationalStateName[7:17], + _OperationalStateName[17:21], + _OperationalStateName[21:35], + _OperationalStateName[35:42], + _OperationalStateName[42:49], + _OperationalStateName[49:51], } // OperationalStateString retrieves an enum value from the enum constants string name. @@ -35,6 +68,10 @@ func OperationalStateString(s string) (OperationalState, error) { if val, ok := _OperationalStateNameToValueMap[s]; ok { return val, nil } + + if val, ok := _OperationalStateNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to OperationalState values", s) } @@ -43,6 +80,13 @@ func OperationalStateValues() []OperationalState { return _OperationalStateValues } +// OperationalStateStrings returns a slice of all String values of the enum +func OperationalStateStrings() []string { + strs := make([]string, len(_OperationalStateNames)) + copy(strs, _OperationalStateNames) + return strs +} + // IsAOperationalState returns "true" if the value is listed in the enum definition. "false" otherwise func (i OperationalState) IsAOperationalState() bool { for _, v := range _OperationalStateValues { diff --git a/pkg/machinery/nethelpers/port_enumer.go b/pkg/machinery/nethelpers/port_enumer.go index 093fe987d5..dd469e30db 100644 --- a/pkg/machinery/nethelpers/port_enumer.go +++ b/pkg/machinery/nethelpers/port_enumer.go @@ -4,12 +4,16 @@ package nethelpers import ( "fmt" + "strings" ) const ( - _PortName_0 = "TwistedPairAUIMIIFibreBNCDirectAttach" - _PortName_1 = "None" - _PortName_2 = "Other" + _PortName_0 = "TwistedPairAUIMIIFibreBNCDirectAttach" + _PortLowerName_0 = "twistedpairauimiifibrebncdirectattach" + _PortName_1 = "None" + _PortLowerName_1 = "none" + _PortName_2 = "Other" + _PortLowerName_2 = "other" ) var ( @@ -31,17 +35,50 @@ func (i Port) String() string { } } -var _PortValues = []Port{0, 1, 2, 3, 4, 5, 239, 255} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _PortNoOp() { + var x [1]struct{} + _ = x[TwistedPair-(0)] + _ = x[AUI-(1)] + _ = x[MII-(2)] + _ = x[Fibre-(3)] + _ = x[BNC-(4)] + _ = x[DirectAttach-(5)] + _ = x[None-(239)] + _ = x[Other-(255)] +} + +var _PortValues = []Port{TwistedPair, AUI, MII, Fibre, BNC, DirectAttach, None, Other} var _PortNameToValueMap = map[string]Port{ - _PortName_0[0:11]: 0, - _PortName_0[11:14]: 1, - _PortName_0[14:17]: 2, - _PortName_0[17:22]: 3, - _PortName_0[22:25]: 4, - _PortName_0[25:37]: 5, - _PortName_1[0:4]: 239, - _PortName_2[0:5]: 255, + _PortName_0[0:11]: TwistedPair, + _PortLowerName_0[0:11]: TwistedPair, + _PortName_0[11:14]: AUI, + _PortLowerName_0[11:14]: AUI, + _PortName_0[14:17]: MII, + _PortLowerName_0[14:17]: MII, + _PortName_0[17:22]: Fibre, + _PortLowerName_0[17:22]: Fibre, + _PortName_0[22:25]: BNC, + _PortLowerName_0[22:25]: BNC, + _PortName_0[25:37]: DirectAttach, + _PortLowerName_0[25:37]: DirectAttach, + _PortName_1[0:4]: None, + _PortLowerName_1[0:4]: None, + _PortName_2[0:5]: Other, + _PortLowerName_2[0:5]: Other, +} + +var _PortNames = []string{ + _PortName_0[0:11], + _PortName_0[11:14], + _PortName_0[14:17], + _PortName_0[17:22], + _PortName_0[22:25], + _PortName_0[25:37], + _PortName_1[0:4], + _PortName_2[0:5], } // PortString retrieves an enum value from the enum constants string name. @@ -50,6 +87,10 @@ func PortString(s string) (Port, error) { if val, ok := _PortNameToValueMap[s]; ok { return val, nil } + + if val, ok := _PortNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to Port values", s) } @@ -58,6 +99,13 @@ func PortValues() []Port { return _PortValues } +// PortStrings returns a slice of all String values of the enum +func PortStrings() []string { + strs := make([]string, len(_PortNames)) + copy(strs, _PortNames) + return strs +} + // IsAPort returns "true" if the value is listed in the enum definition. "false" otherwise func (i Port) IsAPort() bool { for _, v := range _PortValues { diff --git a/pkg/machinery/nethelpers/primaryreselect_enumer.go b/pkg/machinery/nethelpers/primaryreselect_enumer.go index f60ed016b6..8d80eaec56 100644 --- a/pkg/machinery/nethelpers/primaryreselect_enumer.go +++ b/pkg/machinery/nethelpers/primaryreselect_enumer.go @@ -4,12 +4,15 @@ package nethelpers import ( "fmt" + "strings" ) const _PrimaryReselectName = "alwaysbetterfailure" var _PrimaryReselectIndex = [...]uint8{0, 6, 12, 19} +const _PrimaryReselectLowerName = "alwaysbetterfailure" + func (i PrimaryReselect) String() string { if i >= PrimaryReselect(len(_PrimaryReselectIndex)-1) { return fmt.Sprintf("PrimaryReselect(%d)", i) @@ -17,12 +20,30 @@ func (i PrimaryReselect) String() string { return _PrimaryReselectName[_PrimaryReselectIndex[i]:_PrimaryReselectIndex[i+1]] } -var _PrimaryReselectValues = []PrimaryReselect{0, 1, 2} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _PrimaryReselectNoOp() { + var x [1]struct{} + _ = x[PrimaryReselectAlways-(0)] + _ = x[PrimaryReselectBetter-(1)] + _ = x[PrimaryReselectFailure-(2)] +} + +var _PrimaryReselectValues = []PrimaryReselect{PrimaryReselectAlways, PrimaryReselectBetter, PrimaryReselectFailure} var _PrimaryReselectNameToValueMap = map[string]PrimaryReselect{ - _PrimaryReselectName[0:6]: 0, - _PrimaryReselectName[6:12]: 1, - _PrimaryReselectName[12:19]: 2, + _PrimaryReselectName[0:6]: PrimaryReselectAlways, + _PrimaryReselectLowerName[0:6]: PrimaryReselectAlways, + _PrimaryReselectName[6:12]: PrimaryReselectBetter, + _PrimaryReselectLowerName[6:12]: PrimaryReselectBetter, + _PrimaryReselectName[12:19]: PrimaryReselectFailure, + _PrimaryReselectLowerName[12:19]: PrimaryReselectFailure, +} + +var _PrimaryReselectNames = []string{ + _PrimaryReselectName[0:6], + _PrimaryReselectName[6:12], + _PrimaryReselectName[12:19], } // PrimaryReselectString retrieves an enum value from the enum constants string name. @@ -31,6 +52,10 @@ func PrimaryReselectString(s string) (PrimaryReselect, error) { if val, ok := _PrimaryReselectNameToValueMap[s]; ok { return val, nil } + + if val, ok := _PrimaryReselectNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to PrimaryReselect values", s) } @@ -39,6 +64,13 @@ func PrimaryReselectValues() []PrimaryReselect { return _PrimaryReselectValues } +// PrimaryReselectStrings returns a slice of all String values of the enum +func PrimaryReselectStrings() []string { + strs := make([]string, len(_PrimaryReselectNames)) + copy(strs, _PrimaryReselectNames) + return strs +} + // IsAPrimaryReselect returns "true" if the value is listed in the enum definition. "false" otherwise func (i PrimaryReselect) IsAPrimaryReselect() bool { for _, v := range _PrimaryReselectValues { diff --git a/pkg/machinery/nethelpers/protocol_enumer.go b/pkg/machinery/nethelpers/protocol_enumer.go index 28c63b4af9..c376dfe651 100644 --- a/pkg/machinery/nethelpers/protocol_enumer.go +++ b/pkg/machinery/nethelpers/protocol_enumer.go @@ -4,13 +4,18 @@ package nethelpers import ( "fmt" + "strings" ) const ( - _ProtocolName_0 = "icmp" - _ProtocolName_1 = "tcp" - _ProtocolName_2 = "udp" - _ProtocolName_3 = "icmpv6" + _ProtocolName_0 = "icmp" + _ProtocolLowerName_0 = "icmp" + _ProtocolName_1 = "tcp" + _ProtocolLowerName_1 = "tcp" + _ProtocolName_2 = "udp" + _ProtocolLowerName_2 = "udp" + _ProtocolName_3 = "icmpv6" + _ProtocolLowerName_3 = "icmpv6" ) var ( @@ -35,13 +40,34 @@ func (i Protocol) String() string { } } -var _ProtocolValues = []Protocol{1, 6, 17, 58} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _ProtocolNoOp() { + var x [1]struct{} + _ = x[ProtocolICMP-(1)] + _ = x[ProtocolTCP-(6)] + _ = x[ProtocolUDP-(17)] + _ = x[ProtocolICMPv6-(58)] +} + +var _ProtocolValues = []Protocol{ProtocolICMP, ProtocolTCP, ProtocolUDP, ProtocolICMPv6} var _ProtocolNameToValueMap = map[string]Protocol{ - _ProtocolName_0[0:4]: 1, - _ProtocolName_1[0:3]: 6, - _ProtocolName_2[0:3]: 17, - _ProtocolName_3[0:6]: 58, + _ProtocolName_0[0:4]: ProtocolICMP, + _ProtocolLowerName_0[0:4]: ProtocolICMP, + _ProtocolName_1[0:3]: ProtocolTCP, + _ProtocolLowerName_1[0:3]: ProtocolTCP, + _ProtocolName_2[0:3]: ProtocolUDP, + _ProtocolLowerName_2[0:3]: ProtocolUDP, + _ProtocolName_3[0:6]: ProtocolICMPv6, + _ProtocolLowerName_3[0:6]: ProtocolICMPv6, +} + +var _ProtocolNames = []string{ + _ProtocolName_0[0:4], + _ProtocolName_1[0:3], + _ProtocolName_2[0:3], + _ProtocolName_3[0:6], } // ProtocolString retrieves an enum value from the enum constants string name. @@ -50,6 +76,10 @@ func ProtocolString(s string) (Protocol, error) { if val, ok := _ProtocolNameToValueMap[s]; ok { return val, nil } + + if val, ok := _ProtocolNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to Protocol values", s) } @@ -58,6 +88,13 @@ func ProtocolValues() []Protocol { return _ProtocolValues } +// ProtocolStrings returns a slice of all String values of the enum +func ProtocolStrings() []string { + strs := make([]string, len(_ProtocolNames)) + copy(strs, _ProtocolNames) + return strs +} + // IsAProtocol returns "true" if the value is listed in the enum definition. "false" otherwise func (i Protocol) IsAProtocol() bool { for _, v := range _ProtocolValues { diff --git a/pkg/machinery/nethelpers/routeflag_enumer.go b/pkg/machinery/nethelpers/routeflag_enumer.go index 89cfcf6c9f..b59af955e5 100644 --- a/pkg/machinery/nethelpers/routeflag_enumer.go +++ b/pkg/machinery/nethelpers/routeflag_enumer.go @@ -4,17 +4,26 @@ package nethelpers import ( "fmt" + "strings" ) const ( - _RouteFlagName_0 = "notify" - _RouteFlagName_1 = "cloned" - _RouteFlagName_2 = "equalize" - _RouteFlagName_3 = "prefix" - _RouteFlagName_4 = "lookup_table" - _RouteFlagName_5 = "fib_match" - _RouteFlagName_6 = "offload" - _RouteFlagName_7 = "trap" + _RouteFlagName_0 = "notify" + _RouteFlagLowerName_0 = "notify" + _RouteFlagName_1 = "cloned" + _RouteFlagLowerName_1 = "cloned" + _RouteFlagName_2 = "equalize" + _RouteFlagLowerName_2 = "equalize" + _RouteFlagName_3 = "prefix" + _RouteFlagLowerName_3 = "prefix" + _RouteFlagName_4 = "lookup_table" + _RouteFlagLowerName_4 = "lookup_table" + _RouteFlagName_5 = "fib_match" + _RouteFlagLowerName_5 = "fib_match" + _RouteFlagName_6 = "offload" + _RouteFlagLowerName_6 = "offload" + _RouteFlagName_7 = "trap" + _RouteFlagLowerName_7 = "trap" ) var ( @@ -51,17 +60,50 @@ func (i RouteFlag) String() string { } } -var _RouteFlagValues = []RouteFlag{256, 512, 1024, 2048, 4096, 8192, 16384, 32768} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _RouteFlagNoOp() { + var x [1]struct{} + _ = x[RouteNotify-(256)] + _ = x[RouteCloned-(512)] + _ = x[RouteEqualize-(1024)] + _ = x[RoutePrefix-(2048)] + _ = x[RouteLookupTable-(4096)] + _ = x[RouteFIBMatch-(8192)] + _ = x[RouteOffload-(16384)] + _ = x[RouteTrap-(32768)] +} + +var _RouteFlagValues = []RouteFlag{RouteNotify, RouteCloned, RouteEqualize, RoutePrefix, RouteLookupTable, RouteFIBMatch, RouteOffload, RouteTrap} var _RouteFlagNameToValueMap = map[string]RouteFlag{ - _RouteFlagName_0[0:6]: 256, - _RouteFlagName_1[0:6]: 512, - _RouteFlagName_2[0:8]: 1024, - _RouteFlagName_3[0:6]: 2048, - _RouteFlagName_4[0:12]: 4096, - _RouteFlagName_5[0:9]: 8192, - _RouteFlagName_6[0:7]: 16384, - _RouteFlagName_7[0:4]: 32768, + _RouteFlagName_0[0:6]: RouteNotify, + _RouteFlagLowerName_0[0:6]: RouteNotify, + _RouteFlagName_1[0:6]: RouteCloned, + _RouteFlagLowerName_1[0:6]: RouteCloned, + _RouteFlagName_2[0:8]: RouteEqualize, + _RouteFlagLowerName_2[0:8]: RouteEqualize, + _RouteFlagName_3[0:6]: RoutePrefix, + _RouteFlagLowerName_3[0:6]: RoutePrefix, + _RouteFlagName_4[0:12]: RouteLookupTable, + _RouteFlagLowerName_4[0:12]: RouteLookupTable, + _RouteFlagName_5[0:9]: RouteFIBMatch, + _RouteFlagLowerName_5[0:9]: RouteFIBMatch, + _RouteFlagName_6[0:7]: RouteOffload, + _RouteFlagLowerName_6[0:7]: RouteOffload, + _RouteFlagName_7[0:4]: RouteTrap, + _RouteFlagLowerName_7[0:4]: RouteTrap, +} + +var _RouteFlagNames = []string{ + _RouteFlagName_0[0:6], + _RouteFlagName_1[0:6], + _RouteFlagName_2[0:8], + _RouteFlagName_3[0:6], + _RouteFlagName_4[0:12], + _RouteFlagName_5[0:9], + _RouteFlagName_6[0:7], + _RouteFlagName_7[0:4], } // RouteFlagString retrieves an enum value from the enum constants string name. @@ -70,6 +112,10 @@ func RouteFlagString(s string) (RouteFlag, error) { if val, ok := _RouteFlagNameToValueMap[s]; ok { return val, nil } + + if val, ok := _RouteFlagNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to RouteFlag values", s) } @@ -78,6 +124,13 @@ func RouteFlagValues() []RouteFlag { return _RouteFlagValues } +// RouteFlagStrings returns a slice of all String values of the enum +func RouteFlagStrings() []string { + strs := make([]string, len(_RouteFlagNames)) + copy(strs, _RouteFlagNames) + return strs +} + // IsARouteFlag returns "true" if the value is listed in the enum definition. "false" otherwise func (i RouteFlag) IsARouteFlag() bool { for _, v := range _RouteFlagValues { diff --git a/pkg/machinery/nethelpers/routeprotocol_enumer.go b/pkg/machinery/nethelpers/routeprotocol_enumer.go index b920cdd511..7c16ff786d 100644 --- a/pkg/machinery/nethelpers/routeprotocol_enumer.go +++ b/pkg/machinery/nethelpers/routeprotocol_enumer.go @@ -4,15 +4,22 @@ package nethelpers import ( "fmt" + "strings" ) const ( - _RouteProtocolName_0 = "unspecredirectkernelbootstatic" - _RouteProtocolName_1 = "ramrtzebrabirddnroutedxorpntkdhcpmrtdkeepalived" - _RouteProtocolName_2 = "babel" - _RouteProtocolName_3 = "openr" - _RouteProtocolName_4 = "bgpisisospfrip" - _RouteProtocolName_5 = "eigrp" + _RouteProtocolName_0 = "unspecredirectkernelbootstatic" + _RouteProtocolLowerName_0 = "unspecredirectkernelbootstatic" + _RouteProtocolName_1 = "ramrtzebrabirddnroutedxorpntkdhcpmrtdkeepalived" + _RouteProtocolLowerName_1 = "ramrtzebrabirddnroutedxorpntkdhcpmrtdkeepalived" + _RouteProtocolName_2 = "babel" + _RouteProtocolLowerName_2 = "babel" + _RouteProtocolName_3 = "openr" + _RouteProtocolLowerName_3 = "openr" + _RouteProtocolName_4 = "bgpisisospfrip" + _RouteProtocolLowerName_4 = "bgpisisospfrip" + _RouteProtocolName_5 = "eigrp" + _RouteProtocolLowerName_5 = "eigrp" ) var ( @@ -45,31 +52,106 @@ func (i RouteProtocol) String() string { } } -var _RouteProtocolValues = []RouteProtocol{0, 1, 2, 3, 4, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 42, 99, 186, 187, 188, 189, 192} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _RouteProtocolNoOp() { + var x [1]struct{} + _ = x[ProtocolUnspec-(0)] + _ = x[ProtocolRedirect-(1)] + _ = x[ProtocolKernel-(2)] + _ = x[ProtocolBoot-(3)] + _ = x[ProtocolStatic-(4)] + _ = x[ProtocolRA-(9)] + _ = x[ProtocolMRT-(10)] + _ = x[ProtocolZebra-(11)] + _ = x[ProtocolBird-(12)] + _ = x[ProtocolDnrouted-(13)] + _ = x[ProtocolXorp-(14)] + _ = x[ProtocolNTK-(15)] + _ = x[ProtocolDHCP-(16)] + _ = x[ProtocolMRTD-(17)] + _ = x[ProtocolKeepalived-(18)] + _ = x[ProtocolBabel-(42)] + _ = x[ProtocolOpenr-(99)] + _ = x[ProtocolBGP-(186)] + _ = x[ProtocolISIS-(187)] + _ = x[ProtocolOSPF-(188)] + _ = x[ProtocolRIP-(189)] + _ = x[ProtocolEIGRP-(192)] +} + +var _RouteProtocolValues = []RouteProtocol{ProtocolUnspec, ProtocolRedirect, ProtocolKernel, ProtocolBoot, ProtocolStatic, ProtocolRA, ProtocolMRT, ProtocolZebra, ProtocolBird, ProtocolDnrouted, ProtocolXorp, ProtocolNTK, ProtocolDHCP, ProtocolMRTD, ProtocolKeepalived, ProtocolBabel, ProtocolOpenr, ProtocolBGP, ProtocolISIS, ProtocolOSPF, ProtocolRIP, ProtocolEIGRP} var _RouteProtocolNameToValueMap = map[string]RouteProtocol{ - _RouteProtocolName_0[0:6]: 0, - _RouteProtocolName_0[6:14]: 1, - _RouteProtocolName_0[14:20]: 2, - _RouteProtocolName_0[20:24]: 3, - _RouteProtocolName_0[24:30]: 4, - _RouteProtocolName_1[0:2]: 9, - _RouteProtocolName_1[2:5]: 10, - _RouteProtocolName_1[5:10]: 11, - _RouteProtocolName_1[10:14]: 12, - _RouteProtocolName_1[14:22]: 13, - _RouteProtocolName_1[22:26]: 14, - _RouteProtocolName_1[26:29]: 15, - _RouteProtocolName_1[29:33]: 16, - _RouteProtocolName_1[33:37]: 17, - _RouteProtocolName_1[37:47]: 18, - _RouteProtocolName_2[0:5]: 42, - _RouteProtocolName_3[0:5]: 99, - _RouteProtocolName_4[0:3]: 186, - _RouteProtocolName_4[3:7]: 187, - _RouteProtocolName_4[7:11]: 188, - _RouteProtocolName_4[11:14]: 189, - _RouteProtocolName_5[0:5]: 192, + _RouteProtocolName_0[0:6]: ProtocolUnspec, + _RouteProtocolLowerName_0[0:6]: ProtocolUnspec, + _RouteProtocolName_0[6:14]: ProtocolRedirect, + _RouteProtocolLowerName_0[6:14]: ProtocolRedirect, + _RouteProtocolName_0[14:20]: ProtocolKernel, + _RouteProtocolLowerName_0[14:20]: ProtocolKernel, + _RouteProtocolName_0[20:24]: ProtocolBoot, + _RouteProtocolLowerName_0[20:24]: ProtocolBoot, + _RouteProtocolName_0[24:30]: ProtocolStatic, + _RouteProtocolLowerName_0[24:30]: ProtocolStatic, + _RouteProtocolName_1[0:2]: ProtocolRA, + _RouteProtocolLowerName_1[0:2]: ProtocolRA, + _RouteProtocolName_1[2:5]: ProtocolMRT, + _RouteProtocolLowerName_1[2:5]: ProtocolMRT, + _RouteProtocolName_1[5:10]: ProtocolZebra, + _RouteProtocolLowerName_1[5:10]: ProtocolZebra, + _RouteProtocolName_1[10:14]: ProtocolBird, + _RouteProtocolLowerName_1[10:14]: ProtocolBird, + _RouteProtocolName_1[14:22]: ProtocolDnrouted, + _RouteProtocolLowerName_1[14:22]: ProtocolDnrouted, + _RouteProtocolName_1[22:26]: ProtocolXorp, + _RouteProtocolLowerName_1[22:26]: ProtocolXorp, + _RouteProtocolName_1[26:29]: ProtocolNTK, + _RouteProtocolLowerName_1[26:29]: ProtocolNTK, + _RouteProtocolName_1[29:33]: ProtocolDHCP, + _RouteProtocolLowerName_1[29:33]: ProtocolDHCP, + _RouteProtocolName_1[33:37]: ProtocolMRTD, + _RouteProtocolLowerName_1[33:37]: ProtocolMRTD, + _RouteProtocolName_1[37:47]: ProtocolKeepalived, + _RouteProtocolLowerName_1[37:47]: ProtocolKeepalived, + _RouteProtocolName_2[0:5]: ProtocolBabel, + _RouteProtocolLowerName_2[0:5]: ProtocolBabel, + _RouteProtocolName_3[0:5]: ProtocolOpenr, + _RouteProtocolLowerName_3[0:5]: ProtocolOpenr, + _RouteProtocolName_4[0:3]: ProtocolBGP, + _RouteProtocolLowerName_4[0:3]: ProtocolBGP, + _RouteProtocolName_4[3:7]: ProtocolISIS, + _RouteProtocolLowerName_4[3:7]: ProtocolISIS, + _RouteProtocolName_4[7:11]: ProtocolOSPF, + _RouteProtocolLowerName_4[7:11]: ProtocolOSPF, + _RouteProtocolName_4[11:14]: ProtocolRIP, + _RouteProtocolLowerName_4[11:14]: ProtocolRIP, + _RouteProtocolName_5[0:5]: ProtocolEIGRP, + _RouteProtocolLowerName_5[0:5]: ProtocolEIGRP, +} + +var _RouteProtocolNames = []string{ + _RouteProtocolName_0[0:6], + _RouteProtocolName_0[6:14], + _RouteProtocolName_0[14:20], + _RouteProtocolName_0[20:24], + _RouteProtocolName_0[24:30], + _RouteProtocolName_1[0:2], + _RouteProtocolName_1[2:5], + _RouteProtocolName_1[5:10], + _RouteProtocolName_1[10:14], + _RouteProtocolName_1[14:22], + _RouteProtocolName_1[22:26], + _RouteProtocolName_1[26:29], + _RouteProtocolName_1[29:33], + _RouteProtocolName_1[33:37], + _RouteProtocolName_1[37:47], + _RouteProtocolName_2[0:5], + _RouteProtocolName_3[0:5], + _RouteProtocolName_4[0:3], + _RouteProtocolName_4[3:7], + _RouteProtocolName_4[7:11], + _RouteProtocolName_4[11:14], + _RouteProtocolName_5[0:5], } // RouteProtocolString retrieves an enum value from the enum constants string name. @@ -78,6 +160,10 @@ func RouteProtocolString(s string) (RouteProtocol, error) { if val, ok := _RouteProtocolNameToValueMap[s]; ok { return val, nil } + + if val, ok := _RouteProtocolNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to RouteProtocol values", s) } @@ -86,6 +172,13 @@ func RouteProtocolValues() []RouteProtocol { return _RouteProtocolValues } +// RouteProtocolStrings returns a slice of all String values of the enum +func RouteProtocolStrings() []string { + strs := make([]string, len(_RouteProtocolNames)) + copy(strs, _RouteProtocolNames) + return strs +} + // IsARouteProtocol returns "true" if the value is listed in the enum definition. "false" otherwise func (i RouteProtocol) IsARouteProtocol() bool { for _, v := range _RouteProtocolValues { diff --git a/pkg/machinery/nethelpers/routetype_enumer.go b/pkg/machinery/nethelpers/routetype_enumer.go index 27b8a8c748..fe25c1aa7c 100644 --- a/pkg/machinery/nethelpers/routetype_enumer.go +++ b/pkg/machinery/nethelpers/routetype_enumer.go @@ -4,12 +4,15 @@ package nethelpers import ( "fmt" + "strings" ) const _RouteTypeName = "unspecunicastlocalbroadcastanycastmulticastblackholeunreachableprohibitthrownatxresolve" var _RouteTypeIndex = [...]uint8{0, 6, 13, 18, 27, 34, 43, 52, 63, 71, 76, 79, 87} +const _RouteTypeLowerName = "unspecunicastlocalbroadcastanycastmulticastblackholeunreachableprohibitthrownatxresolve" + func (i RouteType) String() string { if i >= RouteType(len(_RouteTypeIndex)-1) { return fmt.Sprintf("RouteType(%d)", i) @@ -17,21 +20,66 @@ func (i RouteType) String() string { return _RouteTypeName[_RouteTypeIndex[i]:_RouteTypeIndex[i+1]] } -var _RouteTypeValues = []RouteType{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _RouteTypeNoOp() { + var x [1]struct{} + _ = x[TypeUnspec-(0)] + _ = x[TypeUnicast-(1)] + _ = x[TypeLocal-(2)] + _ = x[TypeBroadcast-(3)] + _ = x[TypeAnycast-(4)] + _ = x[TypeMulticast-(5)] + _ = x[TypeBlackhole-(6)] + _ = x[TypeUnreachable-(7)] + _ = x[TypeProhibit-(8)] + _ = x[TypeThrow-(9)] + _ = x[TypeNAT-(10)] + _ = x[TypeXResolve-(11)] +} + +var _RouteTypeValues = []RouteType{TypeUnspec, TypeUnicast, TypeLocal, TypeBroadcast, TypeAnycast, TypeMulticast, TypeBlackhole, TypeUnreachable, TypeProhibit, TypeThrow, TypeNAT, TypeXResolve} var _RouteTypeNameToValueMap = map[string]RouteType{ - _RouteTypeName[0:6]: 0, - _RouteTypeName[6:13]: 1, - _RouteTypeName[13:18]: 2, - _RouteTypeName[18:27]: 3, - _RouteTypeName[27:34]: 4, - _RouteTypeName[34:43]: 5, - _RouteTypeName[43:52]: 6, - _RouteTypeName[52:63]: 7, - _RouteTypeName[63:71]: 8, - _RouteTypeName[71:76]: 9, - _RouteTypeName[76:79]: 10, - _RouteTypeName[79:87]: 11, + _RouteTypeName[0:6]: TypeUnspec, + _RouteTypeLowerName[0:6]: TypeUnspec, + _RouteTypeName[6:13]: TypeUnicast, + _RouteTypeLowerName[6:13]: TypeUnicast, + _RouteTypeName[13:18]: TypeLocal, + _RouteTypeLowerName[13:18]: TypeLocal, + _RouteTypeName[18:27]: TypeBroadcast, + _RouteTypeLowerName[18:27]: TypeBroadcast, + _RouteTypeName[27:34]: TypeAnycast, + _RouteTypeLowerName[27:34]: TypeAnycast, + _RouteTypeName[34:43]: TypeMulticast, + _RouteTypeLowerName[34:43]: TypeMulticast, + _RouteTypeName[43:52]: TypeBlackhole, + _RouteTypeLowerName[43:52]: TypeBlackhole, + _RouteTypeName[52:63]: TypeUnreachable, + _RouteTypeLowerName[52:63]: TypeUnreachable, + _RouteTypeName[63:71]: TypeProhibit, + _RouteTypeLowerName[63:71]: TypeProhibit, + _RouteTypeName[71:76]: TypeThrow, + _RouteTypeLowerName[71:76]: TypeThrow, + _RouteTypeName[76:79]: TypeNAT, + _RouteTypeLowerName[76:79]: TypeNAT, + _RouteTypeName[79:87]: TypeXResolve, + _RouteTypeLowerName[79:87]: TypeXResolve, +} + +var _RouteTypeNames = []string{ + _RouteTypeName[0:6], + _RouteTypeName[6:13], + _RouteTypeName[13:18], + _RouteTypeName[18:27], + _RouteTypeName[27:34], + _RouteTypeName[34:43], + _RouteTypeName[43:52], + _RouteTypeName[52:63], + _RouteTypeName[63:71], + _RouteTypeName[71:76], + _RouteTypeName[76:79], + _RouteTypeName[79:87], } // RouteTypeString retrieves an enum value from the enum constants string name. @@ -40,6 +88,10 @@ func RouteTypeString(s string) (RouteType, error) { if val, ok := _RouteTypeNameToValueMap[s]; ok { return val, nil } + + if val, ok := _RouteTypeNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to RouteType values", s) } @@ -48,6 +100,13 @@ func RouteTypeValues() []RouteType { return _RouteTypeValues } +// RouteTypeStrings returns a slice of all String values of the enum +func RouteTypeStrings() []string { + strs := make([]string, len(_RouteTypeNames)) + copy(strs, _RouteTypeNames) + return strs +} + // IsARouteType returns "true" if the value is listed in the enum definition. "false" otherwise func (i RouteType) IsARouteType() bool { for _, v := range _RouteTypeValues { diff --git a/pkg/machinery/nethelpers/routingtable_enumer.go b/pkg/machinery/nethelpers/routingtable_enumer.go index b241226c6e..2d290a4243 100644 --- a/pkg/machinery/nethelpers/routingtable_enumer.go +++ b/pkg/machinery/nethelpers/routingtable_enumer.go @@ -4,11 +4,14 @@ package nethelpers import ( "fmt" + "strings" ) const ( - _RoutingTableName_0 = "unspec" - _RoutingTableName_1 = "defaultmainlocal" + _RoutingTableName_0 = "unspec" + _RoutingTableLowerName_0 = "unspec" + _RoutingTableName_1 = "defaultmainlocal" + _RoutingTableLowerName_1 = "defaultmainlocal" ) var ( @@ -28,13 +31,34 @@ func (i RoutingTable) String() string { } } -var _RoutingTableValues = []RoutingTable{0, 253, 254, 255} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _RoutingTableNoOp() { + var x [1]struct{} + _ = x[TableUnspec-(0)] + _ = x[TableDefault-(253)] + _ = x[TableMain-(254)] + _ = x[TableLocal-(255)] +} + +var _RoutingTableValues = []RoutingTable{TableUnspec, TableDefault, TableMain, TableLocal} var _RoutingTableNameToValueMap = map[string]RoutingTable{ - _RoutingTableName_0[0:6]: 0, - _RoutingTableName_1[0:7]: 253, - _RoutingTableName_1[7:11]: 254, - _RoutingTableName_1[11:16]: 255, + _RoutingTableName_0[0:6]: TableUnspec, + _RoutingTableLowerName_0[0:6]: TableUnspec, + _RoutingTableName_1[0:7]: TableDefault, + _RoutingTableLowerName_1[0:7]: TableDefault, + _RoutingTableName_1[7:11]: TableMain, + _RoutingTableLowerName_1[7:11]: TableMain, + _RoutingTableName_1[11:16]: TableLocal, + _RoutingTableLowerName_1[11:16]: TableLocal, +} + +var _RoutingTableNames = []string{ + _RoutingTableName_0[0:6], + _RoutingTableName_1[0:7], + _RoutingTableName_1[7:11], + _RoutingTableName_1[11:16], } // RoutingTableString retrieves an enum value from the enum constants string name. @@ -43,6 +67,10 @@ func RoutingTableString(s string) (RoutingTable, error) { if val, ok := _RoutingTableNameToValueMap[s]; ok { return val, nil } + + if val, ok := _RoutingTableNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to RoutingTable values", s) } @@ -51,6 +79,13 @@ func RoutingTableValues() []RoutingTable { return _RoutingTableValues } +// RoutingTableStrings returns a slice of all String values of the enum +func RoutingTableStrings() []string { + strs := make([]string, len(_RoutingTableNames)) + copy(strs, _RoutingTableNames) + return strs +} + // IsARoutingTable returns "true" if the value is listed in the enum definition. "false" otherwise func (i RoutingTable) IsARoutingTable() bool { for _, v := range _RoutingTableValues { diff --git a/pkg/machinery/nethelpers/scope_enumer.go b/pkg/machinery/nethelpers/scope_enumer.go index 492634aaa2..10fbdb34d5 100644 --- a/pkg/machinery/nethelpers/scope_enumer.go +++ b/pkg/machinery/nethelpers/scope_enumer.go @@ -4,12 +4,16 @@ package nethelpers import ( "fmt" + "strings" ) const ( - _ScopeName_0 = "global" - _ScopeName_1 = "site" - _ScopeName_2 = "linkhostnowhere" + _ScopeName_0 = "global" + _ScopeLowerName_0 = "global" + _ScopeName_1 = "site" + _ScopeLowerName_1 = "site" + _ScopeName_2 = "linkhostnowhere" + _ScopeLowerName_2 = "linkhostnowhere" ) var ( @@ -32,14 +36,38 @@ func (i Scope) String() string { } } -var _ScopeValues = []Scope{0, 200, 253, 254, 255} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _ScopeNoOp() { + var x [1]struct{} + _ = x[ScopeGlobal-(0)] + _ = x[ScopeSite-(200)] + _ = x[ScopeLink-(253)] + _ = x[ScopeHost-(254)] + _ = x[ScopeNowhere-(255)] +} + +var _ScopeValues = []Scope{ScopeGlobal, ScopeSite, ScopeLink, ScopeHost, ScopeNowhere} var _ScopeNameToValueMap = map[string]Scope{ - _ScopeName_0[0:6]: 0, - _ScopeName_1[0:4]: 200, - _ScopeName_2[0:4]: 253, - _ScopeName_2[4:8]: 254, - _ScopeName_2[8:15]: 255, + _ScopeName_0[0:6]: ScopeGlobal, + _ScopeLowerName_0[0:6]: ScopeGlobal, + _ScopeName_1[0:4]: ScopeSite, + _ScopeLowerName_1[0:4]: ScopeSite, + _ScopeName_2[0:4]: ScopeLink, + _ScopeLowerName_2[0:4]: ScopeLink, + _ScopeName_2[4:8]: ScopeHost, + _ScopeLowerName_2[4:8]: ScopeHost, + _ScopeName_2[8:15]: ScopeNowhere, + _ScopeLowerName_2[8:15]: ScopeNowhere, +} + +var _ScopeNames = []string{ + _ScopeName_0[0:6], + _ScopeName_1[0:4], + _ScopeName_2[0:4], + _ScopeName_2[4:8], + _ScopeName_2[8:15], } // ScopeString retrieves an enum value from the enum constants string name. @@ -48,6 +76,10 @@ func ScopeString(s string) (Scope, error) { if val, ok := _ScopeNameToValueMap[s]; ok { return val, nil } + + if val, ok := _ScopeNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to Scope values", s) } @@ -56,6 +88,13 @@ func ScopeValues() []Scope { return _ScopeValues } +// ScopeStrings returns a slice of all String values of the enum +func ScopeStrings() []string { + strs := make([]string, len(_ScopeNames)) + copy(strs, _ScopeNames) + return strs +} + // IsAScope returns "true" if the value is listed in the enum definition. "false" otherwise func (i Scope) IsAScope() bool { for _, v := range _ScopeValues { diff --git a/pkg/machinery/nethelpers/status_enumer.go b/pkg/machinery/nethelpers/status_enumer.go index 878f10aa12..a112c5f855 100644 --- a/pkg/machinery/nethelpers/status_enumer.go +++ b/pkg/machinery/nethelpers/status_enumer.go @@ -4,12 +4,15 @@ package nethelpers import ( "fmt" + "strings" ) const _StatusName = "addressesconnectivityhostnameetcfiles" var _StatusIndex = [...]uint8{0, 9, 21, 29, 37} +const _StatusLowerName = "addressesconnectivityhostnameetcfiles" + func (i Status) String() string { i -= 1 if i < 0 || i >= Status(len(_StatusIndex)-1) { @@ -18,13 +21,34 @@ func (i Status) String() string { return _StatusName[_StatusIndex[i]:_StatusIndex[i+1]] } -var _StatusValues = []Status{1, 2, 3, 4} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _StatusNoOp() { + var x [1]struct{} + _ = x[StatusAddresses-(1)] + _ = x[StatusConnectivity-(2)] + _ = x[StatusHostname-(3)] + _ = x[StatusEtcFiles-(4)] +} + +var _StatusValues = []Status{StatusAddresses, StatusConnectivity, StatusHostname, StatusEtcFiles} var _StatusNameToValueMap = map[string]Status{ - _StatusName[0:9]: 1, - _StatusName[9:21]: 2, - _StatusName[21:29]: 3, - _StatusName[29:37]: 4, + _StatusName[0:9]: StatusAddresses, + _StatusLowerName[0:9]: StatusAddresses, + _StatusName[9:21]: StatusConnectivity, + _StatusLowerName[9:21]: StatusConnectivity, + _StatusName[21:29]: StatusHostname, + _StatusLowerName[21:29]: StatusHostname, + _StatusName[29:37]: StatusEtcFiles, + _StatusLowerName[29:37]: StatusEtcFiles, +} + +var _StatusNames = []string{ + _StatusName[0:9], + _StatusName[9:21], + _StatusName[21:29], + _StatusName[29:37], } // StatusString retrieves an enum value from the enum constants string name. @@ -33,6 +57,10 @@ func StatusString(s string) (Status, error) { if val, ok := _StatusNameToValueMap[s]; ok { return val, nil } + + if val, ok := _StatusNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to Status values", s) } @@ -41,6 +69,13 @@ func StatusValues() []Status { return _StatusValues } +// StatusStrings returns a slice of all String values of the enum +func StatusStrings() []string { + strs := make([]string, len(_StatusNames)) + copy(strs, _StatusNames) + return strs +} + // IsAStatus returns "true" if the value is listed in the enum definition. "false" otherwise func (i Status) IsAStatus() bool { for _, v := range _StatusValues { diff --git a/pkg/machinery/nethelpers/vlanprotocol_enumer.go b/pkg/machinery/nethelpers/vlanprotocol_enumer.go index dd326a9aff..bd343fd4fd 100644 --- a/pkg/machinery/nethelpers/vlanprotocol_enumer.go +++ b/pkg/machinery/nethelpers/vlanprotocol_enumer.go @@ -4,11 +4,14 @@ package nethelpers import ( "fmt" + "strings" ) const ( - _VLANProtocolName_0 = "802.1q" - _VLANProtocolName_1 = "802.1ad" + _VLANProtocolName_0 = "802.1q" + _VLANProtocolLowerName_0 = "802.1q" + _VLANProtocolName_1 = "802.1ad" + _VLANProtocolLowerName_1 = "802.1ad" ) var ( @@ -27,11 +30,26 @@ func (i VLANProtocol) String() string { } } -var _VLANProtocolValues = []VLANProtocol{33024, 34984} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _VLANProtocolNoOp() { + var x [1]struct{} + _ = x[VLANProtocol8021Q-(33024)] + _ = x[VLANProtocol8021AD-(34984)] +} + +var _VLANProtocolValues = []VLANProtocol{VLANProtocol8021Q, VLANProtocol8021AD} var _VLANProtocolNameToValueMap = map[string]VLANProtocol{ - _VLANProtocolName_0[0:6]: 33024, - _VLANProtocolName_1[0:7]: 34984, + _VLANProtocolName_0[0:6]: VLANProtocol8021Q, + _VLANProtocolLowerName_0[0:6]: VLANProtocol8021Q, + _VLANProtocolName_1[0:7]: VLANProtocol8021AD, + _VLANProtocolLowerName_1[0:7]: VLANProtocol8021AD, +} + +var _VLANProtocolNames = []string{ + _VLANProtocolName_0[0:6], + _VLANProtocolName_1[0:7], } // VLANProtocolString retrieves an enum value from the enum constants string name. @@ -40,6 +58,10 @@ func VLANProtocolString(s string) (VLANProtocol, error) { if val, ok := _VLANProtocolNameToValueMap[s]; ok { return val, nil } + + if val, ok := _VLANProtocolNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to VLANProtocol values", s) } @@ -48,6 +70,13 @@ func VLANProtocolValues() []VLANProtocol { return _VLANProtocolValues } +// VLANProtocolStrings returns a slice of all String values of the enum +func VLANProtocolStrings() []string { + strs := make([]string, len(_VLANProtocolNames)) + copy(strs, _VLANProtocolNames) + return strs +} + // IsAVLANProtocol returns "true" if the value is listed in the enum definition. "false" otherwise func (i VLANProtocol) IsAVLANProtocol() bool { for _, v := range _VLANProtocolValues { diff --git a/pkg/machinery/resources/network/configlayer_enumer.go b/pkg/machinery/resources/network/configlayer_enumer.go index 07a168f66a..3ac2665f34 100644 --- a/pkg/machinery/resources/network/configlayer_enumer.go +++ b/pkg/machinery/resources/network/configlayer_enumer.go @@ -4,12 +4,15 @@ package network import ( "fmt" + "strings" ) const _ConfigLayerName = "defaultcmdlineplatformoperatorconfiguration" var _ConfigLayerIndex = [...]uint8{0, 7, 14, 22, 30, 43} +const _ConfigLayerLowerName = "defaultcmdlineplatformoperatorconfiguration" + func (i ConfigLayer) String() string { if i < 0 || i >= ConfigLayer(len(_ConfigLayerIndex)-1) { return fmt.Sprintf("ConfigLayer(%d)", i) @@ -17,14 +20,38 @@ func (i ConfigLayer) String() string { return _ConfigLayerName[_ConfigLayerIndex[i]:_ConfigLayerIndex[i+1]] } -var _ConfigLayerValues = []ConfigLayer{0, 1, 2, 3, 4} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _ConfigLayerNoOp() { + var x [1]struct{} + _ = x[ConfigDefault-(0)] + _ = x[ConfigCmdline-(1)] + _ = x[ConfigPlatform-(2)] + _ = x[ConfigOperator-(3)] + _ = x[ConfigMachineConfiguration-(4)] +} + +var _ConfigLayerValues = []ConfigLayer{ConfigDefault, ConfigCmdline, ConfigPlatform, ConfigOperator, ConfigMachineConfiguration} var _ConfigLayerNameToValueMap = map[string]ConfigLayer{ - _ConfigLayerName[0:7]: 0, - _ConfigLayerName[7:14]: 1, - _ConfigLayerName[14:22]: 2, - _ConfigLayerName[22:30]: 3, - _ConfigLayerName[30:43]: 4, + _ConfigLayerName[0:7]: ConfigDefault, + _ConfigLayerLowerName[0:7]: ConfigDefault, + _ConfigLayerName[7:14]: ConfigCmdline, + _ConfigLayerLowerName[7:14]: ConfigCmdline, + _ConfigLayerName[14:22]: ConfigPlatform, + _ConfigLayerLowerName[14:22]: ConfigPlatform, + _ConfigLayerName[22:30]: ConfigOperator, + _ConfigLayerLowerName[22:30]: ConfigOperator, + _ConfigLayerName[30:43]: ConfigMachineConfiguration, + _ConfigLayerLowerName[30:43]: ConfigMachineConfiguration, +} + +var _ConfigLayerNames = []string{ + _ConfigLayerName[0:7], + _ConfigLayerName[7:14], + _ConfigLayerName[14:22], + _ConfigLayerName[22:30], + _ConfigLayerName[30:43], } // ConfigLayerString retrieves an enum value from the enum constants string name. @@ -33,6 +60,10 @@ func ConfigLayerString(s string) (ConfigLayer, error) { if val, ok := _ConfigLayerNameToValueMap[s]; ok { return val, nil } + + if val, ok := _ConfigLayerNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to ConfigLayer values", s) } @@ -41,6 +72,13 @@ func ConfigLayerValues() []ConfigLayer { return _ConfigLayerValues } +// ConfigLayerStrings returns a slice of all String values of the enum +func ConfigLayerStrings() []string { + strs := make([]string, len(_ConfigLayerNames)) + copy(strs, _ConfigLayerNames) + return strs +} + // IsAConfigLayer returns "true" if the value is listed in the enum definition. "false" otherwise func (i ConfigLayer) IsAConfigLayer() bool { for _, v := range _ConfigLayerValues { diff --git a/pkg/machinery/resources/network/operator_enumer.go b/pkg/machinery/resources/network/operator_enumer.go index 513f94c2ce..6264a8001f 100644 --- a/pkg/machinery/resources/network/operator_enumer.go +++ b/pkg/machinery/resources/network/operator_enumer.go @@ -4,12 +4,15 @@ package network import ( "fmt" + "strings" ) const _OperatorName = "dhcp4dhcp6vip" var _OperatorIndex = [...]uint8{0, 5, 10, 13} +const _OperatorLowerName = "dhcp4dhcp6vip" + func (i Operator) String() string { if i < 0 || i >= Operator(len(_OperatorIndex)-1) { return fmt.Sprintf("Operator(%d)", i) @@ -17,12 +20,30 @@ func (i Operator) String() string { return _OperatorName[_OperatorIndex[i]:_OperatorIndex[i+1]] } -var _OperatorValues = []Operator{0, 1, 2} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _OperatorNoOp() { + var x [1]struct{} + _ = x[OperatorDHCP4-(0)] + _ = x[OperatorDHCP6-(1)] + _ = x[OperatorVIP-(2)] +} + +var _OperatorValues = []Operator{OperatorDHCP4, OperatorDHCP6, OperatorVIP} var _OperatorNameToValueMap = map[string]Operator{ - _OperatorName[0:5]: 0, - _OperatorName[5:10]: 1, - _OperatorName[10:13]: 2, + _OperatorName[0:5]: OperatorDHCP4, + _OperatorLowerName[0:5]: OperatorDHCP4, + _OperatorName[5:10]: OperatorDHCP6, + _OperatorLowerName[5:10]: OperatorDHCP6, + _OperatorName[10:13]: OperatorVIP, + _OperatorLowerName[10:13]: OperatorVIP, +} + +var _OperatorNames = []string{ + _OperatorName[0:5], + _OperatorName[5:10], + _OperatorName[10:13], } // OperatorString retrieves an enum value from the enum constants string name. @@ -31,6 +52,10 @@ func OperatorString(s string) (Operator, error) { if val, ok := _OperatorNameToValueMap[s]; ok { return val, nil } + + if val, ok := _OperatorNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to Operator values", s) } @@ -39,6 +64,13 @@ func OperatorValues() []Operator { return _OperatorValues } +// OperatorStrings returns a slice of all String values of the enum +func OperatorStrings() []string { + strs := make([]string, len(_OperatorNames)) + copy(strs, _OperatorNames) + return strs +} + // IsAOperator returns "true" if the value is listed in the enum definition. "false" otherwise func (i Operator) IsAOperator() bool { for _, v := range _OperatorValues { diff --git a/pkg/machinery/resources/runtime/machinestage_enumer.go b/pkg/machinery/resources/runtime/machinestage_enumer.go index 27641b9aac..5e3af90d8a 100644 --- a/pkg/machinery/resources/runtime/machinestage_enumer.go +++ b/pkg/machinery/resources/runtime/machinestage_enumer.go @@ -4,12 +4,15 @@ package runtime import ( "fmt" + "strings" ) const _MachineStageName = "unknownbootinginstallingmaintenancerunningrebootingshutting downresettingupgrading" var _MachineStageIndex = [...]uint8{0, 7, 14, 24, 35, 42, 51, 64, 73, 82} +const _MachineStageLowerName = "unknownbootinginstallingmaintenancerunningrebootingshutting downresettingupgrading" + func (i MachineStage) String() string { if i < 0 || i >= MachineStage(len(_MachineStageIndex)-1) { return fmt.Sprintf("MachineStage(%d)", i) @@ -17,18 +20,54 @@ func (i MachineStage) String() string { return _MachineStageName[_MachineStageIndex[i]:_MachineStageIndex[i+1]] } -var _MachineStageValues = []MachineStage{0, 1, 2, 3, 4, 5, 6, 7, 8} +// An "invalid array index" compiler error signifies that the constant values have changed. +// Re-run the stringer command to generate them again. +func _MachineStageNoOp() { + var x [1]struct{} + _ = x[MachineStageUnknown-(0)] + _ = x[MachineStageBooting-(1)] + _ = x[MachineStageInstalling-(2)] + _ = x[MachineStageMaintenance-(3)] + _ = x[MachineStageRunning-(4)] + _ = x[MachineStageRebooting-(5)] + _ = x[MachineStageShuttingDown-(6)] + _ = x[MachineStageResetting-(7)] + _ = x[MachineStageUpgrading-(8)] +} + +var _MachineStageValues = []MachineStage{MachineStageUnknown, MachineStageBooting, MachineStageInstalling, MachineStageMaintenance, MachineStageRunning, MachineStageRebooting, MachineStageShuttingDown, MachineStageResetting, MachineStageUpgrading} var _MachineStageNameToValueMap = map[string]MachineStage{ - _MachineStageName[0:7]: 0, - _MachineStageName[7:14]: 1, - _MachineStageName[14:24]: 2, - _MachineStageName[24:35]: 3, - _MachineStageName[35:42]: 4, - _MachineStageName[42:51]: 5, - _MachineStageName[51:64]: 6, - _MachineStageName[64:73]: 7, - _MachineStageName[73:82]: 8, + _MachineStageName[0:7]: MachineStageUnknown, + _MachineStageLowerName[0:7]: MachineStageUnknown, + _MachineStageName[7:14]: MachineStageBooting, + _MachineStageLowerName[7:14]: MachineStageBooting, + _MachineStageName[14:24]: MachineStageInstalling, + _MachineStageLowerName[14:24]: MachineStageInstalling, + _MachineStageName[24:35]: MachineStageMaintenance, + _MachineStageLowerName[24:35]: MachineStageMaintenance, + _MachineStageName[35:42]: MachineStageRunning, + _MachineStageLowerName[35:42]: MachineStageRunning, + _MachineStageName[42:51]: MachineStageRebooting, + _MachineStageLowerName[42:51]: MachineStageRebooting, + _MachineStageName[51:64]: MachineStageShuttingDown, + _MachineStageLowerName[51:64]: MachineStageShuttingDown, + _MachineStageName[64:73]: MachineStageResetting, + _MachineStageLowerName[64:73]: MachineStageResetting, + _MachineStageName[73:82]: MachineStageUpgrading, + _MachineStageLowerName[73:82]: MachineStageUpgrading, +} + +var _MachineStageNames = []string{ + _MachineStageName[0:7], + _MachineStageName[7:14], + _MachineStageName[14:24], + _MachineStageName[24:35], + _MachineStageName[35:42], + _MachineStageName[42:51], + _MachineStageName[51:64], + _MachineStageName[64:73], + _MachineStageName[73:82], } // MachineStageString retrieves an enum value from the enum constants string name. @@ -37,6 +76,10 @@ func MachineStageString(s string) (MachineStage, error) { if val, ok := _MachineStageNameToValueMap[s]; ok { return val, nil } + + if val, ok := _MachineStageNameToValueMap[strings.ToLower(s)]; ok { + return val, nil + } return 0, fmt.Errorf("%s does not belong to MachineStage values", s) } @@ -45,6 +88,13 @@ func MachineStageValues() []MachineStage { return _MachineStageValues } +// MachineStageStrings returns a slice of all String values of the enum +func MachineStageStrings() []string { + strs := make([]string, len(_MachineStageNames)) + copy(strs, _MachineStageNames) + return strs +} + // IsAMachineStage returns "true" if the value is listed in the enum definition. "false" otherwise func (i MachineStage) IsAMachineStage() bool { for _, v := range _MachineStageValues { diff --git a/website/content/v1.6/_index.md b/website/content/v1.6/_index.md index 1d72491a62..4713eb287c 100644 --- a/website/content/v1.6/_index.md +++ b/website/content/v1.6/_index.md @@ -4,7 +4,7 @@ no_list: true linkTitle: "Documentation" cascade: type: docs -lastRelease: v1.6.3 +lastRelease: v1.6.4 kubernetesRelease: "1.29.1" prevKubernetesRelease: "1.28.3" nvidiaContainerToolkitRelease: "v1.13.5"