Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated metal-go client for sub-command devices (#282)
Breakout from #270 What this PR does / why we need it: This PR replaces packngo with metal-go for all interactions with the Equinix Metal API specifically for Device sub commands Test Results: ================ # Retrieve ## Cmd: metal devices get * Packngo: ``` vasu@vasu-cloud:~/Equinix$ metal devices get +--------------------------------------+-------------------------------------+------------------+--------+----------------------+ | ID | HOSTNAME | OS | STATE | CREATED | +--------------------------------------+-------------------------------------+------------------+--------+----------------------+ | d231a5d0-3da9-4e4b-bbd6-a367c4c2d34b | test-staging-2 | Ubuntu 20.04 LTS | active | 2023-06-01T08:42:42Z | | bcab4df0-945e-4cb5-a8c7-f9dfbaabb3d7 | eksa-node-003 | Custom iPXE | active | 2023-04-25T12:33:17Z | | 09be98b7-0db6-4fdb-90be-901ab847158d | test-packngo | Ubuntu 20.04 LTS | active | 2023-06-26T13:09:24Z | | b396c4fd-c412-4a25-b6b4-df6f2f548629 | test-staging-12 | Ubuntu 22.04 LTS | active | 2023-06-01T08:43:12Z | | bad6f156-4777-49a5-87e7-d038e7365c9e | capi-quickstart-control-plane-mkz7l | Ubuntu 22.04 LTS | active | 2023-05-03T09:42:52Z | | d7126b67-a96f-48b7-9cf1-e1914d84235b | capi-quickstart-worker-a-spr64 | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:01Z | | 4c397b2d-eccf-4948-9fcf-2b325303048c | capi-quickstart-control-plane-98xjq | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:05Z | | bdbe09fa-d140-4cc9-b988-f51610e8c2f3 | capi-quickstart-worker-a-q89f8 | Ubuntu 22.04 LTS | active | 2023-05-03T09:47:59Z | | 67992861-066b-4d76-a6a4-a21b3e855722 | capi-quickstart-worker-a-qqnhb | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:00Z | | b15870cd-a83d-48bd-9552-5281162ae563 | capi-quickstart-control-plane-lxnsr | Ubuntu 22.04 LTS | active | 2023-05-03T09:54:11Z | | 2f6d7ff2-6aa5-49bc-838a-97a3473ea16a | eksa-node-002 | Custom iPXE | active | 2023-04-24T18:24:15Z | | 46005014-5256-41b3-938a-1b295f931aa2 | eksa-node-001 | Custom iPXE | active | 2023-04-24T18:24:12Z | | c3b1006c-0422-4f01-9c96-24dbcd72f7f1 | eksa-admin | Ubuntu 20.04 LTS | active | 2023-04-24T18:22:35Z | +--------------------------------------+-------------------------------------+------------------+--------+----------------------+ ``` * Metal-Go ``` vasu@vasu-cloud:~/Equinix$ metal devices get +--------------------------------------+-------------------------------------+------------------+--------+----------------------+ | ID | HOSTNAME | OS | STATE | CREATED | +--------------------------------------+-------------------------------------+------------------+--------+----------------------+ | d231a5d0-3da9-4e4b-bbd6-a367c4c2d34b | test-staging-2 | Ubuntu 20.04 LTS | active | 2023-06-01T08:42:42Z | | bcab4df0-945e-4cb5-a8c7-f9dfbaabb3d7 | eksa-node-003 | Custom iPXE | active | 2023-04-25T12:33:17Z | | 09be98b7-0db6-4fdb-90be-901ab847158d | test-packngo | Ubuntu 20.04 LTS | active | 2023-06-26T13:09:24Z | | b396c4fd-c412-4a25-b6b4-df6f2f548629 | test-staging-12 | Ubuntu 22.04 LTS | active | 2023-06-01T08:43:12Z | | bad6f156-4777-49a5-87e7-d038e7365c9e | capi-quickstart-control-plane-mkz7l | Ubuntu 22.04 LTS | active | 2023-05-03T09:42:52Z | | d7126b67-a96f-48b7-9cf1-e1914d84235b | capi-quickstart-worker-a-spr64 | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:01Z | | 4c397b2d-eccf-4948-9fcf-2b325303048c | capi-quickstart-control-plane-98xjq | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:05Z | | bdbe09fa-d140-4cc9-b988-f51610e8c2f3 | capi-quickstart-worker-a-q89f8 | Ubuntu 22.04 LTS | active | 2023-05-03T09:47:59Z | | 67992861-066b-4d76-a6a4-a21b3e855722 | capi-quickstart-worker-a-qqnhb | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:00Z | | b15870cd-a83d-48bd-9552-5281162ae563 | capi-quickstart-control-plane-lxnsr | Ubuntu 22.04 LTS | active | 2023-05-03T09:54:11Z | | 2f6d7ff2-6aa5-49bc-838a-97a3473ea16a | eksa-node-002 | Custom iPXE | active | 2023-04-24T18:24:15Z | | 46005014-5256-41b3-938a-1b295f931aa2 | eksa-node-001 | Custom iPXE | active | 2023-04-24T18:24:12Z | | c3b1006c-0422-4f01-9c96-24dbcd72f7f1 | eksa-admin | Ubuntu 20.04 LTS | active | 2023-04-24T18:22:35Z | +--------------------------------------+-------------------------------------+------------------+--------+----------------------+ ``` ## Cmd: metal devices get -p <Project_ID> * Packngo: ``` vasu@vasu-cloud:~/Equinix$ metal devices get -p 65dcd8f4-abd4-4e7a-8b29-da4b030edd96 +--------------------------------------+-------------------------------------+------------------+--------+----------------------+ | ID | HOSTNAME | OS | STATE | CREATED | +--------------------------------------+-------------------------------------+------------------+--------+----------------------+ | d231a5d0-3da9-4e4b-bbd6-a367c4c2d34b | test-staging-2 | Ubuntu 20.04 LTS | active | 2023-06-01T08:42:42Z | | bcab4df0-945e-4cb5-a8c7-f9dfbaabb3d7 | eksa-node-003 | Custom iPXE | active | 2023-04-25T12:33:17Z | | 09be98b7-0db6-4fdb-90be-901ab847158d | test-packngo | Ubuntu 20.04 LTS | active | 2023-06-26T13:09:24Z | | b396c4fd-c412-4a25-b6b4-df6f2f548629 | test-staging-12 | Ubuntu 22.04 LTS | active | 2023-06-01T08:43:12Z | | bad6f156-4777-49a5-87e7-d038e7365c9e | capi-quickstart-control-plane-mkz7l | Ubuntu 22.04 LTS | active | 2023-05-03T09:42:52Z | | d7126b67-a96f-48b7-9cf1-e1914d84235b | capi-quickstart-worker-a-spr64 | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:01Z | | 4c397b2d-eccf-4948-9fcf-2b325303048c | capi-quickstart-control-plane-98xjq | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:05Z | | bdbe09fa-d140-4cc9-b988-f51610e8c2f3 | capi-quickstart-worker-a-q89f8 | Ubuntu 22.04 LTS | active | 2023-05-03T09:47:59Z | | 67992861-066b-4d76-a6a4-a21b3e855722 | capi-quickstart-worker-a-qqnhb | Ubuntu 22.04 LTS | active | 2023-05-03T09:48:00Z | | b15870cd-a83d-48bd-9552-5281162ae563 | capi-quickstart-control-plane-lxnsr | Ubuntu 22.04 LTS | active | 2023-05-03T09:54:11Z | | 2f6d7ff2-6aa5-49bc-838a-97a3473ea16a | eksa-node-002 | Custom iPXE | active | 2023-04-24T18:24:15Z | | 46005014-5256-41b3-938a-1b295f931aa2 | eksa-node-001 | Custom iPXE | active | 2023-04-24T18:24:12Z | | c3b1006c-0422-4f01-9c96-24dbcd72f7f1 | eksa-admin | Ubuntu 20.04 LTS | active | 2023-04-24T18:22:35Z | +--------------------------------------+-------------------------------------+------------------+--------+----------------------+ ``` * Metal-Go ``` vasu@vasu-cloud:~/Equinix/metal-cli/bin$ ./metal devices get -p 65dcd8f4-abd4-4e7a-8b29-da4b030edd96 +--------------------------------------+-------------------------------------+------------------+--------+-------------------------------+ | ID | HOSTNAME | OS | STATE | CREATED | +--------------------------------------+-------------------------------------+------------------+--------+-------------------------------+ | d231a5d0-3da9-4e4b-bbd6-a367c4c2d34b | test-staging-2 | Ubuntu 20.04 LTS | active | 2023-06-01 08:42:42 +0000 UTC | | bcab4df0-945e-4cb5-a8c7-f9dfbaabb3d7 | eksa-node-003 | Custom iPXE | active | 2023-04-25 12:33:17 +0000 UTC | | 09be98b7-0db6-4fdb-90be-901ab847158d | test-packngo | Ubuntu 20.04 LTS | active | 2023-06-26 13:09:24 +0000 UTC | | b396c4fd-c412-4a25-b6b4-df6f2f548629 | test-staging-12 | Ubuntu 22.04 LTS | active | 2023-06-01 08:43:12 +0000 UTC | | bad6f156-4777-49a5-87e7-d038e7365c9e | capi-quickstart-control-plane-mkz7l | Ubuntu 22.04 LTS | active | 2023-05-03 09:42:52 +0000 UTC | | d7126b67-a96f-48b7-9cf1-e1914d84235b | capi-quickstart-worker-a-spr64 | Ubuntu 22.04 LTS | active | 2023-05-03 09:48:01 +0000 UTC | | 4c397b2d-eccf-4948-9fcf-2b325303048c | capi-quickstart-control-plane-98xjq | Ubuntu 22.04 LTS | active | 2023-05-03 09:48:05 +0000 UTC | | bdbe09fa-d140-4cc9-b988-f51610e8c2f3 | capi-quickstart-worker-a-q89f8 | Ubuntu 22.04 LTS | active | 2023-05-03 09:47:59 +0000 UTC | | 67992861-066b-4d76-a6a4-a21b3e855722 | capi-quickstart-worker-a-qqnhb | Ubuntu 22.04 LTS | active | 2023-05-03 09:48:00 +0000 UTC | | b15870cd-a83d-48bd-9552-5281162ae563 | capi-quickstart-control-plane-lxnsr | Ubuntu 22.04 LTS | active | 2023-05-03 09:54:11 +0000 UTC | | 2f6d7ff2-6aa5-49bc-838a-97a3473ea16a | eksa-node-002 | Custom iPXE | active | 2023-04-24 18:24:15 +0000 UTC | | 46005014-5256-41b3-938a-1b295f931aa2 | eksa-node-001 | Custom iPXE | active | 2023-04-24 18:24:12 +0000 UTC | | c3b1006c-0422-4f01-9c96-24dbcd72f7f1 | eksa-admin | Ubuntu 20.04 LTS | active | 2023-04-24 18:22:35 +0000 UTC | +--------------------------------------+-------------------------------------+------------------+--------+-------------------------------+ ``` ## Cmd: metal devices get -i <Device ID> * Packngo: ``` vasu@vasu-cloud:~/Equinix$ metal devices get -i 09be98b7-0db6-4fdb-90be-901ab847158d +--------------------------------------+--------------+------------------+--------+----------------------+ | ID | HOSTNAME | OS | STATE | CREATED | +--------------------------------------+--------------+------------------+--------+----------------------+ | 09be98b7-0db6-4fdb-90be-901ab847158d | test-packngo | Ubuntu 20.04 LTS | active | 2023-06-26T13:09:24Z | +--------------------------------------+--------------+------------------+--------+----------------------+ ``` *Metal-go: ``` vasu@vasu-cloud:~/Equinix/metal-cli/bin$ ./metal devices get -i 09be98b7-0db6-4fdb-90be-901ab847158d +--------------------------------------+--------------+------------------+--------+-------------------------------+ | ID | HOSTNAME | OS | STATE | CREATED | +--------------------------------------+--------------+------------------+--------+-------------------------------+ | 09be98b7-0db6-4fdb-90be-901ab847158d | test-packngo | Ubuntu 20.04 LTS | active | 2023-06-26 13:09:24 +0000 UTC | +--------------------------------------+--------------+------------------+--------+-------------------------------+ ``` # Create ``` Vasubabus-MacBook-Pro:bin vasubabu$ ./metal device create -p c309ce2c-160d-47e2-bb26-9debeb0be87d -P m3.small.x86 -m da -O ubuntu_20_04 -H create-device-dev-cdata --customdata '{"testDate":"fromCli"}' +--------------------------------------+-------------------------+------------------+--------+-------------------------------+ | ID | HOSTNAME | OS | STATE | CREATED | +--------------------------------------+-------------------------+------------------+--------+-------------------------------+ | 8dc6920e-cf5a-4852-994d-a53094fe9673 | create-device-dev-cdata | Ubuntu 20.04 LTS | queued | 2023-08-24 10:28:29 +0000 UTC | +--------------------------------------+-------------------------+------------------+--------+-------------------------------+ Vasubabus-MacBook-Pro:bin vasubabu$ ./metal device create -p c309ce2c-160d-47e2-bb26-9debeb0be87d -P m3.small.x86 -m da -O ubuntu_20_04 -H create-dev-cdata --customdata '{"testDate":""}' +--------------------------------------+------------------+------------------+--------+-------------------------------+ | ID | HOSTNAME | OS | STATE | CREATED | +--------------------------------------+------------------+------------------+--------+-------------------------------+ | a45f8746-f3b5-4fc5-8fe6-b4fa6493d365 | create-dev-cdata | Ubuntu 20.04 LTS | queued | 2023-08-24 10:40:50 +0000 UTC | +--------------------------------------+------------------+------------------+--------+-------------------------------+ ``` ``` Vasubabus-MacBook-Pro:bin vasubabu$ ./metal device create -p c309ce2c-160d-47e2-bb26-9debeb0be87d --hostname netboot-custom-ipxe-1 --plan c3.small.x86 --metro sv --operating-system custom_ipxe --userdata='#!ipxe chain -ar https://boot.netboot.xyz' --always-pxe=true +--------------------------------------+-----------------------+-------------+--------+-------------------------------+ | ID | HOSTNAME | OS | STATE | CREATED | +--------------------------------------+-----------------------+-------------+--------+-------------------------------+ | b149fc32-bcfd-44c8-9c0e-9e5d49d382e0 | netboot-custom-ipxe-1 | Custom iPXE | queued | 2023-08-24 10:48:33 +0000 UTC | +--------------------------------------+-----------------------+-------------+--------+-------------------------------+ <img width="1430" alt="image" src="https://github.com/equinix/metal-cli/assets/3358152/ea4d5a5a-b495-40e7-a7ec-e3a6905ac5c7"> ``` ``` Vasubabus-MacBook-Pro:bin vasubabu$ ./metal device create -p c309ce2c-160d-47e2-bb26-9debeb0be87d --hostname netboot-custom-ipxe --plan c3.small.x86 --metro sv --operating-system custom_ipxe --userdata='#!ipxe > chain -ar https://boot.netboot.xyz' +--------------------------------------+---------------------+-------------+--------+-------------------------------+ | ID | HOSTNAME | OS | STATE | CREATED | +--------------------------------------+---------------------+-------------+--------+-------------------------------+ | 4aa8977b-259b-4684-a3b4-9ff49e96db47 | netboot-custom-ipxe | Custom iPXE | queued | 2023-08-24 10:44:02 +0000 UTC | +--------------------------------------+---------------------+-------------+--------+-------------------------------+ <img width="1416" alt="image" src="https://github.com/equinix/metal-cli/assets/3358152/a9ff3f36-4716-4cbd-a9be-cc2dc8e672b7"> ```
- Loading branch information