Skip to content

Commit 3d76bf8

Browse files
authored
Merge pull request #464 from ptmcnally/250-vips-crud
250 vips crud
2 parents bb9de25 + f95384e commit 3d76bf8

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

src/eCloud/Client.php

+8
Original file line numberDiff line numberDiff line change
@@ -344,4 +344,12 @@ public function tasks()
344344
{
345345
return (new TaskClient($this->httpClient))->auth($this->token);
346346
}
347+
348+
/**
349+
* @return BaseClient
350+
*/
351+
public function vips()
352+
{
353+
return (new VipClient($this->httpClient))->auth($this->token);
354+
}
347355
}

src/eCloud/Entities/Vip.php

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace UKFast\SDK\eCloud\Entities;
4+
5+
use UKFast\SDK\Entity;
6+
7+
/**
8+
* @property string $id
9+
* @property string $name
10+
* @property string $loadBalancerNetworkId
11+
* @property string $ipAddressId
12+
* @property integer $configId
13+
* @property string $sync
14+
* @property string $createdAt
15+
* @property string $updatedAt
16+
*/
17+
class Vip extends Entity
18+
{
19+
protected $dates = ['createdAt', 'updatedAt'];
20+
}

src/eCloud/VipClient.php

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace UKFast\SDK\eCloud;
4+
5+
use UKFast\SDK\eCloud\Entities\Vip;
6+
use UKFast\SDK\Entities\ClientEntityInterface;
7+
use UKFast\SDK\Traits\PageItems;
8+
9+
class VipClient extends Client implements ClientEntityInterface
10+
{
11+
use PageItems;
12+
13+
protected $collectionPath = 'v2/vips';
14+
15+
public function getEntityMap()
16+
{
17+
return [
18+
'id' => 'id',
19+
'name' => 'name',
20+
'load_balancer_network_id' => 'loadBalancerNetworkId',
21+
'ip_address_id' => 'ipAddressId',
22+
'config_id' => 'configId',
23+
'sync' => 'sync',
24+
'created_at' => 'createdAt',
25+
'updated_at' => 'updatedAt',
26+
];
27+
}
28+
29+
public function loadEntity($data)
30+
{
31+
return new Vip(
32+
$this->apiToFriendly($data, $this->getEntityMap())
33+
);
34+
}
35+
}

0 commit comments

Comments
 (0)