mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-04-11 03:46:15 -04:00
Add SPDX license headers and mark source files as GPL-3.0-or-later to preserve the option to relicense under later GPL versions.
31 lines
1.1 KiB
PHP
31 lines
1.1 KiB
PHP
<?php
|
|
|
|
// SPDX-FileCopyrightText: 2024 Icinga GmbH <https://icinga.com>
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
namespace Tests\Icinga\Module\Icingadb\Lib;
|
|
|
|
use Icinga\Application\Config;
|
|
use Icinga\Data\ConfigObject;
|
|
use Icinga\Module\Icingadb\Command\IcingaApiCommand;
|
|
use Icinga\Module\Icingadb\Command\Transport\ApiCommandTransport;
|
|
use Icinga\Module\Icingadb\Command\Transport\CommandTransport;
|
|
use Icinga\Module\Icingadb\Command\Transport\CommandTransportException;
|
|
|
|
class StrikingCommandTransport extends CommandTransport
|
|
{
|
|
public static function getConfig(): Config
|
|
{
|
|
return Config::fromArray(['endpoint1' => ['host' => 'endpointA'], 'endpoint2' => ['host' => 'endpointB']]);
|
|
}
|
|
|
|
public static function createTransport(ConfigObject $config): ApiCommandTransport
|
|
{
|
|
return (new class extends ApiCommandTransport {
|
|
protected function sendCommand(IcingaApiCommand $command)
|
|
{
|
|
throw new CommandTransportException(sprintf('%s strikes!', $this->getHost()));
|
|
}
|
|
})->setHost($config->host);
|
|
}
|
|
}
|