protected function api()
 {
     $apiconfig = $this->Config()->getSection('api');
     $client = new RestApiClient($apiconfig->get('address'), $apiconfig->get('port'));
     $client->setCredentials($apiconfig->get('username'), $apiconfig->get('password'));
     $api = new CoreApi($client);
     return $api;
 }
 protected function api()
 {
     $client = new RestApiClient($this->getValue('host'), $this->getValue('port'));
     $apiuser = $this->apiUser();
     $client->setCredentials($apiuser->object_name, $apiuser->password);
     $api = new CoreApi($client);
     return $api;
 }
 protected function api()
 {
     $apiconfig = Config::module('director')->getSection('api');
     $client = new RestApiClient($apiconfig->get('address'), $apiconfig->get('port'));
     $client->setCredentials($apiconfig->get('username'), $apiconfig->get('password'));
     $api = new CoreApi($client);
     $api->setDb($this->db());
     return $api;
 }
 protected function api()
 {
     $this->view->endpoint = $this->params->get('endpoint');
     $endpoint = IcingaEndpoint::load($this->view->endpoint, $this->db());
     $apiconfig = $this->Config()->getSection('api');
     $client = new RestApiClient($endpoint->host, $endpoint->port);
     $client->setCredentials($apiconfig->get('username'), $apiconfig->get('password'));
     $api = new CoreApi($client);
     return $api;
 }