list method retrieves the representations of multiple objects in a collection.
Listing a Collection of Virtual Machines
# Find the service that manages the collection of virtual # machines: vms_service = system_service.vms_service vms = vms_service.list
The result is a Ruby array containing the instances of the corresponding types. In the above example, the response is a list of instances of the Ruby class Vm.
list method of some services supports additional parameters.
For example, almost all of the top-level collections support a
search parameter to filter the results, and a
max parameter to limit the number of results returned by the server.
Listing Ten Virtual Machines Called "my*"
vms = vms_service.list(search: 'name=my*', max: 10)
Not all the list methods support the
max parameters. Some list methods may support other parameters. See the reference documentation for details.
If the list of results is empty, the returned value will be an empty Ruby array. It will never be
If the list of results cannot be retrieved, the SDK will raise an Error exception containing the details of the failure.