summaryrefslogtreecommitdiff
path: root/generator.py
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2009-08-04 20:38:21 +0200
committerDaniel P. Berrange <berrange@redhat.com>2009-09-01 18:27:06 +0100
commit11bca8e4d912f360926c29981b6faf9dba45bf86 (patch)
tree23ece52527088a0c09b8ee8e02d1e339b0c26402 /generator.py
parenta5d4455ba21721b4739aab09b2c8116d138b29f3 (diff)
downloadlibvirt-python-11bca8e4d912f360926c29981b6faf9dba45bf86.tar.gz
Secret manipulation API docs refresh & wire up python generator
Sample session: >>> import libvirt >>> c = libvirt.open('qemu:///session') >>> c.listSecrets() ['12247729-47d2-a783-88ce-b329d4781cd3', 'reee', 'abc'] >>> s = c.secretDefineXML("<secret ephemeral='no' private='no'>\n<description>Something for use</description>\n<volume>/foo/bar</volume>\n</secret>\n") >>> s.UUIDString() '340c2dfb-811b-eda8-da9e-25ccd7bfd650' >>> s.XMLDesc() "<secret ephemeral='no' private='no'>\n <uuid>340c2dfb-811b-eda8-da9e-25ccd7bfd650</uuid>\n <description>Something for use</description>\n <volume>/foo/bar</volume>\n</secret>\n" >>> s.setValue('abc\0xx\xffx') 0 >>> s.value() 'abc\x00xx\xffx' >>> s.undefine() 0 * python/generator.py: Add rules for virSecret APIs * python/libvir.c, python/libvirt-python-api.xml: Manual impl of virSecretSetValue, virSecretGetValue$ and virConnectListSecrets APIs * python/libvirt_wrap.h, python/types.c: Wrapper for virSecret objects * docs/libvirt-api.xml, docs/libvirt-refs.xml, docs/html/libvirt-virterror.html, docs/html/libvirt-libvirt.html, docs/devhelp/libvirt-virterror.html, docs/devhelp/libvirt-libvirt.html: Re-generate with 'make api'
Diffstat (limited to 'generator.py')
-rwxr-xr-xgenerator.py31
1 files changed, 27 insertions, 4 deletions
diff --git a/generator.py b/generator.py
index feff7a3..4dbad1c 100755
--- a/generator.py
+++ b/generator.py
@@ -270,6 +270,11 @@ py_types = {
'const virNodeDevicePtr': ('O', "virNodeDevice", "virNodeDevicePtr", "virNodeDevicePtr"),
'virNodeDevice *': ('O', "virNodeDevice", "virNodeDevicePtr", "virNodeDevicePtr"),
'const virNodeDevice *': ('O', "virNodeDevice", "virNodeDevicePtr", "virNodeDevicePtr"),
+
+ 'virSecretPtr': ('O', "virSecret", "virSecretPtr", "virSecretPtr"),
+ 'const virSecretPtr': ('O', "virSecret", "virSecretPtr", "virSecretPtr"),
+ 'virSecret *': ('O', "virSecret", "virSecretPtr", "virSecretPtr"),
+ 'const virSecret *': ('O', "virSecret", "virSecretPtr", "virSecretPtr"),
}
py_return_types = {
@@ -296,6 +301,7 @@ skip_impl = (
'virConnectListDefinedNetworks',
'virConnectListInterfaces',
'virConnectListDefinedInterfaces',
+ 'virConnectListSecrets',
'virConnectListStoragePools',
'virConnectListDefinedStoragePools',
'virConnectListStorageVols',
@@ -320,6 +326,8 @@ skip_impl = (
'virDomainSetSchedulerParameters',
'virDomainGetVcpus',
'virDomainPinVcpu',
+ 'virSecretGetValue',
+ 'virSecretSetValue',
'virStoragePoolGetUUID',
'virStoragePoolGetUUIDString',
'virStoragePoolLookupByUUID',
@@ -623,6 +631,8 @@ classes_type = {
"virStorageVol *": ("._o", "virStorageVol(self, _obj=%s)", "virStorageVol"),
"virNodeDevicePtr": ("._o", "virNodeDevice(self, _obj=%s)", "virNodeDevice"),
"virNodeDevice *": ("._o", "virNodeDevice(self, _obj=%s)", "virNodeDevice"),
+ "virSecretPtr": ("._o", "virSecret(self, _obj=%s)", "virSecret"),
+ "virSecret *": ("._o", "virSecret(self, _obj=%s)", "virSecret"),
"virConnectPtr": ("._o", "virConnect(_obj=%s)", "virConnect"),
"virConnect *": ("._o", "virConnect(_obj=%s)", "virConnect"),
}
@@ -632,7 +642,7 @@ converter_type = {
primary_classes = ["virDomain", "virNetwork", "virInterface",
"virStoragePool", "virStorageVol",
- "virConnect", "virNodeDevice" ]
+ "virConnect", "virNodeDevice", "virSecret" ]
classes_ancestor = {
}
@@ -642,7 +652,8 @@ classes_destructors = {
"virInterface": "virInterfaceFree",
"virStoragePool": "virStoragePoolFree",
"virStorageVol": "virStorageVolFree",
- "virNodeDevice" : "virNodeDeviceFree"
+ "virNodeDevice" : "virNodeDeviceFree",
+ "virSecret": "virSecretFree"
}
functions_noexcept = {
@@ -714,6 +725,12 @@ def nameFixup(name, classe, type, file):
elif name[0:18] == "virInterfaceLookup":
func = name[3:]
func = string.lower(func[0:1]) + func[1:]
+ elif name[0:15] == "virSecretDefine":
+ func = name[3:]
+ func = string.lower(func[0:1]) + func[1:]
+ elif name[0:15] == "virSecretLookup":
+ func = name[3:]
+ func = string.lower(func[0:1]) + func[1:]
elif name[0:20] == "virStoragePoolDefine":
func = name[3:]
func = string.lower(func[0:1]) + func[1:]
@@ -747,6 +764,12 @@ def nameFixup(name, classe, type, file):
elif name[0:12] == "virInterface":
func = name[10:]
func = string.lower(func[0:1]) + func[1:]
+ elif name[0:12] == 'virSecretGet':
+ func = name[12:]
+ func = string.lower(func[0:1]) + func[1:]
+ elif name[0:9] == 'virSecret':
+ func = name[9:]
+ func = string.lower(func[0:1]) + func[1:]
elif name[0:17] == "virStoragePoolGet":
func = name[17:]
func = string.lower(func[0:1]) + func[1:]
@@ -1018,7 +1041,7 @@ def buildWrappers():
else:
txt.write("Class %s()\n" % (classname))
classes.write("class %s:\n" % (classname))
- if classname in [ "virDomain", "virNetwork", "virInterface", "virStoragePool", "virStorageVol", "virNodeDevice" ]:
+ if classname in [ "virDomain", "virNetwork", "virInterface", "virStoragePool", "virStorageVol", "virNodeDevice", "virSecret" ]:
classes.write(" def __init__(self, conn, _obj=None):\n")
else:
classes.write(" def __init__(self, _obj=None):\n")
@@ -1026,7 +1049,7 @@ def buildWrappers():
list = reference_keepers[classname]
for ref in list:
classes.write(" self.%s = None\n" % ref[1])
- if classname in [ "virDomain", "virNetwork", "virInterface", "virNodeDevice" ]:
+ if classname in [ "virDomain", "virNetwork", "virInterface", "virNodeDevice", "virSecret" ]:
classes.write(" self._conn = conn\n")
elif classname in [ "virStorageVol", "virStoragePool" ]:
classes.write(" self._conn = conn\n" + \