Files
librenms-librenms/LibreNMS/Alert/Transport/Jiraservicemanagement.php
Gil Obradors 5856e2c6cd Rename JiraServiceManagement.php to Jiraservicemanagement.php (#15717)
* 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>
2024-01-09 16:05:29 +01:00

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',
],
];
}
}