vmware_reporter.VCenterClient
- class vmware_reporter.VCenterClient(scope: str = None, *, host: str = None, user: str = None, password: str = None, no_ssl_verify: bool = None, out_dir: str | Path = None)
Bases:
objectMain entry point of the library to retrieve VMWare managed objects and interact with them.
- __init__(scope: str = None, *, host: str = None, user: str = None, password: str = None, no_ssl_verify: bool = None, out_dir: str | Path = None)
Create a new vCenter client.
If host, user, password or no_ssl_verify options are not provided, they are read from environment variables (VMWARE_*).
- Parameters:
scope – An optional name to distinguish between several vCenters.
host – Host name of the vCenter.
user – Name of the vCenter user having access to the API.
password – Password of the vCenter user having access to the API.
Methods
__init__([scope, host, user, password, ...])Create a new vCenter client.
close()connect()for_scope([scope])get_available_scopes()get_categories()get_category_by_key(key)get_obj(type, search, *[, normalize, key])Find a single VMWare managed object.
get_obj_by_ref(ref[, default])get_obj_tags(obj)get_objs(types[, search, normalize, key, ...])List VMWare managed objects matching the given search.
get_portgroup_by_key(key)get_switch_by_uuid(uuid)get_tag_by_key(key)get_tags()iter_objs(types[, search, normalize, key, first])Iterate over VMWare managed objects matching the given search.
rest_request(path, *[, method])wait_for_task(tasks, *[, success_callback, ...])Given a service instance and tasks, return after all the tasks are complete.
Attributes
categoriescookiedatacenterperf_intervals_by_nameservice_contentservice_instancetags- get_obj(type: type[T_Obj], search: list[str | Pattern] | str | Pattern | UUID, *, normalize: bool = False, key: Literal['name', 'ref', 'uuid', 'bios_uuid'] = 'name') T_Obj
Find a single VMWare managed object.
Raise KeyError if not found or several found.
- get_objs(types: type[T_Obj], search: list[str | Path | Pattern] | str | Path | Pattern = None, *, normalize: bool = None, key: Literal['name', 'ref'] = 'name', first: bool = False, sort_key: str | list[str] | Callable = None) list[T_Obj]
List VMWare managed objects matching the given search.
- iter_objs(types: type[T_Obj], search: list[str | Path | Pattern] | str | Path | Pattern = None, *, normalize: bool = None, key: Literal['name', 'ref'] = 'name', first: bool = False) Iterator[T_Obj]
Iterate over VMWare managed objects matching the given search.
- wait_for_task(tasks: Task | list[Task] | dict[Task, str], *, success_callback=None, error_callback=None)
Given a service instance and tasks, return after all the tasks are complete. - tasks: a task, a list of tasks, or a dict associating task to log prefixes.