hetzner_robot_rhai/examples/server_ordering.rhai

49 lines
1.9 KiB
Plaintext

/// --- Get all available products (servers) that we can order and print them in a table
// let available_server_products = hetzner.get_server_ordering_product_overview();
// available_server_products.pretty_print();
/// --- List the details from a specific sever product based on the ID
// let example_server_product = hetzner.get_server_ordering_product_by_id("AX41-NVMe");
// print(example_server_product);
/// --- 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("2739567");
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);