TenantAtlas/apps/platform/app/Services/TenantConfiguration/ExchangePowerShellInvocationResult.php
ahmido 9374260ae1 feat: add Exchange PowerShell invocation gate (#498)
## Summary
- Adds the Spec 431 Exchange PowerShell invocation gate and operation registration slice.
- Introduces trusted provider operation start handling and read-only Exchange PowerShell runner abstractions.
- Updates provider capability/readiness evaluation and coverage for Exchange PowerShell invocation safety.

## Verification
- `cd apps/platform && ./vendor/bin/sail artisan test tests/Feature/Providers/ProviderCapabilityEvaluationTest.php tests/Feature/Providers/ProviderOperationCapabilityGateTest.php tests/Feature/TenantConfiguration/Spec431ExchangePowerShellInvocationGateTest.php tests/Unit/Providers/ProviderCapabilityRegistryTest.php tests/Unit/Providers/ProviderOperationStartGateTest.php tests/Unit/Support/TenantConfiguration/Spec430ExchangePowerShellCommandAllowlistTest.php tests/Unit/Support/TenantConfiguration/Spec431ExchangePowerShellOperationRegistrationTest.php tests/Unit/Verification/ManagedEnvironmentPermissionCapabilityMappingTest.php`
- Result: 80 passed, 685 assertions.

## Product Surface / Ops
- Rendered UI surface changed: N/A.
- Filament/Livewire surface changed: N/A.
- Deployment impact: config/runtime service changes only; no migrations, queues, or assets added.

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #498
2026-07-07 15:23:29 +00:00

89 lines
2.4 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Services\TenantConfiguration;
final readonly class ExchangePowerShellInvocationResult
{
/**
* @param array<string, mixed> $summaryCounts
* @param array<string, mixed> $context
*/
private function __construct(
public bool $successful,
public mixed $collection,
public ?string $reasonCode = null,
public ?string $failureCode = null,
public ?string $message = null,
public bool $blocked = false,
public array $summaryCounts = [],
public array $context = [],
) {}
/**
* @param list<array<string, mixed>> $items
* @param array<string, mixed> $summaryCounts
* @param array<string, mixed> $context
*/
public static function succeeded(array $items, array $summaryCounts = [], array $context = []): self
{
return new self(
successful: true,
collection: $items,
summaryCounts: $summaryCounts,
context: $context,
);
}
/**
* @param array<string, mixed> $context
*/
public static function succeededPayload(mixed $collection, array $context = []): self
{
return new self(
successful: true,
collection: $collection,
context: $context,
);
}
/**
* @param array<string, mixed> $summaryCounts
* @param array<string, mixed> $context
*/
public static function failed(
string $reasonCode,
string $failureCode,
?string $message = null,
array $summaryCounts = [],
array $context = [],
): self {
return new self(
successful: false,
collection: [],
reasonCode: $reasonCode,
failureCode: $failureCode,
message: $message,
summaryCounts: $summaryCounts,
context: $context,
);
}
/**
* @param array<string, mixed> $context
*/
public static function blocked(string $reasonCode, string $failureCode, ?string $message = null, array $context = []): self
{
return new self(
successful: false,
collection: [],
reasonCode: $reasonCode,
failureCode: $failureCode,
message: $message,
blocked: true,
context: $context,
);
}
}