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
|
|
|
|
|
->addRule('range', [
|
|
|
|
|
'type' => self::TYPE_STRING,
|
|
|
|
|
'description' => 'The time range of the usage stats.',
|
|
|
|
|
'default' => '',
|
|
|
|
|
'example' => '30d',
|
|
|
|
|
])
|
2023-02-05 20:07:46 +00:00
|
|
|
->addRule('requestsTotal', [
|
2022-12-12 07:54:53 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
|
|
|
|
'description' => 'Aggregated stats for number of requests.',
|
|
|
|
|
'default' => [],
|
|
|
|
|
'example' => [],
|
|
|
|
|
'array' => true
|
|
|
|
|
])
|
2021-08-26 19:31:37 +00:00
|
|
|
->addRule('network', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2021-08-26 19:31:37 +00:00
|
|
|
'description' => 'Aggregated stats for consumed bandwidth.',
|
|
|
|
|
'default' => [],
|
2022-10-11 10:34:42 +00:00
|
|
|
'example' => [],
|
2022-05-23 14:54:50 +00:00
|
|
|
'array' => true
|
2021-08-26 19:31:37 +00:00
|
|
|
])
|
2023-02-05 20:07:46 +00:00
|
|
|
->addRule('executionsTotal', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2021-08-26 19:31:37 +00:00
|
|
|
'description' => 'Aggregated stats for function executions.',
|
|
|
|
|
'default' => [],
|
2022-10-11 10:34:42 +00:00
|
|
|
'example' => [],
|
2022-05-23 14:54:50 +00:00
|
|
|
'array' => true
|
2021-08-26 19:31:37 +00:00
|
|
|
])
|
2023-02-05 20:07:46 +00:00
|
|
|
->addRule('documentsTotal', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2021-08-26 19:31:37 +00:00
|
|
|
'description' => 'Aggregated stats for number of documents.',
|
|
|
|
|
'default' => [],
|
2022-10-11 10:34:42 +00:00
|
|
|
'example' => [],
|
2022-05-23 14:54:50 +00:00
|
|
|
'array' => true
|
2021-08-26 19:31:37 +00:00
|
|
|
])
|
2023-02-05 20:07:46 +00:00
|
|
|
->addRule('databasesTotal', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2022-11-08 12:09:18 +00:00
|
|
|
'description' => 'Aggregated stats for number of databases.',
|
2021-08-26 19:31:37 +00:00
|
|
|
'default' => [],
|
2022-10-11 10:34:42 +00:00
|
|
|
'example' => [],
|
2022-05-23 14:54:50 +00:00
|
|
|
'array' => true
|
2021-08-26 19:31:37 +00:00
|
|
|
])
|
2023-02-05 20:07:46 +00:00
|
|
|
->addRule('usersTotal', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2021-08-26 19:31:37 +00:00
|
|
|
'description' => 'Aggregated stats for number of users.',
|
|
|
|
|
'default' => [],
|
2022-10-11 10:34:42 +00:00
|
|
|
'example' => [],
|
2022-05-23 14:54:50 +00:00
|
|
|
'array' => true
|
2021-08-26 19:31:37 +00:00
|
|
|
])
|
2023-02-05 20:07:46 +00:00
|
|
|
->addRule('filesStorage', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2021-08-28 16:08:50 +00:00
|
|
|
'description' => 'Aggregated stats for the occupied storage size (in bytes).',
|
2021-08-26 19:31:37 +00:00
|
|
|
'default' => [],
|
2022-10-11 10:34:42 +00:00
|
|
|
'example' => [],
|
2022-05-23 14:54:50 +00:00
|
|
|
'array' => true
|
2021-08-26 19:31:37 +00:00
|
|
|
])
|
2023-02-05 20:07:46 +00:00
|
|
|
->addRule('bucketsTotal', [
|
2022-11-08 12:09:18 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
|
|
|
|
'description' => 'Aggregated stats for number of 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
|
|
|
}
|