2021-08-27 07:31:37 +12:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
use Appwrite\Utopia\Response;
|
|
|
|
use Appwrite\Utopia\Response\Model;
|
|
|
|
|
2021-08-28 04:45:08 +12:00
|
|
|
class UsageProject extends Model
|
2021-08-27 07:31:37 +12:00
|
|
|
{
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this
|
|
|
|
->addRule('range', [
|
|
|
|
'type' => self::TYPE_STRING,
|
|
|
|
'description' => 'The time range of the usage stats.',
|
|
|
|
'default' => '',
|
|
|
|
'example' => '30d',
|
|
|
|
])
|
|
|
|
->addRule('requests', [
|
2022-10-11 23:34:42 +13:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2021-08-27 07:31:37 +12:00
|
|
|
'description' => 'Aggregated stats for number of requests.',
|
|
|
|
'default' => [],
|
2022-10-11 23:34:42 +13:00
|
|
|
'example' => [],
|
2022-05-24 02:54:50 +12:00
|
|
|
'array' => true
|
2021-08-27 07:31:37 +12:00
|
|
|
])
|
|
|
|
->addRule('network', [
|
2022-10-11 23:34:42 +13:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2021-08-27 07:31:37 +12:00
|
|
|
'description' => 'Aggregated stats for consumed bandwidth.',
|
|
|
|
'default' => [],
|
2022-10-11 23:34:42 +13:00
|
|
|
'example' => [],
|
2022-05-24 02:54:50 +12:00
|
|
|
'array' => true
|
2021-08-27 07:31:37 +12:00
|
|
|
])
|
2022-08-11 18:05:38 +12:00
|
|
|
->addRule('executions', [
|
2022-10-11 23:34:42 +13:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2021-08-27 07:31:37 +12:00
|
|
|
'description' => 'Aggregated stats for function executions.',
|
|
|
|
'default' => [],
|
2022-10-11 23:34:42 +13:00
|
|
|
'example' => [],
|
2022-05-24 02:54:50 +12:00
|
|
|
'array' => true
|
2021-08-27 07:31:37 +12:00
|
|
|
])
|
|
|
|
->addRule('documents', [
|
2022-10-11 23:34:42 +13:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2021-08-27 07:31:37 +12:00
|
|
|
'description' => 'Aggregated stats for number of documents.',
|
|
|
|
'default' => [],
|
2022-10-11 23:34:42 +13:00
|
|
|
'example' => [],
|
2022-05-24 02:54:50 +12:00
|
|
|
'array' => true
|
2021-08-27 07:31:37 +12:00
|
|
|
])
|
2022-11-09 01:09:18 +13:00
|
|
|
->addRule('databases', [
|
2022-10-11 23:34:42 +13:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2022-11-09 01:09:18 +13:00
|
|
|
'description' => 'Aggregated stats for number of databases.',
|
2021-08-27 07:31:37 +12:00
|
|
|
'default' => [],
|
2022-10-11 23:34:42 +13:00
|
|
|
'example' => [],
|
2022-05-24 02:54:50 +12:00
|
|
|
'array' => true
|
2021-08-27 07:31:37 +12:00
|
|
|
])
|
|
|
|
->addRule('users', [
|
2022-10-11 23:34:42 +13:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2021-08-27 07:31:37 +12:00
|
|
|
'description' => 'Aggregated stats for number of users.',
|
|
|
|
'default' => [],
|
2022-10-11 23:34:42 +13:00
|
|
|
'example' => [],
|
2022-05-24 02:54:50 +12:00
|
|
|
'array' => true
|
2021-08-27 07:31:37 +12:00
|
|
|
])
|
2021-08-29 04:08:50 +12:00
|
|
|
->addRule('storage', [
|
2022-10-11 23:34:42 +13:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2021-08-29 04:08:50 +12:00
|
|
|
'description' => 'Aggregated stats for the occupied storage size (in bytes).',
|
2021-08-27 07:31:37 +12:00
|
|
|
'default' => [],
|
2022-10-11 23:34:42 +13:00
|
|
|
'example' => [],
|
2022-05-24 02:54:50 +12:00
|
|
|
'array' => true
|
2021-08-27 07:31:37 +12:00
|
|
|
])
|
2022-11-09 01:09:18 +13:00
|
|
|
->addRule('buckets', [
|
|
|
|
'type' => Response::MODEL_METRIC,
|
|
|
|
'description' => 'Aggregated stats for number of buckets.',
|
|
|
|
'default' => [],
|
|
|
|
'example' => [],
|
|
|
|
'array' => true
|
|
|
|
])
|
2021-08-27 07:31:37 +12:00
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get Name
|
2022-05-24 02:54:50 +12:00
|
|
|
*
|
2021-08-27 07:31:37 +12:00
|
|
|
* @return string
|
|
|
|
*/
|
2022-05-24 02:54:50 +12:00
|
|
|
public function getName(): string
|
2021-08-27 07:31:37 +12:00
|
|
|
{
|
2021-08-28 04:45:08 +12:00
|
|
|
return 'UsageProject';
|
2021-08-27 07:31:37 +12:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-08-28 04:45:08 +12:00
|
|
|
* Get Type
|
2022-05-24 02:54:50 +12:00
|
|
|
*
|
2021-08-27 07:31:37 +12:00
|
|
|
* @return string
|
|
|
|
*/
|
2022-05-24 02:54:50 +12:00
|
|
|
public function getType(): string
|
2021-08-27 07:31:37 +12:00
|
|
|
{
|
2021-08-28 04:45:08 +12:00
|
|
|
return Response::MODEL_USAGE_PROJECT;
|
2021-08-27 07:31:37 +12:00
|
|
|
}
|
2022-05-24 02:54:50 +12:00
|
|
|
}
|