digitalocean / digitalocean/api-v2
Firewall API return invalid outbound rules port number
- Dominant language
- No language data
- Stars
- 138
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
This issue happens when I retrieve Firewall data from `/v2/firewalls/$FIREWALL_ID` or `/v2/firewalls`.
My firewall outbound rules configuration looks like this:
Type|Protocol|Port Range|Destinations
---|---|---|---
ICMP | ICMP | | All IPv4 All IPv6
All TCP | TCP | All ports | All IPv4 All IPv6
All UDP | UDP | All ports | All IPv4 All IPv6
The document is saying `ports` attribute will return as
> The ports on which traffic will be allowed specified as a string containing a single port, a range (e.g. "8000-9000"), or "all" to open all ports for a protocol.
But what I got from are `"0"` for each rule entry:
```
{ protocol: 'icmp',
ports: '0',
destinations: { addresses: [Array] } },
{ protocol: 'tcp',
ports: '0',
destinations: { addresses: [Array] } },
{ protocol: 'udp',
ports: '0',
destinations: { addresses: [Array] } }
```
And when I try to make a request to update my firewall data using `PUT` to `/v2/firewalls/$FIREWALL_ID` by updating some fields on this returned data, I will get error `422 (Unprocessable Entity)`
Now, I need to update `ports` values to the correct ones everytime before send `PUT` request. I think, at least, I should be able to use the returned data as base, make change only on wanted fields, and `PUT` back, without need to update unrelated fields.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.