From 75b7da6d0118ca7c38dc818f7970eb454d999aed Mon Sep 17 00:00:00 2001 From: Samuel Lorch Date: Sat, 1 Apr 2023 01:46:45 +0200 Subject: [PATCH] Update Interface Definition --- internal/definitions/interface.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/internal/definitions/interface.go b/internal/definitions/interface.go index 467970a..a7ee29c 100644 --- a/internal/definitions/interface.go +++ b/internal/definitions/interface.go @@ -6,10 +6,15 @@ import ( ) type Interface struct { - Type InterfaceType `json:"type" validate:"min=0,max=3"` - AddressingMode InterfaceAddressingMode `json:"addressing_mode" validate:"min=0,max=2"` - Address netip.Addr `json:"address" validate:"min=0,max=2"` - Comment string `json:"comment,omitempty"` + Type InterfaceType `json:"type" validate:"min=0,max=3"` + AddressingMode InterfaceAddressingMode `json:"addressing_mode" validate:"min=0,max=2"` + Address *netip.Addr `json:"address,omitempty" validate:"excluded_unless=AddressingMode 1"` + HardwareInterface *string `json:"hardware_interface,omitempty" validate:"excluded_unless=Type 0"` + // TODO fix Validator for int pointers with min=0,max=4094 + VlanID *uint `json:"vlan_id,omitempty" validate:"excluded_unless=Type 1"` + BondMembers *[]string `json:"bond_members,omitempty" validate:"excluded_unless=Type 2"` + BridgeMembers *[]string `json:"bridge_members,omitempty" validate:"excluded_unless=Type 3"` + Comment string `json:"comment,omitempty"` } type InterfaceType int