vmware / pyvmomi

VMware vSphere API Python Bindings
Apache License 2.0
2.22k stars 766 forks source link

Get the tag field of a cluster via API #1024

Closed wevernek closed 11 months ago

wevernek commented 1 year ago

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

Hey guys!

My team needs to get the tag of a cluster through the tool, and we would like to know at what level this information is found in the API.

Today we have a script built in Python to get information from the VMs in our datacenter and, through the documentation, we can't find the tag.

Our team has added this information in the following field within the vSphere Client:

Captura de Tela 2023-06-06 às 11 06 56

Describe the solution you'd like

If you can show us where to get this field through the API, or send us a useful link, we appreciate it!

Describe alternatives you've considered

No response

Additional context

No response

wevernek commented 1 year ago

@FelipeLepore @guilherme-lobo for your information 🚩

karaatanassov commented 11 months ago

You need to use the auotmation API of vSphere for this task.

See this API https://developer.vmware.com/apis/vsphere-automation/latest/cis/api/cis/tagging/tag-associationactionlist-attached-tags/post/

It is also avaialbe as Python binding in the vSphere Automation SDK

You can see the python doc here https://vmware.github.io/vsphere-automation-sdk-python/vsphere/8.0.2.0/com.vmware.cis.html#com.vmware.cis.tagging_client.TagAssociation.list_attached_tags