From 44422c8cb86e13fe02e21e499bbc2775c18938f1 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Sun, 3 Nov 2019 15:13:08 +0100 Subject: [PATCH] Add classes for creating URLs --- library/Eagle/Common/HostLinks.php | 49 ++++++++++++++++++++ library/Eagle/Common/Links.php | 44 ++++++++++++++++++ library/Eagle/Common/ServiceLinks.php | 66 +++++++++++++++++++++++++++ 3 files changed, 159 insertions(+) create mode 100644 library/Eagle/Common/HostLinks.php create mode 100644 library/Eagle/Common/Links.php create mode 100644 library/Eagle/Common/ServiceLinks.php diff --git a/library/Eagle/Common/HostLinks.php b/library/Eagle/Common/HostLinks.php new file mode 100644 index 00000000..57dff1ff --- /dev/null +++ b/library/Eagle/Common/HostLinks.php @@ -0,0 +1,49 @@ + $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]); + } +} diff --git a/library/Eagle/Common/Links.php b/library/Eagle/Common/Links.php new file mode 100644 index 00000000..f97f42d3 --- /dev/null +++ b/library/Eagle/Common/Links.php @@ -0,0 +1,44 @@ + $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]); + } +} diff --git a/library/Eagle/Common/ServiceLinks.php b/library/Eagle/Common/ServiceLinks.php new file mode 100644 index 00000000..0f636470 --- /dev/null +++ b/library/Eagle/Common/ServiceLinks.php @@ -0,0 +1,66 @@ + $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] + ); + } +}