-
Notifications
You must be signed in to change notification settings - Fork 6
API Reference
To call an API function, you simply have to issue a SQL SELECT query on that function. Example:
SELECT api.get_current_user();
The query result will be the return value (if any) of that function. If an error occurs, the API throws an exception and aborts the query returning the error. It is up to the client to display that error.
Some functions allow NULL to be passed in. This usually will set the value to the site default value. An example of this is the function api.create_dns_address() The TTL input can take an integer or NULL, which will default to the site default value (300). You can specify this by executing the query:
SELECT api.create_dns_address('192.168.0.1','localhost','localdomain',NULL,'username');
Note that the word NULL is not surrounded with double or single quotes. Passing in something like '' technically passes an empty string, which is not the same as not null. Note that you cant do this with an integer anyway, but this also applies to comments (which can be NULL).
A system object corresponds to a physical computer.
api.create_system([system_name],[owner_username OR NULL],[system_type],[os_name],[comment OR NULL])
A site is comprised of one or many subnets. These are the IP addresses that you have control over.
api.create_subnet([subnet],[name],[autogenerate],[comment OR NULL])
Ranges of addresses can be configured for logical management of address resources.
api.create_ip_range([first_ip],[last_ip],[subnet],[use],[comment OR NULL])
DHCP classes can have special options sent to the client (pxeboot, etc)
api.create_dhcp_class([class],[comment OR NULL])
Specify an option for a DHCP class
api.create_dhcp_class_option([class],[option],[value])
Subnets can have different options (usually for routers, dns servers, etc)
api.create_dhcp_subnet_option([subnet],[option],[value])
To execute an update on a zone, a key is used to authenticate with the server
api.create_dns_key([keyname],[key],[comment OR NULL],[last_modifier])
DNS zones (domains) are the names under your control.
api.create_dns_zone([zone],[keyname],[forward],[comment OR NULL],[last_modifier])
Interfaces correspond to a NIC in the computer system. They are identified with the MAC address.
api.create_interface([system_name],[interface_name],[mac_address],[comment OR NULL])
Specify the address that you want for an interface
api.create_interface_address_manual([interface_mac_address],[ip_address],[configuration],[class],[comment OR NULL])
Only specify the range that you fall under, rather than the exact address
api.create_interface_address_manual([interface_mac_address],[range_name],[configuration],[class],[comment OR NULL])
An address can have zero or one address record. This is also used for reverse dns on that address. It is highly recommended to always do this. The client is responsible for yelling at the user to make one.
api.create_dns_address([ip_address],[hostname],[domain (zone)],[TTL OR NULL],[owner OR NULL])
api.delete_system([system_name])
api.delete_subnet([subnet])
api.delete_ip_range([first_ip],[last_ip])
api.delete_dhcp_class([class])
api.delete_dhcp_class_option([class],[option],[value])
api.delete_dhcp_subnet_option([subnet],[option],[value])
api.delete_dns_key([keyname])
api.delete_dns_zone([zone])
api.delete_interface([mac_address])
api.delete_interface_address([ip_address])
api.delete_dns_address([ip_address])
If you need to place a message in the log, this is how you do it
api.create_log_entry([source], [INFO|DEBUG|ERROR], [message])
The database creates a temporary table when you call the api.initialize() function. This is it's way of seeing who it thinks you are.
api.get_current_user()
Check if a given hostname, domain, or FQDN is RFC compliant, and thus valid for use. The database will handle this, but the client can have an option to verify a name if the user is not sure.
api.validate_domain([hostname OR NULL],[domain OR NULL])
Systems expire after a year, and will automatically delete themselves if the user does not renew them. This will help keep everything cleaned up.
api.renew_system([system_name])
Given the name of a range, get the first available IP address to assign to a potential interface.
api.get_address_from_range([range_name])