appwrite/src/Appwrite/Utopia/Response/Model/UsageDatabase.php

105 lines
3.3 KiB
PHP
Raw Normal View History

<?php
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
class UsageDatabase extends Model
{
public function __construct()
{
$this
->addRule('range', [
'type' => self::TYPE_STRING,
2023-11-09 10:54:33 +00:00
'description' => 'Time range of the usage stats.',
'default' => '',
'example' => '30d',
])
2023-10-25 09:46:45 +00:00
->addRule('collectionsTotal', [
'type' => self::TYPE_INTEGER,
2023-11-09 10:54:33 +00:00
'description' => 'Total aggregated number of collections.',
'default' => 0,
'example' => 0,
])
->addRule('documentsTotal', [
'type' => self::TYPE_INTEGER,
2023-11-09 10:54:33 +00:00
'description' => 'Total aggregated number of documents.',
'default' => 0,
'example' => 0,
])
2024-07-18 04:58:02 +00:00
->addRule('storageTotal', [
'type' => self::TYPE_INTEGER,
'description' => 'Total aggregated number of total storage used in bytes.',
'default' => 0,
'example' => 0,
])
2025-01-23 13:24:02 +00:00
->addRule('databaseReadsTotal', [
'type' => self::TYPE_INTEGER,
'description' => 'Total number of databases reads.',
'default' => 0,
'example' => 0,
])
->addRule('databaseWritesTotal', [
'type' => self::TYPE_INTEGER,
'description' => 'Total number of databases writes.',
'default' => 0,
'example' => 0,
])
->addRule('collections', [
'type' => Response::MODEL_METRIC,
2023-11-09 10:54:33 +00:00
'description' => 'Aggregated number of collections per period.',
'default' => [],
2022-10-11 10:34:42 +00:00
'example' => [],
2022-05-23 14:54:50 +00:00
'array' => true
])
->addRule('documents', [
2023-08-20 15:40:05 +00:00
'type' => Response::MODEL_METRIC,
2023-11-09 10:54:33 +00:00
'description' => 'Aggregated number of documents per period.',
'default' => [],
2022-10-11 10:34:42 +00:00
'example' => [],
2022-05-23 14:54:50 +00:00
'array' => true
])
2024-07-18 04:58:02 +00:00
->addRule('storage', [
'type' => Response::MODEL_METRIC,
'description' => 'Aggregated storage used in bytes per period.',
'default' => [],
'example' => [],
'array' => true
])
2025-01-23 13:24:02 +00:00
->addRule('databaseReads', [
'type' => Response::MODEL_METRIC,
'description' => 'An array of aggregated number of database reads.',
'default' => 0,
'example' => 0,
])
->addRule('databaseWrites', [
'type' => Response::MODEL_METRIC,
'description' => 'An array of aggregated number of database writes.',
'default' => 0,
'example' => 0,
])
;
}
/**
* Get Name
2022-05-23 14:54:50 +00:00
*
* @return string
*/
2022-05-23 14:54:50 +00:00
public function getName(): string
{
return 'UsageDatabase';
}
/**
* Get Type
2022-05-23 14:54:50 +00:00
*
* @return string
*/
2022-05-23 14:54:50 +00:00
public function getType(): string
{
return Response::MODEL_USAGE_DATABASE;
}
2022-05-23 14:54:50 +00:00
}