diff --git a/metric_ruleset/model_exception_rule.go b/metric_ruleset/model_exception_rule.go index 8e3da93..835f0a5 100644 --- a/metric_ruleset/model_exception_rule.go +++ b/metric_ruleset/model_exception_rule.go @@ -188,25 +188,17 @@ func (o *ExceptionRule) SetDescription(v string) { } func (o ExceptionRule) MarshalJSON() ([]byte, error) { - toSerialize,err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o ExceptionRule) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["name"] = o.Name toSerialize["enabled"] = o.Enabled toSerialize["matcher"] = o.Matcher - if !isNil(o.Restoration) { + if !isNil(o.Restoration) && !isNil(o.Restoration.StartTime) && *o.Restoration.StartTime > int64(0) { toSerialize["restoration"] = o.Restoration } if !isNil(o.Description) { toSerialize["description"] = o.Description } - return toSerialize, nil + return json.Marshal(toSerialize) } type NullableExceptionRule struct { diff --git a/metric_ruleset/model_exception_rule_restoration_fields.go b/metric_ruleset/model_exception_rule_restoration_fields.go index 846727f..642bc59 100644 --- a/metric_ruleset/model_exception_rule_restoration_fields.go +++ b/metric_ruleset/model_exception_rule_restoration_fields.go @@ -105,10 +105,10 @@ func (o *ExceptionRuleRestorationFields) SetStartTime(v int64) { func (o ExceptionRuleRestorationFields) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if !isNil(o.RestorationId) { + if !isNil(o.RestorationId) && len(*o.RestorationId) > 0 { toSerialize["restorationId"] = o.RestorationId } - if !isNil(o.StartTime) { + if !isNil(o.StartTime) && *o.StartTime > int64(0) { toSerialize["startTime"] = o.StartTime } return json.Marshal(toSerialize)