Fix wrong path, implement tests

This commit is contained in:
Matej Bačo
2025-03-04 16:04:37 +01:00
parent 9b8e4dd862
commit ea30d976a8
8 changed files with 145 additions and 16 deletions
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Functions\Http\Deployments\Status;
namespace Appwrite\Platform\Modules\Functions\Http\Functions\Deployment;
use Appwrite\Event\Event;
use Appwrite\Extend\Exception;
@@ -22,16 +22,16 @@ class Update extends Action
public static function getName()
{
return 'updateDeploymentStatus';
return 'updateFunctionDeployment';
}
public function __construct()
{
$this
->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH)
->setHttpPath('/v1/functions/:functionId/deployments/:deploymentId/status')
->setHttpPath('/v1/functions/:functionId/deployment')
->httpAlias('/v1/functions/:functionId/deployments/:deploymentId')
->desc('Update deployment status')
->desc('Update function\'s deployment')
->groups(['api', 'functions'])
->label('scope', 'functions.write')
->label('event', 'functions.[functionId].deployments.[deploymentId].update')
@@ -39,7 +39,7 @@ class Update extends Action
->label('audits.resource', 'function/{request.functionId}')
->label('sdk', new Method(
namespace: 'functions',
name: 'updateDeploymentStatus',
name: 'updateFunctionDeployment',
description: <<<EOT
Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function.
EOT,
@@ -8,7 +8,6 @@ use Appwrite\Platform\Modules\Functions\Http\Deployments\Create as CreateDeploym
use Appwrite\Platform\Modules\Functions\Http\Deployments\Delete as DeleteDeployment;
use Appwrite\Platform\Modules\Functions\Http\Deployments\Download\Get as DownloadDeployment;
use Appwrite\Platform\Modules\Functions\Http\Deployments\Get as GetDeployment;
use Appwrite\Platform\Modules\Functions\Http\Deployments\Status\Update as UpdateDeploymentStatus;
use Appwrite\Platform\Modules\Functions\Http\Deployments\Template\Create as CreateTemplateDeployment;
use Appwrite\Platform\Modules\Functions\Http\Deployments\Vcs\Create as CreateVcsDeployment;
use Appwrite\Platform\Modules\Functions\Http\Deployments\XList as ListDeployments;
@@ -18,6 +17,7 @@ use Appwrite\Platform\Modules\Functions\Http\Executions\Get as GetExecution;
use Appwrite\Platform\Modules\Functions\Http\Executions\XList as ListExecutions;
use Appwrite\Platform\Modules\Functions\Http\Functions\Create as CreateFunction;
use Appwrite\Platform\Modules\Functions\Http\Functions\Delete as DeleteFunction;
use Appwrite\Platform\Modules\Functions\Http\Functions\Deployment\Update as UpdateFunctionDeployment;
use Appwrite\Platform\Modules\Functions\Http\Functions\Get as GetFunction;
use Appwrite\Platform\Modules\Functions\Http\Functions\Update as UpdateFunction;
use Appwrite\Platform\Modules\Functions\Http\Functions\XList as ListFunctions;
@@ -56,7 +56,7 @@ class Http extends Service
// Deployments
$this->addAction(CreateDeployment::getName(), new CreateDeployment());
$this->addAction(GetDeployment::getName(), new GetDeployment());
$this->addAction(UpdateDeploymentStatus::getName(), new UpdateDeploymentStatus());
$this->addAction(UpdateFunctionDeployment::getName(), new UpdateFunctionDeployment());
$this->addAction(ListDeployments::getName(), new ListDeployments());
$this->addAction(DeleteDeployment::getName(), new DeleteDeployment());
$this->addAction(CreateTemplateDeployment::getName(), new CreateTemplateDeployment());
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Sites\Http\Deployments\Status;
namespace Appwrite\Platform\Modules\Sites\Http\Sites\Deployment;
use Appwrite\Event\Event;
use Appwrite\Extend\Exception;
@@ -20,16 +20,16 @@ class Update extends Action
public static function getName()
{
return 'updateDeploymentStatus';
return 'updateSiteDeployment';
}
public function __construct()
{
$this
->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH)
->setHttpPath('/v1/sites/:siteId/deployments/:deploymentId/status')
->setHttpPath('/v1/sites/:siteId/deployment')
->httpAlias('/v1/sites/:siteId/deployments/:deploymentId')
->desc('Update deployment status')
->desc('Update site\'s deployment')
->groups(['api', 'sites'])
->label('scope', 'sites.write')
->label('event', 'sites.[siteId].deployments.[deploymentId].update')
@@ -37,7 +37,7 @@ class Update extends Action
->label('audits.resource', 'site/{request.siteId}')
->label('sdk', new Method(
namespace: 'sites',
name: 'updateDeploymentStatus',
name: 'updateSiteDeployment',
description: <<<EOT
Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site.
EOT,
@@ -8,7 +8,6 @@ use Appwrite\Platform\Modules\Sites\Http\Deployments\Create as CreateDeployment;
use Appwrite\Platform\Modules\Sites\Http\Deployments\Delete as DeleteDeployment;
use Appwrite\Platform\Modules\Sites\Http\Deployments\Download\Get as DownloadDeployment;
use Appwrite\Platform\Modules\Sites\Http\Deployments\Get as GetDeployment;
use Appwrite\Platform\Modules\Sites\Http\Deployments\Status\Update as UpdateDeploymentStatus;
use Appwrite\Platform\Modules\Sites\Http\Deployments\Template\Create as CreateTemplateDeployment;
use Appwrite\Platform\Modules\Sites\Http\Deployments\Vcs\Create as CreateVcsDeployment;
use Appwrite\Platform\Modules\Sites\Http\Deployments\XList as ListDeployments;
@@ -18,6 +17,7 @@ use Appwrite\Platform\Modules\Sites\Http\Logs\Get as GetLog;
use Appwrite\Platform\Modules\Sites\Http\Logs\XList as ListLogs;
use Appwrite\Platform\Modules\Sites\Http\Sites\Create as CreateSite;
use Appwrite\Platform\Modules\Sites\Http\Sites\Delete as DeleteSite;
use Appwrite\Platform\Modules\Sites\Http\Sites\Deployment\Update as UpdateSiteDeployment;
use Appwrite\Platform\Modules\Sites\Http\Sites\Get as GetSite;
use Appwrite\Platform\Modules\Sites\Http\Sites\Update as UpdateSite;
use Appwrite\Platform\Modules\Sites\Http\Sites\XList as ListSites;
@@ -54,7 +54,7 @@ class Http extends Service
$this->addAction(CreateVcsDeployment::getName(), new CreateVcsDeployment());
$this->addAction(GetDeployment::getName(), new GetDeployment());
$this->addAction(ListDeployments::getName(), new ListDeployments());
$this->addAction(UpdateDeploymentStatus::getName(), new UpdateDeploymentStatus());
$this->addAction(UpdateSiteDeployment::getName(), new UpdateSiteDeployment());
$this->addAction(DeleteDeployment::getName(), new DeleteDeployment());
$this->addAction(DownloadDeployment::getName(), new DownloadDeployment());
$this->addAction(CreateBuild::getName(), new CreateBuild());