Missing feature in python SDK4

I didn't find a way to find the writer that correspond to a given type. Is there a way to do that, or it's up to the end user to manually manage this mapping ?

On 04/20/2017 12:26 PM, Fabrice Bacchella wrote:
I didn't find a way to find the writer that correspond to a given type. Is there a way to do that, or it's up to the end user to manually manage this mapping ?
Yes that is missing. We have it for reading, but not for writing. This patch should address that: Add generic writer https://gerrit.ovirt.org/75699 Please open a bug so that we can decide what version should contain this fix. Note that you should try to avoid using directly the writer/reader classes, as they are an internal implementation detail and may change in the future. The contract for reading/writing is using the Reader and Writer classes. For example, to generate the XML for an object (once the patch is merged): from ovirtsdk4 import types from ovirtsdk4 import writer from ovirtsdk4 import writers vm = types.Vm( id="123", name="myvm", ... ) xml = writer.Writer.write(vm) print(xml)

On 04/20/2017 04:35 PM, Juan Hernández wrote:
On 04/20/2017 12:26 PM, Fabrice Bacchella wrote:
I didn't find a way to find the writer that correspond to a given type. Is there a way to do that, or it's up to the end user to manually manage this mapping ?
Yes that is missing. We have it for reading, but not for writing. This patch should address that:
Add generic writer https://gerrit.ovirt.org/75699
Please open a bug so that we can decide what version should contain this fix.
Note that you should try to avoid using directly the writer/reader classes, as they are an internal implementation detail and may change in the future. The contract for reading/writing is using the Reader and Writer classes. For example, to generate the XML for an object (once the patch is merged):
from ovirtsdk4 import types from ovirtsdk4 import writer from ovirtsdk4 import writers
vm = types.Vm( id="123", name="myvm", ... )
xml = writer.Writer.write(vm)
print(xml)
The above was not complete clear. The ovirtsdk4.writer.Writer and ovirtsdk4.reader.Reader classes are part of the contract of the SDK, it is safe to use them. The specific writer/reader classes, for example VmReader or VmWriter, are not part of the contract, and they may change in the future without notice, so try to avoid using them directly.

Le 20 avr. 2017 à 16:35, Juan Hernández <jhernand@redhat.com> a écrit :
On 04/20/2017 12:26 PM, Fabrice Bacchella wrote:
I didn't find a way to find the writer that correspond to a given type. Is there a way to do that, or it's up to the end user to manually manage this mapping ?
Yes that is missing. We have it for reading, but not for writing. This patch should address that:
Add generic writer https://gerrit.ovirt.org/75699
Please open a bug so that we can decide what version should contain this fix.
participants (2)
-
Fabrice Bacchella
-
Juan Hernández