mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* Rename JiraServiceManagement.php to Jiraservicemanagement.php #15716 Filenames must not be PascalCase, only the first letter can be uppercase. * Update Jiraservicemanagement.php Following class name conventions * Update Jiraservicemanagement.php --------- Co-authored-by: Tony Murray <murraytony@gmail.com>
43 lines
1.0 KiB
PHP
43 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace LibreNMS\Alert\Transport;
|
|
|
|
use LibreNMS\Alert\Transport;
|
|
use LibreNMS\Exceptions\AlertTransportDeliveryException;
|
|
use LibreNMS\Util\Http;
|
|
|
|
class Jiraservicemanagement extends Transport
|
|
{
|
|
protected string $name = 'Jira Service Management';
|
|
|
|
public function deliverAlert(array $alert_data): bool
|
|
{
|
|
$url = $this->config['jsm-url'];
|
|
|
|
$res = Http::client()->post($url, $alert_data);
|
|
|
|
if ($res->successful()) {
|
|
return true;
|
|
}
|
|
|
|
throw new AlertTransportDeliveryException($alert_data, $res->status(), $res->body(), '', $alert_data);
|
|
}
|
|
|
|
public static function configTemplate(): array
|
|
{
|
|
return [
|
|
'config' => [
|
|
[
|
|
'title' => 'Webhook URL',
|
|
'name' => 'jsm-url',
|
|
'descr' => 'Jira Service Management Webhook URL',
|
|
'type' => 'text',
|
|
],
|
|
],
|
|
'validation' => [
|
|
'jsm-url' => 'required|url',
|
|
],
|
|
];
|
|
}
|
|
}
|