implemented additional server functions

This commit is contained in:
Maxime Van Hees
2025-07-18 15:40:42 +02:00
parent 6082ecc6d1
commit 84aa8cc11d
8 changed files with 319 additions and 63 deletions

View File

@@ -1,9 +1,21 @@
// Get all servers and print them in a table
let servers = hetzner.get_servers();
print(servers);
servers.pretty_print();
// let servers = hetzner.get_servers();
// servers.pretty_print();
// Get a specific server and print its details
// Replace 1825193 with the server number you want to fetch
let server = hetzner.get_server(1825193);
print(server);
// // Get a specific server and print its details
// // Replace 2550253 with the server number you want to fetch
// let server = hetzner.get_server(2550253);
// print(server);
// Update the name of a specific server and print it
// print(hetzner.update_server_name(2550253, "kristof-123456"));
// Query cancellation data for a server
let c_d = hetzner.get_cancellation_data(2550253);
print(c_d);
// Cancel a server
// Replace 2550253 with the server number you want to cancel
// Replace "2014-04-15" with the desired cancellation date
let cancelled_server = hetzner.cancel_server(2550253, "2014-04-15");
print(cancelled_server);

View File

@@ -1,22 +1,22 @@
// Get all SSH keys and print them in a table
let keys = hetzner.get_ssh_keys();
print(keys);
keys.pretty_print();
// Get a specific SSH key
// Replace "13:dc:a2:1e:a9:d2:1d:a9:39:f4:44:c5:f1:00:ec:c7" with the fingerprint of the key you want to fetch
let key = hetzner.get_ssh_key("13:dc:a2:1e:a9:d2:1d:a9:39:f4:44:c5:f1:00:ec:c7");
print(key);
// let key = hetzner.get_ssh_key("13:dc:a2:1e:a9:d2:1d:a9:39:f4:44:c5:f1:00:ec:c7");
// print(key);
// Add a new SSH key
// Replace "my-new-key" with the desired name and "ssh-rsa ..." with your public key data
let new_key = hetzner.add_ssh_key("my-new-key", "ssh-rsa ...");
print(new_key);
// let new_key = hetzner.add_ssh_key("vanheesm@incubaid.com", "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFyZJCEsvRc0eitsOoq+ywC5Lmqejvk3hXMVbO0AxPrd");
// print(new_key);
// Update an SSH key's name
// Replace "cb:8b:ef:a7:fe:04:87:3f:e5:55:cd:12:e3:e8:9f:99" with the fingerprint of the key you want to update
let updated_key = hetzner.update_ssh_key_name("cb:8b:ef:a7:fe:04:87:3f:e5:55:cd:12:e3:e8:9f:99", "my-updated-key-name");
print(updated_key);
// let updated_key = hetzner.update_ssh_key_name("e0:73:80:26:80:46:f0:c8:bb:74:f4:d0:2d:10:2d:6f", "my-updated-key-name");
// print(updated_key);
// Delete an SSH key
// Replace "cb:8b:ef:a7:fe:04:87:3f:e5:55:cd:12:e3:e8:9f:99" with the fingerprint of the key you want to delete
hetzner.delete_ssh_key("cb:8b:ef:a7:fe:04:87:3f:e5:55:cd:12:e3:e8:9f:99");
// hetzner.delete_ssh_key("e1:a7:27:ed:12:77:6a:4c:3a:cd:30:18:c4:f3:d0:88");