From 83e22322ee4da85f5c1be004481cbd420ada527e Mon Sep 17 00:00:00 2001 From: Joseph Bielawski Date: Mon, 2 Jan 2023 15:43:50 +0100 Subject: [PATCH] [Notifier] Add new Symfony Notifier for PagerDuty --- .../FrameworkExtension.php | 2 + .../Resources/config/notifier_transports.php | 5 + .../Notifier/Bridge/PagerDuty/.gitattributes | 4 + .../Notifier/Bridge/PagerDuty/.gitignore | 3 + .../Notifier/Bridge/PagerDuty/CHANGELOG.md | 7 ++ .../Notifier/Bridge/PagerDuty/LICENSE | 19 ++++ .../Bridge/PagerDuty/PagerDutyOptions.php | 103 ++++++++++++++++++ .../Bridge/PagerDuty/PagerDutyTransport.php | 84 ++++++++++++++ .../PagerDuty/PagerDutyTransportFactory.php | 56 ++++++++++ .../Notifier/Bridge/PagerDuty/README.md | 23 ++++ .../Tests/PagerDutyTransportFactoryTest.php | 49 +++++++++ .../Tests/PagerDutyTransportTest.php | 48 ++++++++ .../Notifier/Bridge/PagerDuty/composer.json | 30 +++++ .../Bridge/PagerDuty/phpunit.xml.dist | 31 ++++++ .../Exception/UnsupportedSchemeException.php | 4 + .../UnsupportedSchemeExceptionTest.php | 2 + src/Symfony/Component/Notifier/Transport.php | 2 + 17 files changed, 472 insertions(+) create mode 100644 src/Symfony/Component/Notifier/Bridge/PagerDuty/.gitattributes create mode 100644 src/Symfony/Component/Notifier/Bridge/PagerDuty/.gitignore create mode 100644 src/Symfony/Component/Notifier/Bridge/PagerDuty/CHANGELOG.md create mode 100644 src/Symfony/Component/Notifier/Bridge/PagerDuty/LICENSE create mode 100644 src/Symfony/Component/Notifier/Bridge/PagerDuty/PagerDutyOptions.php create mode 100644 src/Symfony/Component/Notifier/Bridge/PagerDuty/PagerDutyTransport.php create mode 100644 src/Symfony/Component/Notifier/Bridge/PagerDuty/PagerDutyTransportFactory.php create mode 100644 src/Symfony/Component/Notifier/Bridge/PagerDuty/README.md create mode 100644 src/Symfony/Component/Notifier/Bridge/PagerDuty/Tests/PagerDutyTransportFactoryTest.php create mode 100644 src/Symfony/Component/Notifier/Bridge/PagerDuty/Tests/PagerDutyTransportTest.php create mode 100644 src/Symfony/Component/Notifier/Bridge/PagerDuty/composer.json create mode 100644 src/Symfony/Component/Notifier/Bridge/PagerDuty/phpunit.xml.dist diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index bcd8aff6932e2..05ef6c629795c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -163,6 +163,7 @@ use Symfony\Component\Notifier\Bridge\OneSignal\OneSignalTransportFactory; use Symfony\Component\Notifier\Bridge\OrangeSms\OrangeSmsTransportFactory; use Symfony\Component\Notifier\Bridge\OvhCloud\OvhCloudTransportFactory; +use Symfony\Component\Notifier\Bridge\PagerDuty\PagerDutyTransportFactory; use Symfony\Component\Notifier\Bridge\Plivo\PlivoTransportFactory; use Symfony\Component\Notifier\Bridge\RingCentral\RingCentralTransportFactory; use Symfony\Component\Notifier\Bridge\RocketChat\RocketChatTransportFactory; @@ -2604,6 +2605,7 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $ OneSignalTransportFactory::class => 'notifier.transport_factory.one-signal', OrangeSmsTransportFactory::class => 'notifier.transport_factory.orange-sms', OvhCloudTransportFactory::class => 'notifier.transport_factory.ovh-cloud', + PagerDutyTransportFactory::class => 'notifier.transport_factory.pager-duty', PlivoTransportFactory::class => 'notifier.transport_factory.plivo', RingCentralTransportFactory::class => 'notifier.transport_factory.ring-central', RocketChatTransportFactory::class => 'notifier.transport_factory.rocket-chat', diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.php b/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.php index 0d38a65d05163..c5e0371d933ba 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.php @@ -48,6 +48,7 @@ use Symfony\Component\Notifier\Bridge\OneSignal\OneSignalTransportFactory; use Symfony\Component\Notifier\Bridge\OrangeSms\OrangeSmsTransportFactory; use Symfony\Component\Notifier\Bridge\OvhCloud\OvhCloudTransportFactory; +use Symfony\Component\Notifier\Bridge\PagerDuty\PagerDutyTransportFactory; use Symfony\Component\Notifier\Bridge\Plivo\PlivoTransportFactory; use Symfony\Component\Notifier\Bridge\RingCentral\RingCentralTransportFactory; use Symfony\Component\Notifier\Bridge\RocketChat\RocketChatTransportFactory; @@ -326,5 +327,9 @@ ->set('notifier.transport_factory.mastodon', MastodonTransportFactory::class) ->parent('notifier.transport_factory.abstract') ->tag('chatter.transport_factory') + + ->set('notifier.transport_factory.pager-duty', PagerDutyTransportFactory::class) + ->parent('notifier.transport_factory.abstract') + ->tag('chatter.transport_factory') ; }; diff --git a/src/Symfony/Component/Notifier/Bridge/PagerDuty/.gitattributes b/src/Symfony/Component/Notifier/Bridge/PagerDuty/.gitattributes new file mode 100644 index 0000000000000..84c7add058fb5 --- /dev/null +++ b/src/Symfony/Component/Notifier/Bridge/PagerDuty/.gitattributes @@ -0,0 +1,4 @@ +/Tests export-ignore +/phpunit.xml.dist export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore diff --git a/src/Symfony/Component/Notifier/Bridge/PagerDuty/.gitignore b/src/Symfony/Component/Notifier/Bridge/PagerDuty/.gitignore new file mode 100644 index 0000000000000..c49a5d8df5c65 --- /dev/null +++ b/src/Symfony/Component/Notifier/Bridge/PagerDuty/.gitignore @@ -0,0 +1,3 @@ +vendor/ +composer.lock +phpunit.xml diff --git a/src/Symfony/Component/Notifier/Bridge/PagerDuty/CHANGELOG.md b/src/Symfony/Component/Notifier/Bridge/PagerDuty/CHANGELOG.md new file mode 100644 index 0000000000000..1f2c8f86cde72 --- /dev/null +++ b/src/Symfony/Component/Notifier/Bridge/PagerDuty/CHANGELOG.md @@ -0,0 +1,7 @@ +CHANGELOG +========= + +6.3 +--- + + * Add the bridge diff --git a/src/Symfony/Component/Notifier/Bridge/PagerDuty/LICENSE b/src/Symfony/Component/Notifier/Bridge/PagerDuty/LICENSE new file mode 100644 index 0000000000000..f961401699b27 --- /dev/null +++ b/src/Symfony/Component/Notifier/Bridge/PagerDuty/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2023 Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/src/Symfony/Component/Notifier/Bridge/PagerDuty/PagerDutyOptions.php b/src/Symfony/Component/Notifier/Bridge/PagerDuty/PagerDutyOptions.php new file mode 100644 index 0000000000000..774e602fe0f8c --- /dev/null +++ b/src/Symfony/Component/Notifier/Bridge/PagerDuty/PagerDutyOptions.php @@ -0,0 +1,103 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Notifier\Bridge\PagerDuty; + +use Symfony\Component\Notifier\Exception\InvalidArgumentException; +use Symfony\Component\Notifier\Message\MessageOptionsInterface; + +/** + * @author Joseph Bielawski + */ +final class PagerDutyOptions implements MessageOptionsInterface +{ + public function __construct(string $routingKey, string $eventAction, string $severity, private array $options = []) + { + if (!\in_array($eventAction, ['trigger', 'acknowledge', 'resolve'], true)) { + throw new InvalidArgumentException('Invalid "event_action" option given.'); + } + + if (!\in_array($severity, ['critical', 'warning', 'error', 'info'], true)) { + throw new InvalidArgumentException('Invalid "severity" option given.'); + } + + if ($this->options['payload']['timestamp'] ?? null) { + $timestamp = \DateTimeImmutable::createFromFormat(\DateTimeInterface::RFC3339_EXTENDED, $this->options['payload']['timestamp']); + if (false === $timestamp) { + throw new InvalidArgumentException('Timestamp date must be in "RFC3339_EXTENDED" format.'); + } + } else { + $timestamp = (new \DateTimeImmutable())->format(\DateTimeInterface::RFC3339_EXTENDED); + } + + $this->options['routing_key'] = $routingKey; + $this->options['event_action'] = $eventAction; + $this->options['payload'] = [ + 'severity' => $severity, + 'timestamp' => $timestamp, + ]; + + if ($dedupKey = $options['dedup_key'] ?? null) { + $this->options['dedup_key'] = $dedupKey; + } + + if (null === $dedupKey && \in_array($eventAction, ['acknowledge', 'resolve'], true)) { + throw new InvalidArgumentException('Option "dedup_key" must be set for event actions: "acknowledge" & "resolve".'); + } + } + + public function toArray(): array + { + return $this->options; + } + + public function getRecipientId(): ?string + { + return $this->options['routing_key']; + } + + /** + * @return $this + */ + public function attachImage(string $src, string $href = '', string $alt = ''): static + { + $this->options['images'][] = [ + 'src' => $src, + 'href' => $href ?: $src, + 'alt' => $alt, + ]; + + return $this; + } + + /** + * @return $this + */ + public function attachLink(string $href, string $text): static + { + $this->options['links'][] = [ + 'href' => $href, + 'text' => $text, + ]; + + return $this; + } + + /** + * @return $this + */ + public function attachCustomDetails(array $customDetails): static + { + $this->options['payload']['custom_details'] += $customDetails; + + return $this; + } +} diff --git a/src/Symfony/Component/Notifier/Bridge/PagerDuty/PagerDutyTransport.php b/src/Symfony/Component/Notifier/Bridge/PagerDuty/PagerDutyTransport.php new file mode 100644 index 0000000000000..4e69b12c1c808 --- /dev/null +++ b/src/Symfony/Component/Notifier/Bridge/PagerDuty/PagerDutyTransport.php @@ -0,0 +1,84 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Notifier\Bridge\PagerDuty; + +use Symfony\Component\Notifier\Exception\LogicException; +use Symfony\Component\Notifier\Exception\TransportException; +use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException; +use Symfony\Component\Notifier\Message\MessageInterface; +use Symfony\Component\Notifier\Message\PushMessage; +use Symfony\Component\Notifier\Message\SentMessage; +use Symfony\Component\Notifier\Transport\AbstractTransport; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; +use Symfony\Contracts\HttpClient\HttpClientInterface; + +/** + * @author Joseph Bielawski + */ +final class PagerDutyTransport extends AbstractTransport +{ + public function __construct(#[\SensitiveParameter] private readonly string $token, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null) + { + parent::__construct($client, $dispatcher); + } + + public function __toString(): string + { + return sprintf('pagerduty://%s', $this->getEndpoint()); + } + + public function supports(MessageInterface $message): bool + { + return $message instanceof PushMessage; + } + + protected function doSend(MessageInterface $message = null): SentMessage + { + if (!$message instanceof PushMessage) { + throw new UnsupportedMessageTypeException(__CLASS__, PushMessage::class, $message); + } + + if (null !== $message->getOptions() && !($message->getOptions() instanceof PagerDutyOptions)) { + throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" for options.', __CLASS__, PagerDutyOptions::class)); + } + + $body = ($opts = $message->getOptions()) ? $opts->toArray() : []; + $body['payload']['summary'] = $message->getContent(); + $body['payload']['source'] = $message->getSubject(); + + $response = $this->client->request('POST', 'https://events.pagerduty.com/v2/enqueue', [ + 'headers' => [ + 'Accept' => 'application/json', + 'Authorization' => $this->token, + ], + 'json' => $body, + ]); + + try { + $statusCode = $response->getStatusCode(); + } catch (TransportExceptionInterface $e) { + throw new TransportException('Could not reach the remote PagerDuty server.', $response, 0, $e); + } + + $result = $response->toArray(false); + + if (202 !== $statusCode) { + throw new TransportException(sprintf('Unable to post the PagerDuty message: "%s".', $result['error']['message']), $response); + } + + $sentMessage = new SentMessage($message, (string) $this); + $sentMessage->setMessageId($result['dedup_key'] ?? $message->getRecipientId()); + + return $sentMessage; + } +} diff --git a/src/Symfony/Component/Notifier/Bridge/PagerDuty/PagerDutyTransportFactory.php b/src/Symfony/Component/Notifier/Bridge/PagerDuty/PagerDutyTransportFactory.php new file mode 100644 index 0000000000000..93fae27f433e3 --- /dev/null +++ b/src/Symfony/Component/Notifier/Bridge/PagerDuty/PagerDutyTransportFactory.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Notifier\Bridge\PagerDuty; + +use Symfony\Component\Notifier\Exception\IncompleteDsnException; +use Symfony\Component\Notifier\Exception\UnsupportedSchemeException; +use Symfony\Component\Notifier\Transport\AbstractTransportFactory; +use Symfony\Component\Notifier\Transport\Dsn; + +/** + * @author Joseph Bielawski + */ +final class PagerDutyTransportFactory extends AbstractTransportFactory +{ + public function create(Dsn $dsn): PagerDutyTransport + { + $scheme = $dsn->getScheme(); + + if ('pagerduty' !== $scheme) { + throw new UnsupportedSchemeException($dsn, 'pagerduty', $this->getSupportedSchemes()); + } + + $apiToken = $this->getUser($dsn); + $host = $this->getHost($dsn); + + return (new PagerDutyTransport($apiToken, $this->client, $this->dispatcher))->setHost($host); + } + + protected function getSupportedSchemes(): array + { + return ['pagerduty']; + } + + private function getHost(Dsn $dsn): string + { + $host = $dsn->getHost(); + if ('default' === $host) { + throw new IncompleteDsnException('Host is not set.', $dsn->getOriginalDsn()); + } + + if (!str_ends_with($host, '.pagerduty.com')) { + throw new IncompleteDsnException('Host must be in format: "subdomain.pagerduty.com".', $dsn->getOriginalDsn()); + } + + return $host; + } +} diff --git a/src/Symfony/Component/Notifier/Bridge/PagerDuty/README.md b/src/Symfony/Component/Notifier/Bridge/PagerDuty/README.md new file mode 100644 index 0000000000000..01547d59d1a76 --- /dev/null +++ b/src/Symfony/Component/Notifier/Bridge/PagerDuty/README.md @@ -0,0 +1,23 @@ +PagerDuty Notifier +================== + +Provides [PagerDuty](https://www.pagerduty.com) integration for Symfony Notifier. + +DSN example +----------- + +``` +PAGERDUTY_DSN=pagerduty://TOKEN@SUBDOMAIN +``` + +where: + - `TOKEN` is your PagerDuty API token + - `SUBDOMAIN` is your subdomain name at pagerduty.com + +Resources +--------- + + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/src/Symfony/Component/Notifier/Bridge/PagerDuty/Tests/PagerDutyTransportFactoryTest.php b/src/Symfony/Component/Notifier/Bridge/PagerDuty/Tests/PagerDutyTransportFactoryTest.php new file mode 100644 index 0000000000000..bbc96f24b0e4b --- /dev/null +++ b/src/Symfony/Component/Notifier/Bridge/PagerDuty/Tests/PagerDutyTransportFactoryTest.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Notifier\Bridge\PagerDuty\Tests; + +use Symfony\Component\Notifier\Bridge\PagerDuty\PagerDutyTransportFactory; +use Symfony\Component\Notifier\Test\TransportFactoryTestCase; + +final class PagerDutyTransportFactoryTest extends TransportFactoryTestCase +{ + public function createFactory(): PagerDutyTransportFactory + { + return new PagerDutyTransportFactory(); + } + + public function createProvider(): iterable + { + yield [ + 'pagerduty://subdomain.pagerduty.com', + 'pagerduty://token@subdomain.pagerduty.com', + 'pagerduty://token@subdomain.eu.pagerduty.com', + ]; + } + + public function supportsProvider(): iterable + { + yield [true, 'pagerduty://host']; + yield [false, 'somethingElse://host']; + } + + public function incompleteDsnProvider(): iterable + { + yield 'missing token' => ['pagerduty://@host']; + yield 'wrong host' => ['pagerduty://token@host.com']; + } + + public function unsupportedSchemeProvider(): iterable + { + yield ['somethingElse://token@host']; + } +} diff --git a/src/Symfony/Component/Notifier/Bridge/PagerDuty/Tests/PagerDutyTransportTest.php b/src/Symfony/Component/Notifier/Bridge/PagerDuty/Tests/PagerDutyTransportTest.php new file mode 100644 index 0000000000000..d03f32de0ff5f --- /dev/null +++ b/src/Symfony/Component/Notifier/Bridge/PagerDuty/Tests/PagerDutyTransportTest.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Notifier\Bridge\PagerDuty\Tests; + +use Symfony\Component\Notifier\Bridge\PagerDuty\PagerDutyOptions; +use Symfony\Component\Notifier\Bridge\PagerDuty\PagerDutyTransport; +use Symfony\Component\Notifier\Message\ChatMessage; +use Symfony\Component\Notifier\Message\MessageInterface; +use Symfony\Component\Notifier\Message\PushMessage; +use Symfony\Component\Notifier\Message\SmsMessage; +use Symfony\Component\Notifier\Test\TransportTestCase; +use Symfony\Contracts\HttpClient\HttpClientInterface; + +final class PagerDutyTransportTest extends TransportTestCase +{ + public function createTransport(HttpClientInterface $client = null): PagerDutyTransport + { + return (new PagerDutyTransport('testToken', $client ?? $this->createMock(HttpClientInterface::class)))->setHost('test.pagerduty.com'); + } + + public function toStringProvider(): iterable + { + yield ['pagerduty://test.pagerduty.com', $this->createTransport()]; + } + + public function supportedMessagesProvider(): iterable + { + yield [new PushMessage('Source', 'Summary')]; + yield [new PushMessage('Source', 'Summary', new PagerDutyOptions('e93facc04764012d7bfb002500d5d1a6', 'trigger', 'info'))]; + yield [new PushMessage('Source', 'Summary', new PagerDutyOptions('e93facc04764012d7bfb002500d5d1a6', 'acknowledge', 'info', ['dedup_key' => 'srv01/test']))]; + } + + public function unsupportedMessagesProvider(): iterable + { + yield [new SmsMessage('0611223344', 'Hello!')]; + yield [new ChatMessage('Hello!')]; + yield [$this->createMock(MessageInterface::class)]; + } +} diff --git a/src/Symfony/Component/Notifier/Bridge/PagerDuty/composer.json b/src/Symfony/Component/Notifier/Bridge/PagerDuty/composer.json new file mode 100644 index 0000000000000..8815e4a0d4215 --- /dev/null +++ b/src/Symfony/Component/Notifier/Bridge/PagerDuty/composer.json @@ -0,0 +1,30 @@ +{ + "name": "symfony/pager-duty-notifier", + "type": "symfony-notifier-bridge", + "description": "Symfony PagerDuty Notifier Bridge", + "keywords": ["chat", "pagerduty", "notifier"], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Joseph Bielawski", + "email": "stloyd@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=8.1", + "symfony/http-client": "^5.4|^6.3", + "symfony/notifier": "^6.3" + }, + "autoload": { + "psr-4": { "Symfony\\Component\\Notifier\\Bridge\\PagerDuty\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev" +} diff --git a/src/Symfony/Component/Notifier/Bridge/PagerDuty/phpunit.xml.dist b/src/Symfony/Component/Notifier/Bridge/PagerDuty/phpunit.xml.dist new file mode 100644 index 0000000000000..27af4d4b826a0 --- /dev/null +++ b/src/Symfony/Component/Notifier/Bridge/PagerDuty/phpunit.xml.dist @@ -0,0 +1,31 @@ + + + + + + + + + + ./Tests/ + + + + + + ./ + + + ./Resources + ./Tests + ./vendor + + + diff --git a/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php b/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php index bbbd56a4cd093..86aa5f3930634 100644 --- a/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php +++ b/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php @@ -156,6 +156,10 @@ class UnsupportedSchemeException extends LogicException 'class' => Bridge\OvhCloud\OvhCloudTransportFactory::class, 'package' => 'symfony/ovh-cloud-notifier', ], + 'pagerduty' => [ + 'class' => Bridge\PagerDuty\PagerDutyTransportFactory::class, + 'package' => 'symfony/pager-duty-notifier', + ], 'plivo' => [ 'class' => Bridge\Plivo\PlivoTransportFactory::class, 'package' => 'symfony/plivo-notifier', diff --git a/src/Symfony/Component/Notifier/Tests/Exception/UnsupportedSchemeExceptionTest.php b/src/Symfony/Component/Notifier/Tests/Exception/UnsupportedSchemeExceptionTest.php index 8dd5d8d92c1a7..88209ec6c66fa 100644 --- a/src/Symfony/Component/Notifier/Tests/Exception/UnsupportedSchemeExceptionTest.php +++ b/src/Symfony/Component/Notifier/Tests/Exception/UnsupportedSchemeExceptionTest.php @@ -45,6 +45,7 @@ use Symfony\Component\Notifier\Bridge\Octopush\OctopushTransportFactory; use Symfony\Component\Notifier\Bridge\OneSignal\OneSignalTransportFactory; use Symfony\Component\Notifier\Bridge\OvhCloud\OvhCloudTransportFactory; +use Symfony\Component\Notifier\Bridge\PagerDuty\PagerDutyTransportFactory; use Symfony\Component\Notifier\Bridge\Plivo\PlivoTransportFactory; use Symfony\Component\Notifier\Bridge\RingCentral\RingCentralTransportFactory; use Symfony\Component\Notifier\Bridge\RocketChat\RocketChatTransportFactory; @@ -112,6 +113,7 @@ public static function setUpBeforeClass(): void OctopushTransportFactory::class => false, OneSignalTransportFactory::class => false, OvhCloudTransportFactory::class => false, + PagerDutyTransportFactory::class => false, PlivoTransportFactory::class => false, RingCentralTransportFactory::class => false, RocketChatTransportFactory::class => false, diff --git a/src/Symfony/Component/Notifier/Transport.php b/src/Symfony/Component/Notifier/Transport.php index 78ab723de4ab0..10b4650a57200 100644 --- a/src/Symfony/Component/Notifier/Transport.php +++ b/src/Symfony/Component/Notifier/Transport.php @@ -40,6 +40,7 @@ use Symfony\Component\Notifier\Bridge\Octopush\OctopushTransportFactory; use Symfony\Component\Notifier\Bridge\OrangeSms\OrangeSmsTransportFactory; use Symfony\Component\Notifier\Bridge\OvhCloud\OvhCloudTransportFactory; +use Symfony\Component\Notifier\Bridge\PagerDuty\PagerDutyTransportFactory; use Symfony\Component\Notifier\Bridge\Plivo\PlivoTransportFactory; use Symfony\Component\Notifier\Bridge\RingCentral\RingCentralTransportFactory; use Symfony\Component\Notifier\Bridge\RocketChat\RocketChatTransportFactory; @@ -108,6 +109,7 @@ final class Transport OctopushTransportFactory::class, OrangeSmsTransportFactory::class, OvhCloudTransportFactory::class, + PagerDutyTransportFactory::class, PlivoTransportFactory::class, RingCentralTransportFactory::class, RocketChatTransportFactory::class,