Red Hat Training

A Red Hat training course is available for Red Hat Virtualization

3.4. Retrieving a Specific Resource from a Collection

In these examples a specific resource is retrieved from a collection using the get method.

Example 3.1. Retrieving a Specific Resource by Name

Retrieving the Default data center from the datacenters collection using the name parameter of the get method:
dc = api.datacenters.get("Default")
This syntax is equivalent:
dc = api.datacenters.get(name="Default")
Additional information can be retrieved for get requests using the all_content header.

Example 3.2. Retrieving Additional Information on a Specific Resource

vm = api.vms.get(name="VM01", all_content=True)