Add classes for creating URLs

This commit is contained in:
Eric Lippmann 2019-11-03 15:13:08 +01:00
parent 4bf29ab21a
commit 44422c8cb8
3 changed files with 159 additions and 0 deletions

View file

@ -0,0 +1,49 @@
<?php
namespace Icinga\Module\Eagle\Common;
use Icinga\Module\Eagle\Model\Host;
use ipl\Web\Url;
abstract class HostLinks
{
public static function acknowledge(Host $host)
{
return Url::fromPath('eagle/host/acknowledge', ['name' => $host->name]);
}
public static function addComment(Host $host)
{
return Url::fromPath('eagle/host/add-comment', ['name' => $host->name]);
}
public static function checkNow(Host $host)
{
return Url::fromPath('eagle/host/check-now', ['name' => $host->name]);
}
public static function comments(Host $host)
{
return Url::fromPath('eagle/host/comments', ['name' => $host->name]);
}
public static function downtimes(Host $host)
{
return Url::fromPath('eagle/host/downtimes', ['name' => $host->name]);
}
public static function removeAcknowledgement(Host $host)
{
return Url::fromPath('eagle/host/remove-acknowledgement', ['name' => $host->name]);
}
public static function scheduleDowntime(Host $host)
{
return Url::fromPath('eagle/host/schedule-downtime', ['name' => $host->name]);
}
public static function sendCustomNotification(Host $host)
{
return Url::fromPath('eagle/host/send-custom-notification', ['name' => $host->name]);
}
}

View file

@ -0,0 +1,44 @@
<?php
namespace Icinga\Module\Eagle\Common;
use Icinga\Module\Eagle\Model\Host;
use Icinga\Module\Eagle\Model\Hostgroup;
use Icinga\Module\Eagle\Model\Service;
use Icinga\Module\Eagle\Model\Servicegroup;
use Icinga\Module\Eagle\Model\User;
use Icinga\Module\Eagle\Model\Usergroup;
use ipl\Web\Url;
abstract class Links
{
public static function host(Host $host)
{
return Url::fromPath('eagle/host', ['name' => $host->name]);
}
public static function hostgroup(Hostgroup $hostgroup)
{
return Url::fromPath('eagle/hostgroup', ['name' => $hostgroup->name]);
}
public static function service(Service $service, Host $host)
{
return Url::fromPath('eagle/service', ['name' => $service->name, 'host.name' => $host->name]);
}
public static function servicegroup(Servicegroup $servicegroup)
{
return Url::fromPath('eagle/servicegroup', ['name' => $servicegroup->name]);
}
public static function user(User $user)
{
return Url::fromPath('eagle/user', ['name' => $user->name]);
}
public static function usergroup(Usergroup $usergroup)
{
return Url::fromPath('eagle/usergroup', ['name' => $usergroup->name]);
}
}

View file

@ -0,0 +1,66 @@
<?php
namespace Icinga\Module\Eagle\Common;
use Icinga\Module\Eagle\Model\Host;
use Icinga\Module\Eagle\Model\Service;
use ipl\Web\Url;
abstract class ServiceLinks
{
public static function acknowledge(Service $service, Host $host)
{
return Url::fromPath(
'eagle/service/acknowledge', ['name' => $service->name, 'host.name' => $host->name]
);
}
public static function addComment(Service $service, Host $host)
{
return Url::fromPath(
'eagle/service/add-comment', ['name' => $service->name, 'host.name' => $host->name]
);
}
public static function checkNow(Service $service, Host $host)
{
return Url::fromPath(
'eagle/service/check-now', ['name' => $service->name, 'host.name' => $host->name]
);
}
public static function comments(Service $service, Host $host)
{
return Url::fromPath(
'eagle/service/comments', ['name' => $service->name, 'host.name' => $host->name]
);
}
public static function downtimes(Service $service, Host $host)
{
return Url::fromPath(
'eagle/service/downtimes', ['name' => $service->name, 'host.name' => $host->name]
);
}
public static function removeAcknowledgement(Service $service, Host $host)
{
return Url::fromPath(
'eagle/service/remove-acknowledgement', ['name' => $service->name, 'host.name' => $host->name]
);
}
public static function scheduleDowntime(Service $service, Host $host)
{
return Url::fromPath(
'eagle/service/schedule-downtime', ['name' => $service->name, 'host.name' => $host->name]
);
}
public static function sendCustomNotification(Service $service, Host $host)
{
return Url::fromPath(
'eagle/service/send-custom-notification', ['name' => $service->name, 'host.name' => $host->name]
);
}
}