Move actions into context menu, add support for deleting a backup

This commit is contained in:
Dane Everitt 2020-04-09 22:08:09 -07:00
parent 2eb6ab4d63
commit 9ba6aaebde
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
10 changed files with 344 additions and 66 deletions

View file

@ -39,22 +39,19 @@ class DaemonBackupRepository extends DaemonRepository
}
/**
* Returns a stream of a backup's contents from the Wings instance so that we
* do not need to send the user directly to the Daemon.
* Deletes a backup from the daemon.
*
* @param string $backup
* @param \Pterodactyl\Models\Backup $backup
* @return \Psr\Http\Message\ResponseInterface
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function getBackup(string $backup): ResponseInterface
public function delete(Backup $backup): ResponseInterface
{
Assert::isInstanceOf($this->server, Server::class);
try {
return $this->getHttpClient()->get(
sprintf('/api/servers/%s/backup/%s', $this->server->uuid, $backup),
['stream' => true]
return $this->getHttpClient()->delete(
sprintf('/api/servers/%s/backup/%s', $this->server->uuid, $backup->uuid)
);
} catch (TransferException $exception) {
throw new DaemonConnectionException($exception);