hetzner_rhai/examples/03_get_server_details.rhai
2025-07-17 14:03:49 +02:00

15 lines
676 B
Plaintext

// This script demonstrates how to retrieve detailed information for a specific server.
// Initialize the Hetzner client with your API token.
let client = new_hetzner_client(get_env("HETZNER_API_TOKEN"));
// Replace this with the ID of the server you want to inspect.
// You can get the server ID by listing all servers (see 02_list_servers.rhai).
let server_id = 104298257; // FIXME: Replace with your own ID
// Get the server object by its ID.
print(`Fetching details for server with ID: ${server_id}...`);
let server = client.get_server(server_id);
// The `show_details` method provides a comprehensive overview of the server's properties.
print(server.show_details());