Skip to content

Commit

Permalink
Merge pull request #530 from DawidVH/33865-ecloud-vpn-gateway-specifi…
Browse files Browse the repository at this point in the history
…cations

VPN Gateway Specifications
  • Loading branch information
DawidVH authored Aug 12, 2024
2 parents 86e37d2 + 4479a38 commit 8ecced7
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/eCloud/AvailabilityZoneClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use UKFast\SDK\eCloud\Entities\Product;
use UKFast\SDK\eCloud\Entities\ResourceTier;
use UKFast\SDK\eCloud\Entities\VPC\Iops;
use UKFast\SDK\eCloud\Entities\VpnGatewaySpecification;
use UKFast\SDK\Entities\ClientEntityInterface;
use UKFast\SDK\Traits\PageItems;
use UKFast\SDK\eCloud\Entities\AvailabilityZone;
Expand Down Expand Up @@ -47,4 +48,11 @@ public function getIops($id, $filters = [])
return new Iops($this->apiToFriendly($data, Iops::$entityMap));
}, $filters);
}

public function getVpnGatewaySpecifications($id, $filters = [])
{
return $this->getChildResources($id, 'vpn-gateway-specifications', function ($data) {
return new VpnGatewaySpecification($this->apiToFriendly($data, VpnGatewaySpecification::$entityMap));
}, $filters);
}
}
8 changes: 8 additions & 0 deletions src/eCloud/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,4 +383,12 @@ public function software()
{
return (new SoftwareClient($this->httpClient))->auth($this->token);
}

/**
* @return BaseClient
*/
public function vpnGatewaySpecifications()
{
return (new VpnGatewaySpecificationClient($this->httpClient))->auth($this->token);
}
}
28 changes: 28 additions & 0 deletions src/eCloud/Entities/VpnGatewaySpecification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace UKFast\SDK\eCloud\Entities;

use DateTime;
use UKFast\SDK\Entity;

/**
* @property string $id
* @property string $name
* @property string $description
* @property integer $maxUsers
* @property DateTime $createdAt
* @property DateTime $updatedAt
*/
class VpnGatewaySpecification extends Entity
{
protected $dates = ['createdAt', 'updatedAt'];

public static $entityMap = [
'id' => 'id',
'name' => 'name',
'description' => 'description',
'max_users' => 'maxUsers',
'created_at' => 'createdAt',
'updated_at' => 'updatedAt',
];
}
34 changes: 34 additions & 0 deletions src/eCloud/VpnGatewaySpecificationClient.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace UKFast\SDK\eCloud;

use UKFast\SDK\eCloud\Entities\AvailabilityZone;
use UKFast\SDK\eCloud\Entities\VpnGatewaySpecification;
use UKFast\SDK\Entities\ClientEntityInterface;
use UKFast\SDK\Traits\PageItems;

class VpnGatewaySpecificationClient extends Client implements ClientEntityInterface
{
use PageItems;

protected $collectionPath = 'v2/vpn-gateway-specifications';

public function getEntityMap()
{
return VpnGatewaySpecification::$entityMap;
}

public function loadEntity($data)
{
return new VpnGatewaySpecification(
$this->apiToFriendly($data, VpnGatewaySpecification::$entityMap)
);
}

public function getAvailabilityZones($id, $filters = [])
{
return $this->getChildResources($id, 'availability-zones', function ($data) {
return new AvailabilityZone($this->apiToFriendly($data, AvailabilityZone::$entityMap));
}, $filters);
}
}

0 comments on commit 8ecced7

Please sign in to comment.