ionos-cloud / sdk-go

Apache License 2.0
8 stars 1 forks source link

FirewallRuleProperties are not correct #7

Closed Ntr0 closed 2 years ago

Ntr0 commented 3 years ago
  1. Protocol must be omitempty. The description says this field is disallowed in update requests
  2. All fields where the description states "Value null allows..." must NOT be omitempty, as setting null explicitly resets this certain property, e.g. Updating SourceIP from "10.10.10.1/32" to null will change the rule to allow ingress from all SourceIPs. This is not possible if these values are not produced when marshalling to json.
cristiGuranIonos commented 2 years ago

Right, but I think that the fix needs to be in MarshalJson function where the fields are checked against nil before serialisation. Even though protocol is immutable for updates, it's also required for Post, which is why it doesn't have omitEmpty(for POST it can't be absent).

For MarshalJson protocol will keep being not serialised if it is sent as nil.

cristiGuranIonos commented 2 years ago

Fixed in V6.0.1