diff --git a/README.md b/README.md index 49c08d0..171e926 100644 --- a/README.md +++ b/README.md @@ -254,6 +254,8 @@ $forge->updateSiteEnvironmentFile($serverId, $siteId, $content); $forge->installGitRepositoryOnSite($serverId, $siteId, array $data, $wait = false); $forge->updateSiteGitRepository($serverId, $siteId, array $data); $forge->destroySiteGitRepository($serverId, $siteId, $wait = false); +$forge->createSiteDeployKey($serverId, $siteId); +$forge->destroySiteDeployKey($serverId, $siteId); $forge->siteDeploymentScript($serverId, $siteId); $forge->updateSiteDeploymentScript($serverId, $siteId, $content); $forge->enableQuickDeploy($serverId, $siteId); @@ -288,6 +290,8 @@ $site->delete(); $site->installGitRepository(array $data, $wait = false); $site->updateGitRepository(array $data); $site->destroyGitRepository($wait = false); +$site->createDeployKey(); +$site->destroyDeployKey(); $site->getDeploymentScript(); $site->updateDeploymentScript($content); $site->enableQuickDeploy(); diff --git a/src/Actions/ManagesSites.php b/src/Actions/ManagesSites.php index 4391cac..4f8774b 100644 --- a/src/Actions/ManagesSites.php +++ b/src/Actions/ManagesSites.php @@ -215,6 +215,30 @@ public function destroySiteGitRepository($serverId, $siteId, $wait = true) } } + /** + * Create a new deploy key on the site. + * + * @param int $serverId + * @param int $siteId + * @return string + */ + public function createSiteDeployKey($serverId, $siteId) + { + return $this->post("servers/$serverId/sites/$siteId/deploy-key"); + } + + /** + * Destroy the deploy key on the site. + * + * @param mixed $serverId + * @param mixed $siteId + * @return void + */ + public function destroySiteDeployKey($serverId, $siteId) + { + $this->delete("servers/$serverId/sites/$siteId/deploy-key"); + } + /** * Get the content of the site's deployment script. * diff --git a/src/Facades/Forge.php b/src/Facades/Forge.php index 73a6bbc..8fb9fe0 100644 --- a/src/Facades/Forge.php +++ b/src/Facades/Forge.php @@ -117,6 +117,8 @@ * @method static void installGitRepositoryOnSite(int $serverId, int $siteId, array $data, bool $wait = true) * @method static void updateSiteGitRepository(int $serverId, int $siteId, array $data) * @method static void destroySiteGitRepository(int $serverId, int $siteId, bool $wait = true) + * @method static void createSiteDeployKey(int $serverId, int $siteId) + * @method static void destroySiteDeployKey(int $serverId, int $siteId) * @method static string siteDeploymentScript(int $serverId, int $siteId) * @method static void updateSiteDeploymentScript(int $serverId, int $siteId, string $content, bool $autoSource = false) * @method static void enableQuickDeploy(int $serverId, int $siteId) diff --git a/src/Resources/Site.php b/src/Resources/Site.php index ac8dd7c..b8b3f06 100644 --- a/src/Resources/Site.php +++ b/src/Resources/Site.php @@ -259,6 +259,26 @@ public function destroyGitRepository($wait = true) $this->forge->destroySiteGitRepository($this->serverId, $this->id, $wait); } + /** + * Create a new deploy key on the site. + * + * @return string + */ + public function createDeployKey() + { + return $this->forge->createSiteDeployKey($this->serverId, $this->id); + } + + /** + * Destroy the deploy key on the site. + * + * @return void + */ + public function destroyDeployKey() + { + $this->forge->destroySiteDeployKey($this->serverId, $this->id); + } + /** * Get the content of the site's deployment script. *