Skip to content

Commit a725d08

Browse files
authored
Adds IpAddressClient to sdk (#466)
1 parent 9c657b6 commit a725d08

File tree

3 files changed

+60
-1
lines changed

3 files changed

+60
-1
lines changed

src/eCloud/Client.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ public function iops()
8484
return (new IopsClient($this->httpClient))->auth($this->token);
8585
}
8686

87+
/**
88+
* @return BaseClient
89+
*/
90+
public function ipAddresses()
91+
{
92+
return (new IpAddressesClient($this->httpClient))->auth($this->token);
93+
}
94+
8795
/**
8896
* @return BaseClient
8997
*/
@@ -92,7 +100,6 @@ public function appliances()
92100
return (new ApplianceClient($this->httpClient))->auth($this->token);
93101
}
94102

95-
96103
/**
97104
* eCloud v2
98105
*/

src/eCloud/Entities/IpAddress.php

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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 $ipAddress
11+
* @property string $networkId
12+
* @property string $createdAt
13+
* @property string $updatedAt
14+
*/
15+
class IpAddress extends Entity
16+
{
17+
protected $dates = ['createdAt', 'updatedAt'];
18+
}

src/eCloud/IpAddressesClient.php

+34
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\Entities\ClientEntityInterface;
6+
7+
use UKFast\SDK\eCloud\Entities\IpAddress;
8+
use UKFast\SDK\Traits\PageItems;
9+
10+
class IpAddressesClient extends Client implements ClientEntityInterface
11+
{
12+
use PageItems;
13+
14+
private $collectionPath = "v2/ip-addresses";
15+
16+
public function getEntityMap()
17+
{
18+
return [
19+
'id' => 'id',
20+
'name' => 'name',
21+
'ip_address' => 'ipAddress',
22+
'network_id' => 'networkId',
23+
'created_at' => 'createdAt',
24+
'updated_at' => 'updatedAt',
25+
];
26+
}
27+
28+
public function loadEntity($data)
29+
{
30+
return new IpAddress(
31+
$this->apiToFriendly($data, $this->getEntityMap())
32+
);
33+
}
34+
}

0 commit comments

Comments
 (0)