Closed codinja1188 closed 1 year ago
@vasubabu can you provide a sample JSON response from the API?
Sample JSON Output
Vasubabus-MacBook-Pro:bin vasubabu$ ./metal capacity check -m sv,da -P c3.medium.x86,m3.large.x86 -q 4
2023/09/07 22:26:46
POST /metal/v1/capacity/metros HTTP/1.1
Host: api.equinix.com
User-Agent: metal-cli/53a8fe2 metal-go/0.19.0
Content-Length: 224
Accept: application/json
Content-Type: application/json
X-Auth-Token: ***
Accept-Encoding: gzip
{"servers":[{"metro":"sv","plan":"c3.medium.x86","quantity":"4"},{"metro":"sv","plan":"m3.large.x86","quantity":"4"},{"metro":"da","plan":"c3.medium.x86","quantity":"4"},{"metro":"da","plan":"m3.large.x86","quantity":"4"}]}
2023/09/07 22:26:48
HTTP/1.1 200 OK
Content-Length: 291
Cache-Control: max-age=0, private, must-revalidate
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Thu, 07 Sep 2023 16:56:48 GMT
Etag: W/"c9f88dbeb76b7a803330ddb59c27ae2b"
Referrer-Policy: strict-origin-when-cross-origin
Strict-Transport-Security: max-age=15724800; includeSubDomains
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-Request-Id: 739040d9c2d701ab1bdd8472512b8708
X-Xss-Protection: 1; mode=block
{"servers":[{"metro":"sv","plan":"c3.medium.x86","quantity":"4","available":true},{"metro":"sv","plan":"m3.large.x86","quantity":"4","available":true},{"metro":"da","plan":"c3.medium.x86","quantity":"4","available":true},{"metro":"da","plan":"m3.large.x86","quantity":"4","available":true}]}
+-------+------+----------+--------------+
| METRO | PLAN | QUANTITY | AVAILABILITY |
+-------+------+----------+--------------+
| | | 0 | false |
| | | 0 | false |
| | | 0 | false |
| | | 0 | false |
+-------+------+----------+--------------+
It looks like the spec was updated to specify the quantity
field as an integer, but the response still has it as a double-quoted string:
{"metro":"sv","plan":"c3.medium.x86","quantity":"4","available":true}
This was fixed with a local patch in #143 and then fixed with an upstream fix to the official API spec in #161.
Description:
The quantity filed type is changed from string to int32 (v0.17.0 - v0.19.0). But it returns zero in all cases.