added all requirements to order auction server + tested it

This commit is contained in:
Maxime Van Hees
2025-07-23 15:33:33 +02:00
parent a92b896d17
commit 721f918270
7 changed files with 312 additions and 177 deletions

View File

@@ -27,22 +27,23 @@
// auctioned_servers.pretty_print();
/// --- Get information about one specific auctioned server by ID
let auctioned_server = hetzner.get_auction_server_product_by_id("2739567");
print(auctioned_server);
// let auctioned_server = hetzner.get_auction_server_product_by_id("2739642");
// print(auctioned_server);
/// --- Order an auction server
// 1. Grab the SSH key to pass to the deployment
let ssh_key = hetzner.get_ssh_key("e0:73:80:26:80:46:f0:c8:bb:74:f4:d0:2d:10:2d:6f");
// 2. Order the auctioned server
let transaction = hetzner.order_auction_server(
auctioned_server.id,
[ssh_key], // Pass ssh_key as an array
(), // dist (Option<String>)
(), // arch (Option<String>)
(), // lang (Option<String>)
(), // comment (Option<String>)
[], // addons (Array)
(), // test (Option<bool>)
);
print(transaction);
// 2. Use the builder to bundle the details on what to order
// let order_builder = new_auction_server_builder(2741558)
// .with_authorized_keys([ssh_key.fingerprint])
// .with_lang("en")
// .with_comment("test")
// .with_test(false);
// let ordered_auction_server = hetzner.order_auction_server(order_builder);
// print(ordered_auction_server);
// --> we get a transaction ID from this --> which we can use to fetch information about the transaction
// e.g. B20250723-3204053-2775263
let transaction = hetzner.get_auction_transaction_by_id("B20250723-3204053-2775263");
print(transaction)