51 lines
1.4 KiB
Plaintext
51 lines
1.4 KiB
Plaintext
// Example 6: Creating and working with DNS Zones
|
|
|
|
print("=== DNS Zone Example ===\n");
|
|
|
|
// Get a context to work with
|
|
print("1. Getting context...");
|
|
let ctx = get_context(["alice", "bob"]);
|
|
print(" ✓ Context created: " + ctx.context_id());
|
|
|
|
// Create DNS zones with builder pattern
|
|
print("\n2. Creating DNS zones...");
|
|
|
|
let example_zone = new_dns_zone()
|
|
.domain("example.com");
|
|
|
|
print(" ✓ Created DNS zone: example.com");
|
|
|
|
let test_zone = new_dns_zone()
|
|
.domain("test.org");
|
|
|
|
print(" ✓ Created DNS zone: test.org");
|
|
|
|
let dev_zone = new_dns_zone()
|
|
.domain("dev.local");
|
|
|
|
print(" ✓ Created DNS zone: dev.local");
|
|
|
|
// Display DNS zone info
|
|
print("\n3. DNS Zone information...");
|
|
print(" Example Zone ID: " + example_zone.get_id());
|
|
print(" Example Zone domain: " + example_zone.get_domain());
|
|
|
|
print(" Test Zone ID: " + test_zone.get_id());
|
|
print(" Test Zone domain: " + test_zone.get_domain());
|
|
|
|
print(" Dev Zone ID: " + dev_zone.get_id());
|
|
print(" Dev Zone domain: " + dev_zone.get_domain());
|
|
|
|
// Save DNS zones to context
|
|
print("\n4. Saving DNS zones to context...");
|
|
let example_id = ctx.save(example_zone);
|
|
print(" ✓ Saved example.com with ID: " + example_id);
|
|
|
|
let test_id = ctx.save(test_zone);
|
|
print(" ✓ Saved test.org with ID: " + test_id);
|
|
|
|
let dev_id = ctx.save(dev_zone);
|
|
print(" ✓ Saved dev.local with ID: " + dev_id);
|
|
|
|
print("\n=== DNS Zone Example Complete ===");
|