updated readme about ssh key ids listing

This commit is contained in:
Maxime Van Hees 2025-07-15 17:08:18 +02:00
parent 841901368f
commit 1839cfd002
2 changed files with 25 additions and 10 deletions

View File

@ -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
```

View File

@ -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());