Previous page

Next page

Locate page in Contents

Classes

Compared to the Parallels C API, a Python class is an equivalent of a C handle. In most cases, an instance of a class must be obtained using a method of another class. Instances of particular classes are obtained in a certain order. A typical program must first obtain an instance of the prlsdkapi.Server class identifying the Parallels Service. If the intention is to work with a virtual machine, an instance of the prlsdkapi.Vm class identifying the virtual machine must then be obtained using the corresponding methods of the prlsdkapi.Server class.To view or modify the virtual machine configuration setting, an instance of the prlsdkapi.VmConfig class must be obtained using a method of the prlsdkapi.Vm class, and so forth. The examples in this guide provide information on how to obtain the most important and commonly used objects (server, virtual machine, devices, etc.). In general, an instance of a class is obtained using a method of a class to which the first class logically belongs. For example, a virtual machine belongs to a server, so the Server class must be used to obtain the virtual machine object. A virtual device belongs to a virtual machine, so the virtual machine object must be used to obtain a device object, and so on. In some cases an object must be created manually, but these cases are rare. The most notable one is the prlsdkapi.Server class, which is created using the server = prlsdkapi.Server() statement in the very beginning of a typical program.