From 9c6a6c265a6e3d6129d5673310c763d9415318e6 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 1 Jan 2026 05:45:14 +0000 Subject: [PATCH] format --- .../Health/Http/Health/Queue/Audits/Get.php | 60 +++++++++++++++++++ .../Platform/Modules/Health/Services/Http.php | 10 ++-- 2 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Audits/Get.php diff --git a/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Audits/Get.php b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Audits/Get.php new file mode 100644 index 0000000000..e01e89641d --- /dev/null +++ b/src/Appwrite/Platform/Modules/Health/Http/Health/Queue/Audits/Get.php @@ -0,0 +1,60 @@ +setHttpMethod(Base::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/health/queue/audits') + ->desc('Get audits queue') + ->groups(['api', 'health']) + ->label('scope', 'health.read') + ->label('sdk', new Method( + namespace: 'health', + group: 'queue', + name: 'getQueueAudits', + description: '/docs/references/health/get-queue-audits.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_HEALTH_QUEUE, + ) + ], + contentType: ContentType::JSON + )) + ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) + ->inject('queueForAudits') + ->inject('response') + ->callback($this->action(...)); + } + + public function action(int|string $threshold, Audit $queueForAudits, Response $response): void + { + $threshold = (int) $threshold; + + $size = $queueForAudits->getSize(); + + $this->assertQueueThreshold($size, $threshold); + + $response->dynamic(new Document(['size' => $size]), Response::MODEL_HEALTH_QUEUE); + } +} diff --git a/src/Appwrite/Platform/Modules/Health/Services/Http.php b/src/Appwrite/Platform/Modules/Health/Services/Http.php index b0fb5573fa..f1196fa5e8 100644 --- a/src/Appwrite/Platform/Modules/Health/Services/Http.php +++ b/src/Appwrite/Platform/Modules/Health/Services/Http.php @@ -8,11 +8,6 @@ use Appwrite\Platform\Modules\Health\Http\Health\Certificate\Get as GetCertifica use Appwrite\Platform\Modules\Health\Http\Health\DB\Get as GetDB; use Appwrite\Platform\Modules\Health\Http\Health\Get as GetHealth; use Appwrite\Platform\Modules\Health\Http\Health\PubSub\Get as GetPubSub; -use Appwrite\Platform\Modules\Health\Http\Health\Stats\Get as GetStats; -use Appwrite\Platform\Modules\Health\Http\Health\Time\Get as GetTime; -use Appwrite\Platform\Modules\Health\Http\Health\Version\Get as GetHealthVersion; -use Appwrite\Platform\Modules\Health\Http\Health\Storage\Get as GetStorage; -use Appwrite\Platform\Modules\Health\Http\Health\Storage\Local\Get as GetStorageLocal; use Appwrite\Platform\Modules\Health\Http\Health\Queue\Builds\Get as GetQueueBuilds; use Appwrite\Platform\Modules\Health\Http\Health\Queue\Certificates\Get as GetQueueCertificates; use Appwrite\Platform\Modules\Health\Http\Health\Queue\Databases\Get as GetQueueDatabases; @@ -26,6 +21,11 @@ use Appwrite\Platform\Modules\Health\Http\Health\Queue\Migrations\Get as GetQueu use Appwrite\Platform\Modules\Health\Http\Health\Queue\StatsResources\Get as GetQueueStatsResources; use Appwrite\Platform\Modules\Health\Http\Health\Queue\StatsUsage\Get as GetQueueUsage; use Appwrite\Platform\Modules\Health\Http\Health\Queue\Webhooks\Get as GetQueueWebhooks; +use Appwrite\Platform\Modules\Health\Http\Health\Stats\Get as GetStats; +use Appwrite\Platform\Modules\Health\Http\Health\Storage\Get as GetStorage; +use Appwrite\Platform\Modules\Health\Http\Health\Storage\Local\Get as GetStorageLocal; +use Appwrite\Platform\Modules\Health\Http\Health\Time\Get as GetTime; +use Appwrite\Platform\Modules\Health\Http\Health\Version\Get as GetHealthVersion; use Utopia\Platform\Service; class Http extends Service