Closed alexellis closed 7 years ago
To my knowledge, there is no API to query public IPs by device id. The tool itself doesn't also provide this capability . You can however pipe the output to jq to filter the IPs assigned to the device:
$ packet baremetal list-devices |jq '.[].ip_addresses[0]'
{
"address_family": 4,
"cidr": 31,
"address": "147.75.203.139",
"gateway": "147.75.203.138",
"public": true,
"network": "147.75.203.138",
"netmask": "255.255.255.254"
}
$ packet baremetal list-devices |jq '.[].ip_addresses[1]'
{
"address_family": 6,
"cidr": 127,
"address": "2604:1380:1000:2300::1",
"gateway": "2604:1380:1000:2300::",
"public": true,
"network": "2604:1380:1000:2300::",
"netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:fffe"
}
They always come in the same order...
To view all IPs reserved for the project, you can use the network
service:
$ packet network list-ip-reservations
[
{
"id": "d6a8c95b-090e-47ed-9b12-b59e7c6b0909",
"network": "2604:1380:1:da00::",
"address": "",
"address_family": 6,
"netmask": "ffff:ffff:ffff:ff00:0000:0000:0000:0000",
"public": true,
"cidr": 56,
"management": false,
"manageable": true,
"addon": false,
"bill": false,
"assignments": [],
"href": "/ips/d6a8c95b-090e-47ed-9b12-b59e7c6b0909"
},
...
How can I query public IPs from list-devices?