2022-07-17 10:30:58 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
|
|
use Appwrite\Utopia\Response;
|
|
|
|
|
use Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
|
|
class UsageFunction extends Model
|
|
|
|
|
{
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
$this
|
|
|
|
|
->addRule('range', [
|
|
|
|
|
'type' => self::TYPE_STRING,
|
|
|
|
|
'description' => 'The time range of the usage stats.',
|
|
|
|
|
'default' => '',
|
|
|
|
|
'example' => '30d',
|
|
|
|
|
])
|
2022-12-13 07:35:05 +00:00
|
|
|
->addRule('deployments', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2022-12-13 07:35:05 +00:00
|
|
|
'description' => 'Aggregated stats for number of function deployments.',
|
2022-07-17 10:30:58 +00:00
|
|
|
'default' => [],
|
2022-10-11 10:34:42 +00:00
|
|
|
'example' => [],
|
2022-07-17 10:30:58 +00:00
|
|
|
'array' => true
|
|
|
|
|
])
|
2022-12-13 07:35:05 +00:00
|
|
|
->addRule('deploymentsStorage', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2022-12-13 07:35:05 +00:00
|
|
|
'description' => 'Aggregated stats for function deployments storage.',
|
2022-07-17 10:30:58 +00:00
|
|
|
'default' => [],
|
2022-10-11 10:34:42 +00:00
|
|
|
'example' => [],
|
2022-07-17 10:30:58 +00:00
|
|
|
'array' => true
|
|
|
|
|
])
|
2022-12-13 07:35:05 +00:00
|
|
|
->addRule('builds', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2022-08-11 05:25:39 +00:00
|
|
|
'description' => 'Aggregated stats for number of function builds.',
|
|
|
|
|
'default' => [],
|
2022-10-11 10:34:42 +00:00
|
|
|
'example' => [],
|
2022-08-11 05:25:39 +00:00
|
|
|
'array' => true
|
|
|
|
|
])
|
2022-12-13 07:35:05 +00:00
|
|
|
->addRule('buildsCompute', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2022-12-13 07:35:05 +00:00
|
|
|
'description' => 'Aggregated stats for function build compute.',
|
2022-08-11 05:25:39 +00:00
|
|
|
'default' => [],
|
2022-10-11 10:34:42 +00:00
|
|
|
'example' => [],
|
2022-08-11 05:25:39 +00:00
|
|
|
'array' => true
|
|
|
|
|
])
|
2022-12-13 07:35:05 +00:00
|
|
|
->addRule('executions', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2022-12-13 07:35:05 +00:00
|
|
|
'description' => 'Aggregated stats for number of function executions.',
|
2022-08-11 05:25:39 +00:00
|
|
|
'default' => [],
|
2022-10-11 10:34:42 +00:00
|
|
|
'example' => [],
|
2022-08-11 05:25:39 +00:00
|
|
|
'array' => true
|
|
|
|
|
])
|
2022-12-13 07:35:05 +00:00
|
|
|
|
|
|
|
|
->addRule('executionsCompute', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2022-12-13 07:35:05 +00:00
|
|
|
'description' => 'Aggregated stats for function execution compute.',
|
2022-08-11 05:25:39 +00:00
|
|
|
'default' => [],
|
2022-10-11 10:34:42 +00:00
|
|
|
'example' => [],
|
2022-08-11 05:25:39 +00:00
|
|
|
'array' => true
|
|
|
|
|
])
|
2022-07-17 10:30:58 +00:00
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Name
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getName(): string
|
|
|
|
|
{
|
|
|
|
|
return 'UsageFunction';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Type
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getType(): string
|
|
|
|
|
{
|
|
|
|
|
return Response::MODEL_USAGE_FUNCTION;
|
|
|
|
|
}
|
|
|
|
|
}
|