コード例 #1
0
 /**
  * Get server list
  * @return array
  */
 public function serverList()
 {
     $serverList = array();
     $vmList = $this->connector->findAllManagedObjects('VirtualMachine', array('name'));
     foreach ($vmList as $vm) {
         $serverList[$vm->getReferenceId()] = $vm->name;
     }
     return $serverList;
 }
コード例 #2
0
 /**
  * Configures the API client
  * @param $configuration ClientConfiguration
  * @param $credentials Credentials
  * @return Client
  */
 public function configure(ClientConfiguration $configuration, Credentials $credentials)
 {
     $vhost = new Vhost(sprintf('%s:%d', $configuration->getEndpoint(), $configuration->getPort()), $credentials->getUsername(), $credentials->getPassword());
     $this->service = $vhost->getService();
     return $this;
 }