Closed alan-cugler closed 1 year ago
This one seems better. https://developer.vmware.com/apis/vsphere-automation/latest/vcenter/tagging/ The whitepaper it references says, "To retrieve tag names from these IDs, you must use get() calls. For example, Tag.get() returns a TagModel object that has name, id, category_ id, description, and used_by fields."
Thanks @tldlauser for answering how to get the tag properties from tag id.
@alan-cugler
In the associations, providing attributes other than id is not desirable
Kindly used the getTag API to get the name .
I am closing the issue.
Thanks Kunal
I request this be reopened to at least explain how to get tags, the White paper does not clearly specify how to get tag name to vm associations clearly. It makes up alot of its own api calls that are not in the official api.
Kindly refer to the sample on how to get the tag from tag_id https://github.com/vmware/vsphere-automation-sdk-python/blob/master/samples/vsphere/tagging/tagging_workflow.py#L173
From tag association get the tag_id and pass it to the client.tagging.Tag.get(tag_id)
Is your feature request related to a problem? Please describe.
A client is asking for their vCenter Tags associated to VMs to be imported to the grains system of Aria Automation Config (open-salt). This is a good fit for integration between the two pieces of technology. I attempted to achieve this by installing the vsphere-automation-sdk in the open-salt python environment. This did work and I was able to authenticate a session to vCenter!
However, I found I was able to extract the information of VM names and VM IDs, and I was able to get Tag URNs assigned to VM IDs. But there was no way to associate the Tag URNs to the human readable Tag names.
Describe the solution you'd like
I would like the Tag names to also be part of the data returned when calling
session.vcenter.tagging.Associations.list()
.Alternatively, the Tags Names ( +URNs?) could also be part of information returned from
session.vcenter.VM.get()
orsession.vcenter.VM.list()
Describe alternatives you've considered
VMware Tools
to request information describing the guest VM from vCenter.Additional context
VM.list() output in my PSO lab
VM.get() output in my PSO lab
Tags in my PSO lab
Tag connected to my VM that has an ID of
vm-49