From 1839cfd002d111ac0cbc9863b3e0cb0f8545251b Mon Sep 17 00:00:00 2001 From: Maxime Van Hees Date: Tue, 15 Jul 2025 17:08:18 +0200 Subject: [PATCH] updated readme about ssh key ids listing --- README.md | 33 ++++++++++++++++++++++++--------- test.rhai | 2 +- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e08d064..b84c4b9 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,18 @@ let test_server = client.get_server(104301883); print(test_server.show_details()); ``` -### 3. Manage Server State +### 3. List SSH Keys + +You can also list all the SSH keys in your project. + +```rust +// List all SSH keys and print in table +print("Listing all SSH keys..."); +let ssh_keys = client.list_ssh_keys(); +print(ssh_keys.show_table()); +``` + +### 4. Manage Server State Perform actions like enabling rescue mode, disabling it, or rebooting the server. @@ -95,7 +106,7 @@ if ssh_key_from_env != "" { } ``` -### 4. Example Output (from `test.rhai` script) +### 5. Example Output (from `test.rhai` script) ```text Listing all servers... @@ -109,6 +120,17 @@ Listing all servers... | 104301883 | ubuntu-4gb-fsn1-4 | Running | 91.99.178.6 | +-------------+-------------------+---------+-------------+ +Listing all SSH keys... ++-----------+------------------------------+-------------------------------------------------+ +| SSH Keys | | | ++===========+==============================+=================================================+ +| ID | Name | Fingerprint | ++-----------+------------------------------+-------------------------------------------------+ +| 100324992 | mahmmoud.hassanein@gmail.com | 45:67:42:b7:e0:38:0d:40:40:80:a6:8a:0d:ac:73:6b | ++-----------+------------------------------+-------------------------------------------------+ +| 100325001 | maxime@maxime-arch | e0:73:80:26:80:46:f0:c8:bb:74:f4:d0:2d:10:2d:6f | ++-----------+------------------------------+-------------------------------------------------+ + Listing details from server with ID 104301883... +-------------------+----------------------+ | ubuntu-4gb-fsn1-4 | | @@ -133,11 +155,4 @@ Listing details from server with ID 104301883... +-------------------+----------------------+ | Rescue Enabled | false | +-------------------+----------------------+ - -Enabling rescue mode on server with ID: 104301883 -Root password is: wNMnAWwkfJEA - -Disabling rescue mode on server with ID: 104301883 - -Rebooting server with ID: 104301883 ``` diff --git a/test.rhai b/test.rhai index 39a46f0..df2c6bd 100644 --- a/test.rhai +++ b/test.rhai @@ -24,7 +24,7 @@ print(test_server.show_details()); let ssh_keys = [100324992, 100325001]; let root_password = client.enable_rescue_mode(test_server.id, ssh_keys); -// // read SSH key from env var and use it for rescue mode +// Read SSH key from env var and use it for rescue mode // let ssh_key_from_env = get_env("SSH_KEY_ID"); // if ssh_key_from_env != "" { // client.enable_rescue_mode(test_server.id, ssh_key_from_env.parse_int());