61 lines
2.5 KiB
Plaintext
61 lines
2.5 KiB
Plaintext
/// --- Get all available products (servers) that we can order and print them in a table
|
|
// let available_server_products = hetzner.get_server_products();
|
|
// available_server_products.pretty_print();
|
|
|
|
/// --- List the details from a specific sever product based on the ID
|
|
// let example_server_product = hetzner.get_server_product_by_id("AX41-NVMe");
|
|
// print(example_server_product);
|
|
|
|
/// --- Order a 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. Use the builder to bundle the details on what to order
|
|
let order_builder = new_server_builder("AX41-NVMe")
|
|
.with_authorized_keys([ssh_key.fingerprint])
|
|
.with_test(true);
|
|
|
|
let ordered_server_transaction = hetzner.order_server(order_builder);
|
|
print(ordered_server_transaction);
|
|
|
|
|
|
/// --- List all the transactions from the past 30 days
|
|
// let transactions_last_30 = hetzner.get_transactions();
|
|
// print(transactions_last_30);
|
|
|
|
/// --- Fetch a transcation by ID
|
|
// let example_transaction = hetzner.get_transaction_by_id("120000706572");
|
|
// print(example_transaction);
|
|
|
|
/// --- List all the auction transaction from the past 30 days
|
|
// let auction_transactions_last_30 = hetzner.get_auction_transactions();
|
|
// auction_transactions_last_30.pretty_print();
|
|
|
|
/// --- Fetch a auction transaction by ID
|
|
// let example_auction_transaction = hetzner.get_auction_transaction_by_id("");
|
|
// print(example_auction_transaction);
|
|
|
|
/// --- List all the auctioned server products
|
|
// let auctioned_servers = hetzner.get_auction_server_products();
|
|
// auctioned_servers.pretty_print();
|
|
|
|
/// --- Get information about one specific auctioned server by ID
|
|
// 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. 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) |