Skip to content

Commit

Permalink
Merge pull request #180 from RobertBoes/patch-1
Browse files Browse the repository at this point in the history
Add deploy-key methods
  • Loading branch information
jbrooksuk authored Jul 25, 2024
2 parents 4a2ff1f + 1ab9b3b commit b81e738
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
24 changes: 24 additions & 0 deletions src/Actions/ManagesSites.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 array
*/
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.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Facades/Forge.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
20 changes: 20 additions & 0 deletions src/Resources/Site.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 array
*/
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.
*
Expand Down

0 comments on commit b81e738

Please sign in to comment.