2021-08-26 19:31:37 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
|
|
use Appwrite\Utopia\Response;
|
|
|
|
|
use Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
2021-08-27 16:45:08 +00:00
|
|
|
class UsageProject extends Model
|
2021-08-26 19:31:37 +00:00
|
|
|
{
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
$this
|
2023-10-25 09:46:45 +00:00
|
|
|
->addRule('executionsTotal', [
|
2023-11-08 09:09:32 +00:00
|
|
|
'type' => self::TYPE_INTEGER,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Total aggregated number of function executions.',
|
2023-11-08 09:09:32 +00:00
|
|
|
'default' => 0,
|
|
|
|
|
'example' => 0,
|
2021-08-26 19:31:37 +00:00
|
|
|
])
|
2023-10-25 09:46:45 +00:00
|
|
|
->addRule('documentsTotal', [
|
2023-11-08 09:09:32 +00:00
|
|
|
'type' => self::TYPE_INTEGER,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Total aggregated number of documents.',
|
2023-11-08 09:09:32 +00:00
|
|
|
'default' => 0,
|
|
|
|
|
'example' => 0,
|
2021-08-26 19:31:37 +00:00
|
|
|
])
|
2023-10-25 09:46:45 +00:00
|
|
|
->addRule('databasesTotal', [
|
2023-11-08 09:09:32 +00:00
|
|
|
'type' => self::TYPE_INTEGER,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Total aggregated number of databases.',
|
2023-11-08 09:09:32 +00:00
|
|
|
'default' => 0,
|
|
|
|
|
'example' => 0,
|
2021-08-26 19:31:37 +00:00
|
|
|
])
|
2023-10-25 09:46:45 +00:00
|
|
|
->addRule('usersTotal', [
|
2023-11-08 09:09:32 +00:00
|
|
|
'type' => self::TYPE_INTEGER,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Total aggregated number of users.',
|
2023-11-08 09:09:32 +00:00
|
|
|
'default' => 0,
|
|
|
|
|
'example' => 0,
|
2021-08-26 19:31:37 +00:00
|
|
|
])
|
2023-11-08 09:09:32 +00:00
|
|
|
->addRule('filesStorageTotal', [
|
|
|
|
|
'type' => self::TYPE_INTEGER,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Total aggregated sum of files storage size (in bytes).',
|
2023-11-08 09:09:32 +00:00
|
|
|
'default' => 0,
|
|
|
|
|
'example' => 0,
|
2021-08-26 19:31:37 +00:00
|
|
|
])
|
2023-10-25 09:46:45 +00:00
|
|
|
->addRule('bucketsTotal', [
|
2023-11-08 09:09:32 +00:00
|
|
|
'type' => self::TYPE_INTEGER,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Total aggregated number of buckets.',
|
2023-11-08 09:09:32 +00:00
|
|
|
'default' => 0,
|
|
|
|
|
'example' => 0,
|
2022-11-08 12:09:18 +00:00
|
|
|
])
|
2023-11-08 16:12:36 +00:00
|
|
|
->addRule('requests', [
|
2023-12-11 15:19:08 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Aggregated number of requests per period.',
|
2023-11-08 16:12:36 +00:00
|
|
|
'default' => [],
|
|
|
|
|
'example' => [],
|
|
|
|
|
'array' => true
|
|
|
|
|
])
|
|
|
|
|
->addRule('network', [
|
2023-12-11 15:19:08 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Aggregated number of consumed bandwidth per period.',
|
2023-11-08 16:12:36 +00:00
|
|
|
'default' => [],
|
|
|
|
|
'example' => [],
|
|
|
|
|
'array' => true
|
|
|
|
|
])
|
2023-12-11 15:19:08 +00:00
|
|
|
->addRule('users', [
|
|
|
|
|
'type' => Response::MODEL_METRIC,
|
|
|
|
|
'description' => 'Aggregated number of users per period.',
|
|
|
|
|
'default' => [],
|
|
|
|
|
'example' => [],
|
|
|
|
|
'array' => true
|
|
|
|
|
])
|
|
|
|
|
->addRule('executionsBreakdown', [
|
|
|
|
|
'type' => Response::MODEL_METRIC_BREAKDOWN,
|
|
|
|
|
'description' => 'Aggregated breakdown in totals of executions by functions.',
|
|
|
|
|
'default' => [],
|
|
|
|
|
'example' => [],
|
|
|
|
|
'array' => true
|
|
|
|
|
])
|
|
|
|
|
->addRule('bucketsBreakdown', [
|
|
|
|
|
'type' => Response::MODEL_METRIC_BREAKDOWN,
|
|
|
|
|
'description' => 'Aggregated breakdown in totals of usage by buckets.',
|
|
|
|
|
'default' => [],
|
|
|
|
|
'example' => [],
|
|
|
|
|
'array' => true
|
|
|
|
|
])
|
2021-08-26 19:31:37 +00:00
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Name
|
2022-05-23 14:54:50 +00:00
|
|
|
*
|
2021-08-26 19:31:37 +00:00
|
|
|
* @return string
|
|
|
|
|
*/
|
2022-05-23 14:54:50 +00:00
|
|
|
public function getName(): string
|
2021-08-26 19:31:37 +00:00
|
|
|
{
|
2021-08-27 16:45:08 +00:00
|
|
|
return 'UsageProject';
|
2021-08-26 19:31:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-08-27 16:45:08 +00:00
|
|
|
* Get Type
|
2022-05-23 14:54:50 +00:00
|
|
|
*
|
2021-08-26 19:31:37 +00:00
|
|
|
* @return string
|
|
|
|
|
*/
|
2022-05-23 14:54:50 +00:00
|
|
|
public function getType(): string
|
2021-08-26 19:31:37 +00:00
|
|
|
{
|
2021-08-27 16:45:08 +00:00
|
|
|
return Response::MODEL_USAGE_PROJECT;
|
2021-08-26 19:31:37 +00:00
|
|
|
}
|
2022-05-23 14:54:50 +00:00
|
|
|
}
|