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-08-11 05:25:39 +00:00
|
|
|
->addRule('executionsTotal', [
|
2022-07-17 10:30:58 +00:00
|
|
|
'type' => Response::MODEL_METRIC_LIST,
|
2022-08-11 05:25:39 +00:00
|
|
|
'description' => 'Aggregated stats for number of function executions.',
|
2022-07-17 10:30:58 +00:00
|
|
|
'default' => [],
|
|
|
|
|
'example' => new \stdClass(),
|
|
|
|
|
'array' => true
|
|
|
|
|
])
|
2022-08-11 05:25:39 +00:00
|
|
|
->addRule('executionsFailure', [
|
2022-07-17 10:30:58 +00:00
|
|
|
'type' => Response::MODEL_METRIC_LIST,
|
|
|
|
|
'description' => 'Aggregated stats for function execution failures.',
|
|
|
|
|
'default' => [],
|
|
|
|
|
'example' => new \stdClass(),
|
|
|
|
|
'array' => true
|
|
|
|
|
])
|
2022-08-11 05:25:39 +00:00
|
|
|
->addRule('executionsSuccess', [
|
|
|
|
|
'type' => Response::MODEL_METRIC_LIST,
|
|
|
|
|
'description' => 'Aggregated stats for function execution successes.',
|
|
|
|
|
'default' => [],
|
|
|
|
|
'example' => new \stdClass(),
|
|
|
|
|
'array' => true
|
|
|
|
|
])
|
|
|
|
|
->addRule('executionsTime', [
|
2022-07-17 10:30:58 +00:00
|
|
|
'type' => Response::MODEL_METRIC_LIST,
|
|
|
|
|
'description' => 'Aggregated stats for function execution duration.',
|
|
|
|
|
'default' => [],
|
|
|
|
|
'example' => new \stdClass(),
|
|
|
|
|
'array' => true
|
|
|
|
|
])
|
2022-08-11 05:25:39 +00:00
|
|
|
->addRule('buildsTotal', [
|
|
|
|
|
'type' => Response::MODEL_METRIC_LIST,
|
|
|
|
|
'description' => 'Aggregated stats for number of function builds.',
|
|
|
|
|
'default' => [],
|
|
|
|
|
'example' => new \stdClass(),
|
|
|
|
|
'array' => true
|
|
|
|
|
])
|
|
|
|
|
->addRule('buildsFailure', [
|
|
|
|
|
'type' => Response::MODEL_METRIC_LIST,
|
|
|
|
|
'description' => 'Aggregated stats for function build failures.',
|
|
|
|
|
'default' => [],
|
|
|
|
|
'example' => new \stdClass(),
|
|
|
|
|
'array' => true
|
|
|
|
|
])
|
|
|
|
|
->addRule('buildsSuccess', [
|
|
|
|
|
'type' => Response::MODEL_METRIC_LIST,
|
|
|
|
|
'description' => 'Aggregated stats for function build successes.',
|
|
|
|
|
'default' => [],
|
|
|
|
|
'example' => new \stdClass(),
|
|
|
|
|
'array' => true
|
|
|
|
|
])
|
|
|
|
|
->addRule('buildsTime', [
|
|
|
|
|
'type' => Response::MODEL_METRIC_LIST,
|
|
|
|
|
'description' => 'Aggregated stats for function build duration.',
|
|
|
|
|
'default' => [],
|
|
|
|
|
'example' => new \stdClass(),
|
|
|
|
|
'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;
|
|
|
|
|
}
|
|
|
|
|
}
|