array operation_list(string session [, struct filter ])
Retrieves the last 300 operation IDs matching the specified criterias.
domain_create)The XML-RPC response will contain an array of operations IDs (int) or a fault describing the problem. Possible faults are described in section Error Codes Format.
import pprint try: updated_after = xmlrpclib.DateTime("2006-01-01") updated_before = xmlrpclib.DateTime("2006-02-01") state = "DONE" type = "domain_create" filter = { "updated_after": updated_after, "updated_before": updated_before, "state": state, "type": domain_create } oplist = proxy.operation_list(session, filter) print "operations list:" pprint.pprint(oplist) except xmlrpclib.Fault, e: print "could not retrieve operations list because: %s" % e.faultString
$filter = new xmlrpcval(array( "updated_after" => new xmlrpcval("20060101T00:00:00", "dateTime.iso8601"), "updated_before" => new xmlrpcval("20060201T00:00:00", "dateTime.iso8601"), "state" => new xmlrpcval("DONE"), "type" => new xmlrpcval("domain_create"), ), "struct"); $msg = new xmlrpcmsg("operation_list", array($session, $filter)); $reply = $proxy->send($msg); if ($reply->faultCode()) { printf("could not retrieve operations list because: %s\n", $reply->faultString()); } else { $val = php_xmlrpc_decode($reply->value()); print("operations list:\n"); print_r($val); }
my $filter = {} $filter["updated_after"] = XMLRPC::Data->type("datetime")->value("20060101T00:00:00"); $filter["updated_before"] = XMLRPC::Data->type("datetime")->value("20060201T00:00:00"); $filter["state"] = "DONE"; $filter["type"] = "domain_create"; my $reply = $proxy->call("operation_list", $session, $filter); my $oplist = $reply->result(); unless (defined $oplist) { printf "could not retrieve operations list because: %s\n", $reply->faultstring; } else { print "operations list:\n"; print Dumper($oplist); }
struct operation_details(string session, int opid)
Retrieve an operation details.
The XML-RPC response will contain an operation details (struct) or a fault describing the problem. The returned struct contains the following keys:
Possible faults are described in section Error Codes Format.
import pprint opid = 1234 try: opdetails = proxy.operation_details(session, opid) pprint.pprint(opdetails) except xmlrpclib.Fault, e: print "could not retrieve operation #%d details because: %s" % (opid, e.faultString)
$opid = 1234; $msg = new xmlrpcmsg("operation_details", array($session, new xmlrpcval($opid, "int"))); $reply = $proxy->send($msg); if ($reply->faultCode()) { printf("could not retrieve operation #%d details because: %s\n", ($opid, $reply->faultString())); } else { $val = php_xmlrpc_decode($reply->value()); print_r($val); }
my $opid = 1234; my $reply = $proxy->call("operation_details", $session, $opid); my $opdetails = $reply->result(); unless (defined $opdetails) { printf "could not retrieve operation #%d details because: %s\n", $opid, $reply->faultstring; } else { print Dumper($opdetails); }
boolean operation_relaunch(string session, int opid, struct param)
Relaunch an operation, modifying the given parameters.
The XML-RPC response will return True (boolean) or a fault describing the problem.
Possible faults are described in section Error Codes Format.
opid = 1234 try: proxy.operation_relaunch(session, opid, {'auth_code': 'abababab'}) catch xmlrpclib.Fault, e: print "could not relaunch operation #%d because: %s" % (opid, e.faultString)
$opid = 1234; $params["auth_code"] = new xmlrpcval("abababab"); $params = php_xmlrpc_encode($params); $msg = new xmlrpcmsg("operation_relaunch", array($session, new xmlrpcval($opid, "int"), $params)); $reply = $proxy->send($msg); if ($reply->faultCode()) { printf("could not relaunch operation #%d because: %s\n", $opid, $reply->faultString()); }
my $opid = 1234; my $params = {}; $params["auth_code"] = "abababab"; my $reply = $proxy->call("operation_relaunch", $session, $opid, $params); my $result = $reply->result(); unless (defined $result) { printf "could not relaunch operation #%d because: %s\n", $opid, $reply->faultstring; }
boolean operation_cancel(string session, int opid)
Cancel an operation.
The XML-RPC response will return True (boolean) or a fault describing the problem. Possible faults are described in section Error Codes Format.
opid = 1234 try: proxy.operation_cancel(session, opid) except xmlrpclib.Fault, e: print "could not cancel operation #%d because: %s" % (opid, e.faultString)
$opid = 1234; $msg = new xmlrpcmsg("operation_cancel", array($session, new xmlrpcval($opid, "int"))); $reply = $proxy->send($msg); if ($reply->faultCode()) { printf("could not cancel operation #%d because: %s\n", $opid, $reply->faultString()); }
my $opid = 1234; my $reply = $proxy->call("operation_cancel", $session, $opid); my $result = $reply->result(); unless (defined $result) { printf "could not cancel operation #%d because: %s\n", $opid, $reply->faultstring; }
Dernière modification: le 04/06/2009 à 18:04 par Pierrick P. (Gandi)