scaleway / scaleway-sdk-go

Integrate Scaleway with your Go application

Home Page:https://pkg.go.dev/github.com/scaleway/scaleway-sdk-go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug when unmarshalling IP with CIDR notation

remyleone opened this issue · comments

Found in scaleway/scaleway-cli#1156

It seems that "0.0.0.0/0" is not a valid IP address for the scaleway sdk

$ go run ./cmd/scw/main.go rdb acl list ca6271c4-5182-4627-81c2-3d8a8542585b -D
running: [/var/folders/sm/h3cw_xsj0279j12fnhv6bzd40000gn/T/go-build626928940/b001/exe/main rdb acl list ca6271c4-5182-4627-81c2-3d8a8542585b -D]
client: using sdk version v1.0.0-beta.6+devclient: using sdk version v1.0.0-beta.6+devcreating GET request on https://api.scaleway.com/rdb/v1/regions/fr-par/instances/ca6271c4-5182-4627-81c2-3d8a8542585b/acls?page=1
--------------- Scaleway SDK REQUEST 1 : ---------------
GET /rdb/v1/regions/fr-par/instances/ca6271c4-5182-4627-81c2-3d8a8542585b/acls?page=1 HTTP/1.1
Host: api.scaleway.com
User-Agent: scaleway-sdk-go/v1.0.0-beta.6+dev (go1.14.4; darwin; amd64) scaleway-cli/2.0.0-beta.4+dev
X-Auth-Token: 11111111-1111-1111-1111-111111111111
Accept-Encoding: gzip


---------------------------------------------------------
--------------- Scaleway SDK RESPONSE 1 : ---------------
HTTP/2.0 200 OK
Content-Length: 140
Content-Security-Policy: default-src 'none'; frame-ancestors 'none'
Content-Type: application/json
Date: Thu, 02 Jul 2020 09:52:28 GMT
Server: agw_listener_public_vip
Strict-Transport-Security: max-age=63072000
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Request-Id: 49fbee23-7c63-4a41-8fa6-a645b373e441

{"rules":[{"ip":"0.0.0.0/0","port":8969,"protocol":"tcp","direction":"inbound","action":"allow","description":"Allow All"}],"total_count":1}
----------------------------------------------------------Scaleway-sdk-go: could not parse application/json response body: invalid IP address: 0.0.0.0/0
skipping check versiontelemetry successfully sent
exit status 1

fixed by #482