Closed
Description
Description:
We can simplify the treatment of those options to make it more user friendly.
As a user, I might want to add an IP prefix to an instance without knowing how long the acl rule is.
It could be useful for instance to tell something like:
scw rdb instance acl block 0.0.0.0
scw rdb instance acl allow 1.2.3.4
Those function could ensure that a given set of IP are blocked or allowed. Which is simpler than managing the acl table.
How to reproduce:
$ go run ./cmd/scw/main.go rdb acl delete instance-id=e714da2b-0623-4957-8a83-61a1ba0a715e acl-rule-ips.0=0.0.0.0/0 -D
running: [/var/folders/sm/h3cw_xsj0279j12fnhv6bzd40000gn/T/go-build734465719/b001/exe/main rdb acl delete instance-id=e714da2b-0623-4957-8a83-61a1ba0a715e acl-rule-ips.0=0.0.0.0/0 -D]
client: using sdk version v1.0.0-beta.6+devclient: using sdk version v1.0.0-beta.6+devcreating DELETE request on https://api.scaleway.com/rdb/v1/regions/fr-par/instances/e714da2b-0623-4957-8a83-61a1ba0a715e/acls
--------------- Scaleway SDK REQUEST 1 : ---------------
DELETE /rdb/v1/regions/fr-par/instances/e714da2b-0623-4957-8a83-61a1ba0a715e/acls HTTP/1.1
Host: api.scaleway.com
User-Agent: scaleway-sdk-go/v1.0.0-beta.6+dev (go1.14.5; darwin; amd64) scaleway-cli/2.0.0+dev
Content-Length: 30
Content-Type: application/json
X-Auth-Token: 7cc91c3f-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Accept-Encoding: gzip
{"acl_rule_ips":["0.0.0.0/0"]}
---------------------------------------------------------
--------------- Scaleway SDK RESPONSE 1 : ---------------
HTTP/2.0 200 OK
Content-Length: 125
Content-Security-Policy: default-src 'none'; frame-ancestors 'none'
Content-Type: application/json
Date: Wed, 12 Aug 2020 09:00:15 GMT
Server: agw_listener_public_vip
Strict-Transport-Security: max-age=63072000
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Request-Id: f0cbde92-75c1-4165-a010-b130a50ba0d2
{"rules":[{"ip":"0.0.0.0/0","port":13917,"protocol":"tcp","direction":"inbound","action":"allow","description":"Allow All"}]}
----------------------------------------------------------Rules.0.IP 0.0.0.0/0
Rules.0.Port 13917
Rules.0.Protocol tcp
Rules.0.Direction inbound
Rules.0.Action allow
Rules.0.Description Allow All
TotalCount 1
skipping check version
telemetry successfully sent
Command attempted
Expected Behavior
Actual Behavior
More info
Version
Version 2.0.0+dev
BuildDate unknown
GoVersion go1.14.5
GitBranch unknown
GitCommit unknown
GoArch amd64
GoOS darwin