oVirt / python-ovirt-engine-sdk4

Python SDK for version 4 of the oVirt Engine API
Apache License 2.0
14 stars 24 forks source link

Confusing, Incomplete, and Broken Documentation #107

Closed jschoewe closed 7 months ago

jschoewe commented 7 months ago

It's incredibly confusing how one is supposed to pull readable data out of this. All I want to do is gather all the information about a VM and pass it along to another function, preferably as JSON. I connected to my system and found the VM exactly as described:

vms_service = system_service.vms_service()
vm_service = vms_service.vm_service('123')
vm = vm_service.get()

So now what?

I only see examples of code accessing a single attribute from these objects and the "collection of examples" link in the README gives a 404 error. Am I expected to loop through each attribute individually and resolve each link to build a human readable object myself?

mwperina commented 7 months ago

Hi John, have you seen the examples at https://github.com/oVirt/python-ovirt-engine-sdk4/tree/main/examples ?

For example https://github.com/oVirt/python-ovirt-engine-sdk4/blob/main/examples/list_vms.py prints VM name and ID for each existing VM. Other properties of VM type are described in the documentation https://ovirt.github.io/python-ovirt-engine-sdk4/master/types.m.html#ovirtsdk4.types.Vm

Regards, Martin

jschoewe commented 7 months ago

Martin,

That's not helpful. I understand that I can get the name (or any other single attribute) from the VM object. I want ALL of the data at once without having to loop through all these attributes, resolve any URLs, and build a new human readable object myself. I basically just want the JSON object that the API returns and there should be a built-in method of some kind that does this for me.

mwperina commented 7 months ago

Martin,

That's not helpful. I understand that I can get the name (or any other single attribute) from the VM object. I want ALL of the data at once without having to loop through all these attributes, resolve any URLs, and build a new human readable object myself. I basically just want the JSON object that the API returns and there should be a built-in method of some kind that does this for me.

Python SDK was created to abstract developers from REST API details (like XML or JSON representation) and allow them to build their application with their Python knowledge.

If you you need to work with JSON representation in Pythom then of course you can use oVirt REST API directly and use JSON representation: http://ovirt.github.io/ovirt-engine-api-model/4.5/#_json_representation