-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from SamihSoylu/master
v5.18: Added functionality to convert vps backups to snapshots.
- Loading branch information
Showing
10 changed files
with
55 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
/** | ||
* This example converts a backup to a snapshot for a given vps | ||
* | ||
* @copyright Copyright 2019 TransIP BV | ||
* @author TransIP BV <[email protected]> | ||
*/ | ||
|
||
// Include vpsservice | ||
require_once('Transip/VpsService.php'); | ||
|
||
try { | ||
$vpsName = 'example-vps'; | ||
$snapshotDescription = 'My new snapshot'; | ||
|
||
// Get disk backups for given vps | ||
$diskBackups = Transip_VpsService::getVpsBackupsByVps($vpsName); | ||
// print_r($vpsBackups); | ||
$vpsDiskBackupId = $diskBackups[0]->id; | ||
|
||
// Convert vps backup to a snapshot | ||
Transip_VpsService::convertVpsBackupToSnapshot($vpsName, $snapshotDescription, $vpsDiskBackupId); | ||
echo 'Starting backup to snapshot conversion'; | ||
} catch (SoapFault $f) { | ||
// It is possible that an error occurs when connecting to the TransIP Soap API, | ||
// those errors will be thrown as a SoapFault exception. | ||
echo 'An error occurred: ' . $f->getMessage(), PHP_EOL; | ||
} |