From 1def1e4ec4f7f48449bd9c41b2bc722afc24962e Mon Sep 17 00:00:00 2001 From: Mateusz Filipowicz Date: Tue, 18 Mar 2025 00:08:25 +0100 Subject: [PATCH] fix: adjust firewall zone policy resource date attributes (#54) * fix: adjust firewall zone policy resource date attributes --- codegen/customizations.yml | 9 +++++++++ unifi/firewall_zone_policy.generated.go | 13 +++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/codegen/customizations.yml b/codegen/customizations.yml index 8b5af6d..852d98d 100644 --- a/codegen/customizations.yml +++ b/codegen/customizations.yml @@ -466,6 +466,15 @@ customizations: omitEmpty: true PortGroupID: omitEmpty: true + Date: + fieldType: "string" + customUnmarshalType: "" + DateStart: + fieldType: "string" + customUnmarshalType: "" + DateEnd: + fieldType: "string" + customUnmarshalType: "" Network: fields: InternetAccessEnabled: diff --git a/unifi/firewall_zone_policy.generated.go b/unifi/firewall_zone_policy.generated.go index 4e57968..6bd1ae3 100644 --- a/unifi/firewall_zone_policy.generated.go +++ b/unifi/firewall_zone_policy.generated.go @@ -101,9 +101,9 @@ func (dst *FirewallZonePolicyDestination) UnmarshalJSON(b []byte) error { } type FirewallZonePolicySchedule struct { - Date int `json:"date,omitempty"` // ^$|^(20[0-9]{2})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$ - DateEnd int `json:"date_end,omitempty"` // ^$|^(20[0-9]{2})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$ - DateStart int `json:"date_start,omitempty"` // ^$|^(20[0-9]{2})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$ + Date string `json:"date,omitempty"` // ^$|^(20[0-9]{2})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$ + DateEnd string `json:"date_end,omitempty"` // ^$|^(20[0-9]{2})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$ + DateStart string `json:"date_start,omitempty"` // ^$|^(20[0-9]{2})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$ Mode string `json:"mode,omitempty" validate:"omitempty,oneof=ALWAYS EVERY_DAY EVERY_WEEK ONE_TIME_ONLY CUSTOM"` // ALWAYS|EVERY_DAY|EVERY_WEEK|ONE_TIME_ONLY|CUSTOM RepeatOnDays []string `json:"repeat_on_days,omitempty" validate:"omitempty,oneof=mon tue wed thu fri sat sun"` // mon|tue|wed|thu|fri|sat|sun TimeAllDay bool `json:"time_all_day"` @@ -114,10 +114,6 @@ type FirewallZonePolicySchedule struct { func (dst *FirewallZonePolicySchedule) UnmarshalJSON(b []byte) error { type Alias FirewallZonePolicySchedule aux := &struct { - Date emptyStringInt `json:"date"` - DateEnd emptyStringInt `json:"date_end"` - DateStart emptyStringInt `json:"date_start"` - *Alias }{ Alias: (*Alias)(dst), @@ -127,9 +123,6 @@ func (dst *FirewallZonePolicySchedule) UnmarshalJSON(b []byte) error { if err != nil { return fmt.Errorf("unable to unmarshal alias: %w", err) } - dst.Date = int(aux.Date) - dst.DateEnd = int(aux.DateEnd) - dst.DateStart = int(aux.DateStart) return nil }