X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=doc%2FPLCAPI.xml.in;fp=doc%2FPLCAPI.xml.in;h=af48f91785876f02ece5da4c54eaea913af58ef2;hb=ae247e567468efe3fd5e54488a6fdd32da11fa96;hp=183a059f1816b10829ab0fa9e885baee308cd646;hpb=e44a32f614709d4859bb65b3992b0fc5d1efd34b;p=plcapi.git
diff --git a/doc/PLCAPI.xml.in b/doc/PLCAPI.xml.in
index 183a059..af48f91 100644
--- a/doc/PLCAPI.xml.in
+++ b/doc/PLCAPI.xml.in
@@ -165,6 +165,19 @@
+
+ Filtering on a sequence field
+ A field starting with '&' or '|' should refer to a sequence type;
+ the semantics is then that the object's value (expected to be a list)
+ should contain all (&) or any (|) value specified in the corresponding
+ filter value.
+ GetPersons ( { '|role_ids' : [ 20, 40 ] } )
+ GetPersons ( { '|roles' : ['tech', 'pi'] } )
+ GetPersons ( { '&roles' : ['admin', 'tech'] } )
+ GetPersons ( { '&roles' : 'tech' } )
+
+
+
Sorting and Clipping
The following 3 special fields can be used to extract only a subset of the results for pagination:
@@ -173,13 +186,23 @@
+
+ All criteria / Any criteria
+ The default in the vast majority of the code is to select
+ objects that match ALL the criteria specified in the struct. It
+ is possible to search for objects that match ANY of these by
+ adding the special '-OR' key (the value is then ignored), as in:
+ GetPersons ( { '-OR' : 'anything', 'site_id':2, '&roles':['admin'] } )
+
+
+
@@ -319,21 +399,32 @@ False
something like the following, using the built-in
deployment tag that is created for that purpose:
+### creating node groups
>>> AddNodeGroup('alphanodes','deployment','alpha')
21
>>> AddNodeGroup('betanodes','deployment','beta')
-21
+22
+### checking contents (no node has 'deployment' set to either 'alpha' or 'beta' yet)
>>> for ng in GetNodeGroups(['alphanodes','betanodes'],['groupname','node_ids']): print ng
{'groupname': u'alphanodes', 'node_ids': []}
{'groupname': u'betanodes', 'node_ids': []}
+
+### displaying node ids
+>>> for n in GetNodes({'hostname':'*.inria.fr'},['hostname','node_id']): print n
+{'hostname': u'vnode01.inria.fr', 'node_id': 1}
+{'hostname': u'vnode02.inria.fr', 'node_id': 2}
+
+### setting 'deployment' for these two nodes
>>> SetNodeDeployment('vnode01.inria.fr','alpha')
>>> for ng in GetNodeGroups(['alphanodes','betanodes'],['groupname','node_ids']): print ng
{'groupname': u'alphanodes', 'node_ids': [1]}
{'groupname': u'betanodes', 'node_ids': []}
->>> SetNodeDeployment('vnode01.inria.fr','beta')
+>>> SetNodeDeployment('vnode02.inria.fr','beta')
+
+### checking contents again
>>> for ng in GetNodeGroups(['alphanodes','betanodes'],['groupname','node_ids']): print ng
-{'groupname': u'alphanodes', 'node_ids': []}
-{'groupname': u'betanodes', 'node_ids': [1]}
+{'groupname': u'alphanodes', 'node_ids': [1]}
+{'groupname': u'betanodes', 'node_ids': [2]}
@@ -435,14 +526,12 @@ nodes = plc.GetNodes([121], ['node_id', 'hostname'])
import xmlrpclib
plc_host='www.planet-lab.eu'
-login='thierry.parmentelat@sophia.inria.fr'
-password='xxxxxxxx'
slice_name='inria_heartbeat'
auth = { 'AuthMethod' : 'password',
- 'Username' : login,
- 'AuthString' : password,
+ 'Username' : 'thierry.parmentelat@inria.fr',
+ 'AuthString' : 'xxxxxx',
}
api_url="https://%s:443/PLCAPI/"%plc_host