array host_list(string session, string domain)
Returns the array of glue records for the specified domain.
The XML-RPC response will contain an array of hosts (string) or a fault describing the problem. Possible faults are described in section Error Codes Format.
import pprint try: hosts = proxy.host_list(session, "example.org") print "hosts:" pprint.pprint(hosts) except xmlrpclib.Fault, e: print "could not retrieve the list of host because: %s" % e.faultString
$domain = new xmlrpcval("example,org"); $msg = new xmlrpcmsg("host_list", array($session, $domain)); $reply = $proxy->send($msg); if ($reply->faultCode()) { printf("could not retrieve the list of hosts because: %s\n", $reply->faultString()); } else { $val = php_xmlrpc_decode($reply->value()); print_r($val); }
my $reply = $proxy->call("host_list", $session, "example.org"); my $hosts = $reply->result(); unless (defined $hosts) { print "could not retrieve the list of hosts because: " . $reply->faultstring . "\n"; } else { print Dumper($hosts); }
array host_info(string session, string fqdn)
Retrieve the IP addresses linked to this hostname.
The XML-RPC response will contain the IP addresses (array) associated with the specified hostname or a fault describing the problem. Possible faults are described in section Error Codes Format.
import pprint host = "host.example.net" try: info = proxy.host_info(session, host) pprint.pprint(info) except xmlrpclib.Fault, e: print "could not get information for hostname '%s': %s" % (host, e.faultString)
$host = "host.example.net"; $msg = new xmlrpcmsg("host_info", array($session, new xmlrpcval($host))); $reply = $proxy->send($msg); if ($reply->faultCode()) { printf("could not get information for hostname '%s' because: %s\n", $host, $reply->faultString()); } else { $val = php_xmlrpc_decode($reply->value()); print_r($val); }
my $host = "host.example.net"; my $reply = $proxy->call("host_info", $session, $host); my $info = $reply->result(); unless (defined $opid) { printf "could not get information for hostname '%s' because: %s\n", $host, $reply->faultstring; } else { print Dumper($info); }
int host_create(string session, string host, array ip)
Create a glue record with the specified IP addresses.
Only the first IP of the array is used.
The XML-RPC response will contain this operation attributed ID (int) or a fault describing the problem. Possible faults are described in section Error Codes Format.
host = "ns1.example.org" ip_list = ["1.2.3.4", "1.2.3.5"] try: opid = proxy.host_create(session, host, ip_list) print "creation of host '%s' is Gandi operation #%d" % (host, opid) except xmlrpclib.Fault, e: print "could not create host '%s' because: %s" % (host, e.faultString)
$host = "ns1.example.org"; $ip_list = php_xmlrpc_encode(array("1.2.3.4", "1.2.3.5")); $msg = new xmlrpcmsg("host_create", array($session, new xmlrpcval($host), $ip_list)); $reply = $proxy->send($msg); if ($reply->faultCode()) { printf("could not create host '%s' because: %s\n", $host, $reply->faultString()); } else { $val = $reply->value(); $val = $val->scalarval(); printf("creation of host '%s' is Gandi operation #%d\n", $host, $val); }
my $host = "ns1.example.org"; my $ip_list = ["1.2.3.4", "1.2.3.5"] my $reply = $proxy->call("host_create", $session, $host, $ip_list); my $opid = $reply->result(); unless (defined $opid) { printf "could not create host '%s' because: %s\n", $host, $reply->faultstring; } else { printf "creation of host '%s' is Gandi operation #%d\n", $host, $opid; }
int host_delete(string session, string host)
Delete a host.
The XML-RPC response will contain this operation attributed ID (int) or a fault describing the problem. Possible faults are described in section Error Codes Format.
host = "ns1.example.com" try: opid = proxy.host_delete(session, host) print "deletion of '%s' is Gandi operation #%d" % (host, opid) except xmlrpclib.Fault, e: print "could not delete host '%s' because: %s" % (host, e.faultString)
$host = "example.com"; $msg = new xmlrpcmsg("host_delete", array($session, new xmlrpcval($host))); $reply = $proxy->send($msg); if ($reply->faultCode()) { printf("could not delete host '%s' because: %s\n", $host, $reply->faultString()); } else { $val = $reply->value(); $val = $val->scalarval(); printf("deletion of host '%s' is Gandi operation #%d\n", $host, $val); }
my $host = "example.com"; my $reply = $proxy->call("host_delete", $session, $host); my $opid = $reply->result(); unless (defined $opid) { printf "could not delete host '%s' because: %s\n", $host, $reply->faultstring; } else { printf "deletion of host '%s' is Gandi operation #%d\n", $host, $opid; }
Dernière modification: le 17/02/2009 à 13:15 par Pierrick P. (Gandi)