Skip to content

Commit 8ecced7

Browse files
authored
Merge pull request #530 from DawidVH/33865-ecloud-vpn-gateway-specifications
VPN Gateway Specifications
2 parents 86e37d2 + 4479a38 commit 8ecced7

File tree

4 files changed

+78
-0
lines changed

4 files changed

+78
-0
lines changed

src/eCloud/AvailabilityZoneClient.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use UKFast\SDK\eCloud\Entities\Product;
66
use UKFast\SDK\eCloud\Entities\ResourceTier;
77
use UKFast\SDK\eCloud\Entities\VPC\Iops;
8+
use UKFast\SDK\eCloud\Entities\VpnGatewaySpecification;
89
use UKFast\SDK\Entities\ClientEntityInterface;
910
use UKFast\SDK\Traits\PageItems;
1011
use UKFast\SDK\eCloud\Entities\AvailabilityZone;
@@ -47,4 +48,11 @@ public function getIops($id, $filters = [])
4748
return new Iops($this->apiToFriendly($data, Iops::$entityMap));
4849
}, $filters);
4950
}
51+
52+
public function getVpnGatewaySpecifications($id, $filters = [])
53+
{
54+
return $this->getChildResources($id, 'vpn-gateway-specifications', function ($data) {
55+
return new VpnGatewaySpecification($this->apiToFriendly($data, VpnGatewaySpecification::$entityMap));
56+
}, $filters);
57+
}
5058
}

src/eCloud/Client.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,4 +383,12 @@ public function software()
383383
{
384384
return (new SoftwareClient($this->httpClient))->auth($this->token);
385385
}
386+
387+
/**
388+
* @return BaseClient
389+
*/
390+
public function vpnGatewaySpecifications()
391+
{
392+
return (new VpnGatewaySpecificationClient($this->httpClient))->auth($this->token);
393+
}
386394
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace UKFast\SDK\eCloud\Entities;
4+
5+
use DateTime;
6+
use UKFast\SDK\Entity;
7+
8+
/**
9+
* @property string $id
10+
* @property string $name
11+
* @property string $description
12+
* @property integer $maxUsers
13+
* @property DateTime $createdAt
14+
* @property DateTime $updatedAt
15+
*/
16+
class VpnGatewaySpecification extends Entity
17+
{
18+
protected $dates = ['createdAt', 'updatedAt'];
19+
20+
public static $entityMap = [
21+
'id' => 'id',
22+
'name' => 'name',
23+
'description' => 'description',
24+
'max_users' => 'maxUsers',
25+
'created_at' => 'createdAt',
26+
'updated_at' => 'updatedAt',
27+
];
28+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace UKFast\SDK\eCloud;
4+
5+
use UKFast\SDK\eCloud\Entities\AvailabilityZone;
6+
use UKFast\SDK\eCloud\Entities\VpnGatewaySpecification;
7+
use UKFast\SDK\Entities\ClientEntityInterface;
8+
use UKFast\SDK\Traits\PageItems;
9+
10+
class VpnGatewaySpecificationClient extends Client implements ClientEntityInterface
11+
{
12+
use PageItems;
13+
14+
protected $collectionPath = 'v2/vpn-gateway-specifications';
15+
16+
public function getEntityMap()
17+
{
18+
return VpnGatewaySpecification::$entityMap;
19+
}
20+
21+
public function loadEntity($data)
22+
{
23+
return new VpnGatewaySpecification(
24+
$this->apiToFriendly($data, VpnGatewaySpecification::$entityMap)
25+
);
26+
}
27+
28+
public function getAvailabilityZones($id, $filters = [])
29+
{
30+
return $this->getChildResources($id, 'availability-zones', function ($data) {
31+
return new AvailabilityZone($this->apiToFriendly($data, AvailabilityZone::$entityMap));
32+
}, $filters);
33+
}
34+
}

0 commit comments

Comments
 (0)