mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
104 lines
3.3 KiB
PHP
104 lines
3.3 KiB
PHP
<?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,
|
|
'description' => 'Time range of the usage stats.',
|
|
'default' => '',
|
|
'example' => '30d',
|
|
])
|
|
->addRule('collectionsTotal', [
|
|
'type' => self::TYPE_INTEGER,
|
|
'description' => 'Total aggregated number of collections.',
|
|
'default' => 0,
|
|
'example' => 0,
|
|
])
|
|
->addRule('documentsTotal', [
|
|
'type' => self::TYPE_INTEGER,
|
|
'description' => 'Total aggregated number of documents.',
|
|
'default' => 0,
|
|
'example' => 0,
|
|
])
|
|
->addRule('storageTotal', [
|
|
'type' => self::TYPE_INTEGER,
|
|
'description' => 'Total aggregated number of total storage used in bytes.',
|
|
'default' => 0,
|
|
'example' => 0,
|
|
])
|
|
->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,
|
|
'description' => 'Aggregated number of collections per period.',
|
|
'default' => [],
|
|
'example' => [],
|
|
'array' => true
|
|
])
|
|
->addRule('documents', [
|
|
'type' => Response::MODEL_METRIC,
|
|
'description' => 'Aggregated number of documents per period.',
|
|
'default' => [],
|
|
'example' => [],
|
|
'array' => true
|
|
])
|
|
->addRule('storage', [
|
|
'type' => Response::MODEL_METRIC,
|
|
'description' => 'Aggregated storage used in bytes per period.',
|
|
'default' => [],
|
|
'example' => [],
|
|
'array' => true
|
|
])
|
|
->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
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getName(): string
|
|
{
|
|
return 'UsageDatabase';
|
|
}
|
|
|
|
/**
|
|
* Get Type
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getType(): string
|
|
{
|
|
return Response::MODEL_USAGE_DATABASE;
|
|
}
|
|
}
|