update README.md

This commit is contained in:
Maxime Van Hees 2025-07-15 16:28:08 +02:00
parent b4200a2673
commit c478d668d9

View File

@ -4,7 +4,7 @@ This project provides a Rhai wrapper for interacting with the Hetzner Cloud API,
## Setup
To use this wrapper, you need to set your Hetzner API Token as an environment variable.
To use this wrapper, you need to set your Hetzner API Token as an environment variable. You can create your own API Token by following the steps [from the Hetzner docs](https://docs.hetzner.com/cloud/api/getting-started/generating-api-token/).
```bash
export HETZNER_API_TOKEN="YOUR_API_TOKEN_HERE"
@ -71,3 +71,51 @@ client.disable_rescue_mode(test_server.id);
// Reboot server
print(`Rebooting server with ID: ${test_server.id}`);
client.reboot(test_server.id);
```
### 4. Example Output (from `test.rhai` script)
```text
Listing all servers...
+-------------+-------------------+---------+-------------+
| Server List | | | |
+=============+===================+=========+=============+
| ID | Name | Status | Public IPv4 |
+-------------+-------------------+---------+-------------+
| 104298257 | ubuntu-4gb-fsn1-2 | Running | 91.99.1.255 |
+-------------+-------------------+---------+-------------+
| 104301883 | ubuntu-4gb-fsn1-4 | Running | 91.99.178.6 |
+-------------+-------------------+---------+-------------+
Listing details from server with ID 104301883...
+-------------------+----------------------+
| ubuntu-4gb-fsn1-4 | |
+===================+======================+
| ID | 104301883 |
+-------------------+----------------------+
| Status | Running |
+-------------------+----------------------+
| Created | 2025-07-15T12:25:29Z |
+-------------------+----------------------+
| IPv4 | 91.99.178.6 |
+-------------------+----------------------+
| Type | cx22 |
+-------------------+----------------------+
| Included Traffic | 20480 GB |
+-------------------+----------------------+
| Ingoing Traffic | 0 MB |
+-------------------+----------------------+
| Outgoing Traffic | 0 MB |
+-------------------+----------------------+
| Primary Disk Size | 40 |
+-------------------+----------------------+
| 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
```