Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the new Availability zones for VPS. #14

Merged
merged 4 commits into from
Jun 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions doc/vps.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,27 @@ $hostname = 'baymax.foo.com';
$client->vps()->orderVps($productName, $addons, $operatingSystemName, $hostname);
````

#### Order a VPS with optional add-ons in AvailabilityZone.
````php
$productName = 'vps-bladevps-x1'
$addons = ['vpsAddon-1-extra-ip-address'];
$operatingSystemName = 'ubuntu-14.04-transip';
$hostname = 'baymax.foo.com';
$availabilityZone = 'ams0';

$client->vps()->orderVpsInAvailabilityZone($productName, $addons, $operatingSystemName, $hostname, $availabilityZone);
````

#### Clone a VPS.
````php
$client->vps()->cloneVps('fooVps');
````

#### Clone a VPS to AvailabilityZone.
````php
$client->vps()->cloneVpsToAvailabilityZone('fooVps', 'ams01');
````

#### Order add-ons for a VPS.
````php
$client->vps()->orderAddon('fooVps', 'vpsAddon-1-extra-ip-address');
Expand Down Expand Up @@ -241,3 +257,8 @@ $client->vps()->setCustomerLock('fooVps', true);
````php
$client->vps()->handoverVps('fooVps', 'fooUsername');
````

#### Get all active Availablity zones for VPS.
````php
$client->vps()->getAvailableAvailabilityZones();
````
45 changes: 45 additions & 0 deletions src/Api/Vps.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,24 @@ public function orderVps($productName, array $addons, $operatingSystemName, $hos
{
return $this->call(self::SERVICE, 'orderVps', [$productName, $addons, $operatingSystemName, $hostname]);
}

/**
* Order a VPS with optional add-ons.
*
* @param string $productName Name of the product
* @param string[] $addons Array with additional add-ons
* @param string $operatingSystemName Name of the operating system to install
* @param string $hostname Hostname for the VPS
* @param string $availabilityZone Availability zone for the VPS
*
* @throws \SoapFault
*
* @return mixed
*/
public function orderVpsInAvailabilityZone($productName, array $addons, $operatingSystemName, $hostname, $availabilityZone)
{
return $this->call(self::SERVICE, 'orderVps', [$productName, $addons, $operatingSystemName, $hostname, $availabilityZone]);
}

/**
* Clone a VPS.
Expand All @@ -105,6 +123,21 @@ public function cloneVps($vpsName)
{
return $this->call(self::SERVICE, 'cloneVps', [$vpsName]);
}

/**
* Clone a VPS to AvailabilityZone.
*
* @param string $vpsName The vps name
* @param string $availabilityZone Availability zone for the VPS
*
* @throws \SoapFault
*
* @return mixed
*/
public function cloneVpsToAvailabilityZone($vpsName, $availabilityZone)
{
return $this->call(self::SERVICE, 'cloneVps', [$vpsName, $availabilityZone]);
}

/**
* Order add-ons for a VPS.
Expand Down Expand Up @@ -550,4 +583,16 @@ public function handoverVps($vpsName, $targetAccountName)
{
$this->call(self::SERVICE, 'handoverVps', [$vpsName, $targetAccountName]);
}

/**
* Get all available availability zones.
*
* @throws \SoapFault
*
* @return \TransIP\Model\AvailabilityZone[]
*/
public function getAvailableAvailabilityZones()
{
return $this->call(self::SERVICE, 'getAvailableAvailabilityZones');
}
}
24 changes: 24 additions & 0 deletions src/Model/AvailabilityZone.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace TransIP\Model;

/**
* @author Peter Steenbergen <psteenbergen@gmail.com>
*/
class AvailabilityZone
{
/**
* @var string
*/
public $name;

/**
* @var string
*/
public $country;

/**
* @var boolean
*/
public $isDefault;
}
5 changes: 5 additions & 0 deletions src/Model/Vps.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,9 @@ class Vps
* @var bool
*/
public $isCustomerLocked;

/**
* @var string
*/
public $availabilityZone;
}