mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 22:00:22 -07:00
VMware: Tag management to VMware object (#46945)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
fab815fc3b
commit
47e1bf1862
2 changed files with 249 additions and 0 deletions
|
@ -185,3 +185,23 @@ class VmwareRestClient(object):
|
|||
for t in temp_tags_model:
|
||||
tags.append(t.name)
|
||||
return tags
|
||||
|
||||
@staticmethod
|
||||
def search_svc_object_by_name(service, svc_obj_name=None):
|
||||
"""
|
||||
Return service object by name
|
||||
Args:
|
||||
service: Service object
|
||||
svc_obj_name: Name of service object to find
|
||||
|
||||
Returns: Service object if found else None
|
||||
|
||||
"""
|
||||
if not svc_obj_name:
|
||||
return None
|
||||
|
||||
for svc_object in service.list():
|
||||
svc_obj = service.get(svc_object)
|
||||
if svc_obj.name == svc_obj_name:
|
||||
return svc_obj
|
||||
return None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue