Skip to content

Commit

Permalink
Merge pull request #8 from SamihSoylu/master
Browse files Browse the repository at this point in the history
v5.18: Added functionality to convert vps backups to snapshots.
  • Loading branch information
xvilo authored Oct 3, 2019
2 parents 1b14ee5 + c55bd42 commit e60893f
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
TRANSIP API V5.18
NEW
- Added functionality to convert vps backups to snapshots.

TRANSIP API V5.17
NEW
- Added functionality to get default DNS Entries and Nameservers by domain name.
Expand Down
2 changes: 1 addition & 1 deletion Transip/ColocationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Transip_ColocationService
/** The SOAP service that corresponds with this class. */
const SERVICE = 'ColocationService';
/** The API version. */
const API_VERSION = '5.17';
const API_VERSION = '5.18';
/** @var SoapClient The SoapClient used to perform the SOAP calls. */
protected static $_soapClient = null;

Expand Down
3 changes: 2 additions & 1 deletion Transip/DnsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Transip_DnsService
/** The SOAP service that corresponds with this class. */
const SERVICE = 'DnsService';
/** The API version. */
const API_VERSION = '5.17';
const API_VERSION = '5.18';
/** @var SoapClient The SoapClient used to perform the SOAP calls. */
protected static $_soapClient = null;

Expand Down Expand Up @@ -225,6 +225,7 @@ public static function getDnsSecEntries($domainName)
*
* @param string $domainName
* @param Transip_DnsSecEntry[] $dnssecKeyEntrySet
* @throws ApiException
* @example examples/DnsService-setDnsSecEntries.php
*/
public static function setDnsSecEntries($domainName, $dnssecKeyEntrySet)
Expand Down
2 changes: 1 addition & 1 deletion Transip/DomainService.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Transip_DomainService
/** The SOAP service that corresponds with this class. */
const SERVICE = 'DomainService';
/** The API version. */
const API_VERSION = '5.17';
const API_VERSION = '5.18';
/** @var SoapClient The SoapClient used to perform the SOAP calls. */
protected static $_soapClient = null;

Expand Down
2 changes: 1 addition & 1 deletion Transip/ForwardService.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Transip_ForwardService
/** The SOAP service that corresponds with this class. */
const SERVICE = 'ForwardService';
/** The API version. */
const API_VERSION = '5.17';
const API_VERSION = '5.18';
/** @var SoapClient The SoapClient used to perform the SOAP calls. */
protected static $_soapClient = null;

Expand Down
2 changes: 1 addition & 1 deletion Transip/HaipService.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Transip_HaipService
/** The SOAP service that corresponds with this class. */
const SERVICE = 'HaipService';
/** The API version. */
const API_VERSION = '5.17';
const API_VERSION = '5.18';
/** @var SoapClient The SoapClient used to perform the SOAP calls. */
protected static $_soapClient = null;

Expand Down
2 changes: 1 addition & 1 deletion Transip/PropositionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Transip_PropositionService
/** The SOAP service that corresponds with this class. */
const SERVICE = 'PropositionService';
/** The API version. */
const API_VERSION = '5.17';
const API_VERSION = '5.18';
/** @var SoapClient The SoapClient used to perform the SOAP calls. */
protected static $_soapClient = null;

Expand Down
15 changes: 14 additions & 1 deletion Transip/VpsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Transip_VpsService
/** The SOAP service that corresponds with this class. */
const SERVICE = 'VpsService';
/** The API version. */
const API_VERSION = '5.17';
const API_VERSION = '5.18';
/** @var SoapClient The SoapClient used to perform the SOAP calls. */
protected static $_soapClient = null;

Expand Down Expand Up @@ -697,6 +697,19 @@ public static function getAvailableAvailabilityZones()
{
return self::_getSoapClient(array_merge(array(), array('__method' => 'getAvailableAvailabilityZones')))->getAvailableAvailabilityZones();
}

/**
* Convert a backup to a Snapshot
*
* @param string $vpsName The vps name
* @param string $description The snapshot description
* @param int $diskBackupId The selected backup id
* @throws ApiException on error
*/
public static function convertVpsBackupToSnapshot($vpsName, $description, $diskBackupId)
{
return self::_getSoapClient(array_merge(array($vpsName, $description, $diskBackupId), array('__method' => 'convertVpsBackupToSnapshot')))->convertVpsBackupToSnapshot($vpsName, $description, $diskBackupId);
}
}

?>
2 changes: 1 addition & 1 deletion Transip/WebhostingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Transip_WebhostingService
/** The SOAP service that corresponds with this class. */
const SERVICE = 'WebhostingService';
/** The API version. */
const API_VERSION = '5.17';
const API_VERSION = '5.18';
/** @var SoapClient The SoapClient used to perform the SOAP calls. */
protected static $_soapClient = null;

Expand Down
29 changes: 29 additions & 0 deletions examples/VpsService-convertBackupToSnapshot.php
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;
}

0 comments on commit e60893f

Please sign in to comment.