2021-08-26 19:12:36 +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 UsageFunctions extends Model
|
2021-08-26 19:12:36 +00:00
|
|
|
{
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
$this
|
|
|
|
|
->addRule('range', [
|
|
|
|
|
'type' => self::TYPE_STRING,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Time range of the usage stats.',
|
2021-08-26 19:12:36 +00:00
|
|
|
'default' => '',
|
|
|
|
|
'example' => '30d',
|
|
|
|
|
])
|
2023-10-25 09:46:45 +00:00
|
|
|
->addRule('functionsTotal', [
|
2023-11-08 09:09:32 +00:00
|
|
|
'type' => self::TYPE_INTEGER,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Total aggregated number of functions.',
|
2023-11-01 18:44:06 +00:00
|
|
|
'default' => 0,
|
|
|
|
|
'example' => 0,
|
2021-08-26 19:12:36 +00:00
|
|
|
])
|
2023-10-25 09:46:45 +00:00
|
|
|
->addRule('deploymentsTotal', [
|
2023-11-08 09:09:32 +00:00
|
|
|
'type' => self::TYPE_INTEGER,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Total aggregated number of functions deployments.',
|
2023-11-01 18:44:06 +00:00
|
|
|
'default' => 0,
|
|
|
|
|
'example' => 0,
|
|
|
|
|
])
|
2023-11-08 09:09:32 +00:00
|
|
|
->addRule('deploymentsStorageTotal', [
|
|
|
|
|
'type' => self::TYPE_INTEGER,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Total aggregated sum of functions deployment storage.',
|
2023-11-01 18:44:06 +00:00
|
|
|
'default' => 0,
|
|
|
|
|
'example' => 0,
|
|
|
|
|
])
|
|
|
|
|
->addRule('buildsTotal', [
|
2023-11-08 09:09:32 +00:00
|
|
|
'type' => self::TYPE_INTEGER,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Total aggregated number of functions build.',
|
2023-11-01 18:44:06 +00:00
|
|
|
'default' => 0,
|
|
|
|
|
'example' => 0,
|
|
|
|
|
])
|
2023-11-08 09:09:32 +00:00
|
|
|
->addRule('buildsStorageTotal', [
|
|
|
|
|
'type' => self::TYPE_INTEGER,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'total aggregated sum of functions build storage.',
|
2023-11-01 18:44:06 +00:00
|
|
|
'default' => 0,
|
|
|
|
|
'example' => 0,
|
|
|
|
|
])
|
2023-11-08 09:09:32 +00:00
|
|
|
->addRule('buildsTimeTotal', [
|
|
|
|
|
'type' => self::TYPE_INTEGER,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Total aggregated sum of functions build compute time.',
|
2023-11-01 18:44:06 +00:00
|
|
|
'default' => 0,
|
|
|
|
|
'example' => 0,
|
|
|
|
|
])
|
|
|
|
|
->addRule('executionsTotal', [
|
2023-11-08 09:09:32 +00:00
|
|
|
'type' => self::TYPE_INTEGER,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Total aggregated number of functions execution.',
|
2023-11-01 18:44:06 +00:00
|
|
|
'default' => 0,
|
|
|
|
|
'example' => 0,
|
|
|
|
|
])
|
2023-11-08 09:09:32 +00:00
|
|
|
->addRule('executionsTimeTotal', [
|
|
|
|
|
'type' => self::TYPE_INTEGER,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Total aggregated sum of functions execution compute time.',
|
2023-11-01 18:44:06 +00:00
|
|
|
'default' => 0,
|
|
|
|
|
'example' => 0,
|
|
|
|
|
])
|
|
|
|
|
->addRule('functions', [
|
|
|
|
|
'type' => Response::MODEL_METRIC,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Aggregated number of functions per period.',
|
2023-11-01 18:44:06 +00:00
|
|
|
'default' => 0,
|
|
|
|
|
'example' => 0,
|
|
|
|
|
'array' => true
|
|
|
|
|
])
|
|
|
|
|
->addRule('deployments', [
|
|
|
|
|
'type' => Response::MODEL_METRIC,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Aggregated number of functions deployment per period.',
|
2021-08-26 19:12:36 +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:12:36 +00:00
|
|
|
])
|
2023-10-25 09:46:45 +00:00
|
|
|
->addRule('deploymentsStorage', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Aggregated number of functions deployment storage per 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-11-01 18:44:06 +00:00
|
|
|
->addRule('builds', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Aggregated number of functions build per period.',
|
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
|
|
|
|
|
])
|
2023-10-25 09:46:45 +00:00
|
|
|
->addRule('buildsStorage', [
|
2022-12-21 09:22:29 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Aggregated sum of functions build storage per period.',
|
2022-12-21 09:22:29 +00:00
|
|
|
'default' => [],
|
|
|
|
|
'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,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Aggregated sum of functions build compute time per period.',
|
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
|
|
|
|
|
])
|
2023-11-01 18:44:06 +00:00
|
|
|
->addRule('executions', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Aggregated number of functions execution per period.',
|
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
|
|
|
|
|
])
|
2023-10-25 09:46:45 +00:00
|
|
|
|
|
|
|
|
->addRule('executionsTime', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2023-11-09 10:54:33 +00:00
|
|
|
'description' => 'Aggregated number of functions execution compute time per 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
|
|
|
|
|
])
|
2021-08-26 19:12:36 +00:00
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Name
|
2022-05-23 14:54:50 +00:00
|
|
|
*
|
2021-08-26 19:12:36 +00:00
|
|
|
* @return string
|
|
|
|
|
*/
|
2022-05-23 14:54:50 +00:00
|
|
|
public function getName(): string
|
2021-08-26 19:12:36 +00:00
|
|
|
{
|
2021-08-27 16:45:08 +00:00
|
|
|
return 'UsageFunctions';
|
2021-08-26 19:12:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-08-27 16:45:08 +00:00
|
|
|
* Get Type
|
2022-05-23 14:54:50 +00:00
|
|
|
*
|
2021-08-26 19:12:36 +00:00
|
|
|
* @return string
|
|
|
|
|
*/
|
2022-05-23 14:54:50 +00:00
|
|
|
public function getType(): string
|
2021-08-26 19:12:36 +00:00
|
|
|
{
|
2021-08-27 16:45:08 +00:00
|
|
|
return Response::MODEL_USAGE_FUNCTIONS;
|
2021-08-26 19:12:36 +00:00
|
|
|
}
|
2022-05-23 14:54:50 +00:00
|
|
|
}
|