55 lines
1.8 KiB
PHP
55 lines
1.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Services\TenantConfiguration;
|
|
|
|
final class ExchangePowerShellEvidenceNormalizer
|
|
{
|
|
/**
|
|
* @var list<string>
|
|
*/
|
|
public const INCLUDED_TYPES = [
|
|
'transportRule',
|
|
'remoteDomain',
|
|
'inboundConnector',
|
|
];
|
|
|
|
public function __construct(
|
|
private readonly ExchangeTransportRuleEvidenceNormalizer $transportRules,
|
|
private readonly ExchangeRemoteDomainEvidenceNormalizer $remoteDomains,
|
|
private readonly ExchangeInboundConnectorEvidenceNormalizer $inboundConnectors,
|
|
) {}
|
|
|
|
public function evaluate(ExchangePowerShellStructuredOutputEnvelope $envelope): ExchangePowerShellNormalizerReadiness
|
|
{
|
|
return match ($envelope->resourceType) {
|
|
'transportRule' => $this->transportRules->evaluate($envelope),
|
|
'remoteDomain' => $this->remoteDomains->evaluate($envelope),
|
|
'inboundConnector' => $this->inboundConnectors->evaluate($envelope),
|
|
default => ExchangePowerShellNormalizerReadiness::blocked(
|
|
resourceType: $envelope->resourceType,
|
|
definition: [
|
|
'resource_type' => $envelope->resourceType,
|
|
'source_surface' => ExchangePowerShellCommandContracts::SOURCE_SURFACE,
|
|
'included_types' => self::INCLUDED_TYPES,
|
|
],
|
|
blockers: ['blocked_target_not_ready'],
|
|
itemCount: $envelope->itemCount,
|
|
),
|
|
};
|
|
}
|
|
|
|
/**
|
|
* @return array<string, array<string, mixed>>
|
|
*/
|
|
public function definitions(): array
|
|
{
|
|
return [
|
|
'transportRule' => $this->transportRules->definition(),
|
|
'remoteDomain' => $this->remoteDomains->definition(),
|
|
'inboundConnector' => $this->inboundConnectors->definition(),
|
|
];
|
|
}
|
|
}
|