parent
f885d90a0a
commit
9f2070dced
|
@ -54,6 +54,19 @@ class IcingaEndpoint extends IcingaObject
|
||||||
{
|
{
|
||||||
$format = $this->connection->settings()->config_format;
|
$format = $this->connection->settings()->config_format;
|
||||||
if ($format === 'v2') {
|
if ($format === 'v2') {
|
||||||
|
return new CoreApi($this->getRestApiClient());
|
||||||
|
} elseif ($format === 'v1') {
|
||||||
|
return new LegacyDeploymentApi($this->connection);
|
||||||
|
} else {
|
||||||
|
throw new ProgrammingError('Unsupported config format: %s', $format);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return RestApiClient
|
||||||
|
*/
|
||||||
|
public function getRestApiClient()
|
||||||
|
{
|
||||||
$client = new RestApiClient(
|
$client = new RestApiClient(
|
||||||
$this->getResolvedProperty('host', $this->getObjectName()),
|
$this->getResolvedProperty('host', $this->getObjectName()),
|
||||||
$this->getResolvedProperty('port')
|
$this->getResolvedProperty('port')
|
||||||
|
@ -66,12 +79,7 @@ class IcingaEndpoint extends IcingaObject
|
||||||
$user->password
|
$user->password
|
||||||
);
|
);
|
||||||
|
|
||||||
return new CoreApi($client);
|
return $client;
|
||||||
} elseif ($format === 'v1') {
|
|
||||||
return new LegacyDeploymentApi($this->connection);
|
|
||||||
} else {
|
|
||||||
throw new ProgrammingError('Unsupported config format: %s', $format);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue