first commit: added functionality for server listing, ssh key management and boot configuration management
This commit is contained in:
		
							
								
								
									
										21
									
								
								examples/boot_management.rhai
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								examples/boot_management.rhai
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
// Get the boot configuration for a server
 | 
			
		||||
// Replace 1825193 with the server number you want to fetch
 | 
			
		||||
let boot_config = hetzner.get_boot_configuration(1825193);
 | 
			
		||||
print(boot_config);
 | 
			
		||||
 | 
			
		||||
// Get the rescue boot configuration for a server
 | 
			
		||||
// Replace 1825193 with the server number you want to fetch
 | 
			
		||||
let rescue_config = hetzner.get_rescue_boot_configuration(1825193);
 | 
			
		||||
print(rescue_config);
 | 
			
		||||
 | 
			
		||||
// Enable rescue mode
 | 
			
		||||
// Replace 1825193 with the server number you want to enable rescue mode on
 | 
			
		||||
// Replace "linux" with the desired OS
 | 
			
		||||
// Replace the fingerprint with your SSH key fingerprint
 | 
			
		||||
//let enabled_rescue = hetzner.enable_rescue_mode(1825193, "linux", ["13:dc:a2:1e:a9:d2:1d:a9:39:f4:44:c5:f1:00:ec:c7"]);
 | 
			
		||||
//print(enabled_rescue);
 | 
			
		||||
 | 
			
		||||
// Disable rescue mode
 | 
			
		||||
// Replace 1825193 with the server number you want to disable rescue mode on
 | 
			
		||||
//let disabled_rescue = hetzner.disable_rescue_mode(1825193);
 | 
			
		||||
//print(disabled_rescue);
 | 
			
		||||
							
								
								
									
										9
									
								
								examples/server_management.rhai
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								examples/server_management.rhai
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
// Get all servers and print them in a table
 | 
			
		||||
let servers = hetzner.get_servers();
 | 
			
		||||
print(servers);
 | 
			
		||||
print_servers_table(servers);
 | 
			
		||||
 | 
			
		||||
// 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_details(server);
 | 
			
		||||
							
								
								
									
										22
									
								
								examples/ssh_key_management.rhai
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								examples/ssh_key_management.rhai
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
// Get all SSH keys and print them in a table
 | 
			
		||||
let keys = hetzner.get_ssh_keys();
 | 
			
		||||
print_ssh_keys_table(keys);
 | 
			
		||||
 | 
			
		||||
// 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);
 | 
			
		||||
 | 
			
		||||
// 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);
 | 
			
		||||
 | 
			
		||||
// 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);
 | 
			
		||||
 | 
			
		||||
// 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");
 | 
			
		||||
		Reference in New Issue
	
	Block a user