fix: adjust firewall zone policy resource date attributes (#54)

* fix: adjust firewall zone policy resource date attributes
This commit is contained in:
Mateusz Filipowicz
2025-03-18 00:08:25 +01:00
committed by GitHub
parent c8a3b96575
commit 1def1e4ec4
2 changed files with 12 additions and 10 deletions

View File

@@ -466,6 +466,15 @@ customizations:
omitEmpty: true omitEmpty: true
PortGroupID: PortGroupID:
omitEmpty: true omitEmpty: true
Date:
fieldType: "string"
customUnmarshalType: ""
DateStart:
fieldType: "string"
customUnmarshalType: ""
DateEnd:
fieldType: "string"
customUnmarshalType: ""
Network: Network:
fields: fields:
InternetAccessEnabled: InternetAccessEnabled:

View File

@@ -101,9 +101,9 @@ func (dst *FirewallZonePolicyDestination) UnmarshalJSON(b []byte) error {
} }
type FirewallZonePolicySchedule struct { 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])$ Date string `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])$ 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 int `json:"date_start,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 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 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"` TimeAllDay bool `json:"time_all_day"`
@@ -114,10 +114,6 @@ type FirewallZonePolicySchedule struct {
func (dst *FirewallZonePolicySchedule) UnmarshalJSON(b []byte) error { func (dst *FirewallZonePolicySchedule) UnmarshalJSON(b []byte) error {
type Alias FirewallZonePolicySchedule type Alias FirewallZonePolicySchedule
aux := &struct { aux := &struct {
Date emptyStringInt `json:"date"`
DateEnd emptyStringInt `json:"date_end"`
DateStart emptyStringInt `json:"date_start"`
*Alias *Alias
}{ }{
Alias: (*Alias)(dst), Alias: (*Alias)(dst),
@@ -127,9 +123,6 @@ func (dst *FirewallZonePolicySchedule) UnmarshalJSON(b []byte) error {
if err != nil { if err != nil {
return fmt.Errorf("unable to unmarshal alias: %w", err) 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 return nil
} }