appwrite/src/Appwrite/Utopia/Response/Model/UsageFunction.php

137 lines
4.7 KiB
PHP
Raw Normal View History

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',
])
2023-10-25 09:46:45 +00:00
->addRule('deploymentsTotal', [
'type' => self::TYPE_INTEGER,
'description' => 'Aggregated total statistics of function deployments.',
'default' => 0,
'example' => 0,
])
->addRule('deploymentsStorageTotal', [
'type' => self::TYPE_INTEGER,
'description' => 'Aggregated total statistics of function deployments storage.',
'default' => 0,
'example' => 0,
])
->addRule('buildsTotal', [
'type' => self::TYPE_INTEGER,
'description' => 'Aggregated total statistics of function builds.',
'default' => 0,
'example' => 0,
])
->addRule('buildsStorageTotal', [
'type' => self::TYPE_INTEGER,
'description' => 'Aggregate total statistics for build storage.',
'default' => 0,
'example' => 0,
'array' => true
])
->addRule('buildsTimeTotal', [
'type' => self::TYPE_INTEGER,
'description' => 'Aggregate total function build compute time statistics.',
'default' => [],
'example' => [],
'array' => true
])
->addRule('executionsTotal', [
'type' => self::TYPE_INTEGER,
'description' => 'Aggregated total function executions statistics.',
'default' => [],
'example' => [],
'array' => true
])
->addRule('executionsTimeTotal', [
'type' => self::TYPE_INTEGER,
'description' => 'Aggregated for total function execution compute time statistics.',
'default' => 0,
'example' => 0,
])
->addRule('deployments', [
2022-10-11 10:34:42 +00:00
'type' => Response::MODEL_METRIC,
'description' => 'Aggregated statistics for the number of function deployments per time period.',
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
])
2023-10-25 09:46:45 +00:00
->addRule('deploymentsStorage', [
2022-10-11 10:34:42 +00:00
'type' => Response::MODEL_METRIC,
'description' => 'Aggregated statistics for function deployment storage per time period.',
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
])
->addRule('builds', [
2022-12-21 09:22:29 +00:00
'type' => Response::MODEL_METRIC,
'description' => 'Aggregated statistics for the number of function builds per time period.',
2022-12-21 09:22:29 +00:00
'default' => [],
'example' => [],
'array' => true
])
2023-10-25 09:46:45 +00:00
->addRule('buildsStorage', [
2022-10-11 10:34:42 +00:00
'type' => Response::MODEL_METRIC,
'description' => 'Aggregated statistics for build storage per time period.',
'default' => [],
2022-10-11 10:34:42 +00:00
'example' => [],
'array' => true
])
2023-10-25 09:46:45 +00:00
->addRule('buildsTime', [
2022-10-11 10:34:42 +00:00
'type' => Response::MODEL_METRIC,
'description' => 'Aggregated statistics for function build compute per time period.',
'default' => [],
2022-10-11 10:34:42 +00:00
'example' => [],
'array' => true
])
->addRule('executions', [
2023-08-20 15:40:05 +00:00
'type' => Response::MODEL_METRIC,
'description' => 'Aggregated statistics for the number of function executions per time period.',
2023-08-20 15:40:05 +00:00
'default' => [],
'example' => [],
'array' => true
])
2023-10-25 09:46:45 +00:00
->addRule('executionsTime', [
2022-10-11 10:34:42 +00:00
'type' => Response::MODEL_METRIC,
'description' => 'Aggregated statistics for function execution compute per time period.',
'default' => [],
2022-10-11 10:34:42 +00:00
'example' => [],
'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;
}
}