vmware / vsphere-automation-sdk-python

Python samples, language bindings, and API reference documentation for vSphere, VMC, and NSX-T using the VMware REST API
MIT License
745 stars 313 forks source link

Looking for python API binding to list VMs and its networking and storage resources. #382

Closed girishkumarbk closed 1 year ago

girishkumarbk commented 1 year ago

Is your feature request related to a problem? Please describe.

Nope

Describe the solution you'd like

I looking for vshpere API (python binding) that gives us the list of VMs and following details.

(1) VM compute details (2) VM networking information (3) Attached storage volumes etc. (4) Install OS on the VM etc.

Any guidance on which python samples would provide these details?

Describe alternatives you've considered

No response

Additional context

No response

aagrawal3 commented 1 year ago

Hi @girishkumarbk Samples are shipped with SDK. You can find them at: https://github.com/vmware/vsphere-automation-sdk-python/tree/master/samples/

Samples available at following location should be helpful for your need: https://github.com/vmware/vsphere-automation-sdk-python/tree/master/samples/vsphere/vcenter/vm

Instructions on how to use samples are present in README

girishkumarbk commented 1 year ago

Ok thanks. Also we see there is pyvmomi ( https://github.com/vmware/pyvmomi) python binding for managing vCenter/vSphere and ESXi. what is the difference between pyvmomi and vsphere-automation-sdk-python (this git repo) ? What is the recommendation from vmware on under which scenarios we use either one of them?

Thanks for your guidance.

aagrawal3 commented 1 year ago

pyvmomi SDK covers the legacy VIM APIs which are exposed over SOAP while our vSphere Automation SDK Python covers the APIs which are relatively new and are exposed over REST protocol. Ex: Content Library, Tagging Features etc. Depending on your use case and required APIs, you can pick the desired SDK.