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

86 lines
2.7 KiB
PHP
Raw Normal View History

<?php
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
2023-03-08 18:30:01 +00:00
use stdClass;
use Utopia\Database\Document;
2023-03-08 18:30:01 +00:00
class Rule extends Model
{
public function __construct()
{
$this
->addRule('$id', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
2023-03-08 18:30:01 +00:00
'description' => 'Function ID.',
2021-01-13 15:06:36 +00:00
'default' => '',
'example' => '5e5ea5c16897e',
])
->addRule('$createdAt', [
2022-07-04 09:55:11 +00:00
'type' => self::TYPE_DATETIME,
2023-03-08 18:30:01 +00:00
'description' => 'Function creation date in ISO 8601 format.',
2022-07-04 09:55:11 +00:00
'default' => '',
2022-08-14 10:27:07 +00:00
'example' => self::TYPE_DATETIME_EXAMPLE,
])
->addRule('$updatedAt', [
2022-07-04 09:55:11 +00:00
'type' => self::TYPE_DATETIME,
2023-03-08 18:30:01 +00:00
'description' => 'Function update date in ISO 8601 format.',
2022-07-04 09:55:11 +00:00
'default' => '',
2022-08-14 10:27:07 +00:00
'example' => self::TYPE_DATETIME_EXAMPLE,
])
->addRule('domain', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
'description' => 'Domain name.',
2021-01-13 15:06:36 +00:00
'default' => '',
'example' => 'appwrite.company.com',
])
2023-03-08 18:30:01 +00:00
->addRule('resourceType', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
2023-03-08 18:30:01 +00:00
'description' => 'Action definition for the rule. Possible values are "api", "function", or "redirect"',
2021-01-13 15:06:36 +00:00
'default' => '',
2023-03-08 18:30:01 +00:00
'example' => 'function',
])
2023-03-08 18:30:01 +00:00
->addRule('resourceId', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
2023-03-11 16:06:02 +00:00
'description' => 'ID of resource for the action type. If resourceType is "api" or "url", it is empty. If resourceType is "function", it is ID of the function.',
2021-01-13 15:06:36 +00:00
'default' => '',
2023-03-08 18:30:01 +00:00
'example' => 'myAwesomeFunction',
])
2023-03-08 19:50:51 +00:00
->addRule('status', [
'type' => self::TYPE_STRING,
2023-03-10 19:36:39 +00:00
'description' => 'Domain verification status. Possible values are "created", "verifying", "verified" and "unverified"',
2021-01-13 15:06:36 +00:00
'default' => false,
2023-03-08 19:50:51 +00:00
'example' => 'verified',
])
2023-03-13 13:35:34 +00:00
->addRule('logs', [
'type' => self::TYPE_STRING,
'description' => 'Certificate generation logs. This will return an empty string if generation did not run, or succeeded.',
'default' => '',
'example' => 'HTTP challegne failed.',
])
;
}
/**
* Get Name
*
* @return string
*/
2022-05-23 14:54:50 +00:00
public function getName(): string
{
2023-03-08 18:30:01 +00:00
return 'Rule';
}
/**
2021-12-15 10:19:29 +00:00
* Get Type
*
* @return string
*/
2022-05-23 14:54:50 +00:00
public function getType(): string
{
2023-03-08 18:30:01 +00:00
return Response::MODEL_PROXY_RULE;
}
}