Skip to content

Commit 1da9948

Browse files
Merge pull request #531 from ans-group/vpn-gateway-1208
Vpn gateway update for ecloud
2 parents 8ecced7 + 0eaf31b commit 1da9948

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

src/eCloud/Client.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,4 +391,12 @@ public function vpnGatewaySpecifications()
391391
{
392392
return (new VpnGatewaySpecificationClient($this->httpClient))->auth($this->token);
393393
}
394+
395+
/**
396+
* @return BaseClient
397+
*/
398+
public function vpnGateways()
399+
{
400+
return (new VpnGatewayClient($this->httpClient))->auth($this->token);
401+
}
394402
}

src/eCloud/Entities/VpnGateway.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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 $availabilityZoneId
12+
* @property string $routerId
13+
* @property string $specificationId
14+
* @property DateTime $createdAt
15+
* @property DateTime $updatedAt
16+
*/
17+
class VpnGateway extends Entity
18+
{
19+
protected $dates = ['createdAt', 'updatedAt'];
20+
21+
public static $entityMap = [
22+
'id' => 'id',
23+
'name' => 'name',
24+
'availability_zone_id' => 'availabilityZoneId',
25+
'router_id' => 'routerId',
26+
'specification_id' => 'specificationId',
27+
'created_at' => 'createdAt',
28+
'updated_at' => 'updatedAt',
29+
];
30+
}

src/eCloud/VpnGatewayClient.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace UKFast\SDK\eCloud;
4+
5+
use UKFast\SDK\eCloud\Entities\VpnGateway;
6+
use UKFast\SDK\Entities\ClientEntityInterface;
7+
use UKFast\SDK\Traits\PageItems;
8+
9+
class VpnGatewayClient extends Client implements ClientEntityInterface
10+
{
11+
use PageItems;
12+
13+
protected $collectionPath = 'v2/vpn-gateways';
14+
15+
public function getEntityMap()
16+
{
17+
return VpnGateway::$entityMap;
18+
}
19+
20+
public function loadEntity($data)
21+
{
22+
return new VpnGateway(
23+
$this->apiToFriendly($data, VpnGateway::$entityMap)
24+
);
25+
}
26+
}

0 commit comments

Comments
 (0)