Skip to content

Commit 3999c1d

Browse files
authored
Merge pull request #44 from ukfast/master
Merge in UKFast Master
2 parents 2835fb4 + bb9de25 commit 3999c1d

File tree

5 files changed

+75
-0
lines changed

5 files changed

+75
-0
lines changed

src/eCloud/Client.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,14 @@ public function loadBalancerSpecs()
313313
return (new LoadBalancerSpecClient($this->httpClient))->auth($this->token);
314314
}
315315

316+
/**
317+
* @return BaseClient
318+
*/
319+
public function loadBalancerNetworks()
320+
{
321+
return (new LoadBalancerNetworkClient($this->httpClient))->auth($this->token);
322+
}
323+
316324
/**
317325
* @return BaseClient
318326
*/

src/eCloud/Entities/LoadBalancer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* @property string $vpcId
1111
* @property string $availabilityZoneId
1212
* @property string $specId
13+
* @property int $configId
1314
* @property string $sync
1415
* @property string $createdAt
1516
* @property string $updatedAt
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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 $loadBalancerId
11+
* @property string $networkId
12+
* @property string $sync
13+
* @property string $createdAt
14+
* @property string $updatedAt
15+
*/
16+
class LoadBalancerNetwork extends Entity
17+
{
18+
protected $dates = ['createdAt', 'updatedAt'];
19+
}

src/eCloud/LoadBalancerClient.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public function getEntityMap()
2020
'vpc_id' => 'vpcId',
2121
'availability_zone_id' => 'availabilityZoneId',
2222
'load_balancer_spec_id' => 'specId',
23+
'config_id' => 'configId',
2324
'sync' => 'sync',
2425
'created_at' => 'createdAt',
2526
'updated_at' => 'updatedAt',
@@ -32,4 +33,9 @@ public function loadEntity($data)
3233
$this->apiToFriendly($data, $this->getEntityMap())
3334
);
3435
}
36+
37+
public function getNetworks($id)
38+
{
39+
return $this->loadBalancerNetworks()->getAllByLoadBalancerId($id);
40+
}
3541
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace UKFast\SDK\eCloud;
4+
5+
use UKFast\SDK\Entities\ClientEntityInterface;
6+
use UKFast\SDK\Traits\PageItems;
7+
use UKFast\SDK\eCloud\Entities\LoadBalancerNetwork;
8+
9+
class LoadBalancerNetworkClient extends Client implements ClientEntityInterface
10+
{
11+
use PageItems;
12+
13+
protected $collectionPath = 'v2/load-balancer-networks';
14+
15+
public function getEntityMap()
16+
{
17+
return [
18+
'id' => 'id',
19+
'name' => 'name',
20+
'load_balancer_id' => 'loadBalancerId',
21+
'network_id' => 'networkId',
22+
'sync' => 'sync',
23+
'created_at' => 'createdAt',
24+
'updated_at' => 'updatedAt',
25+
];
26+
}
27+
28+
public function loadEntity($data)
29+
{
30+
return new LoadBalancerNetwork(
31+
$this->apiToFriendly($data, $this->getEntityMap())
32+
);
33+
}
34+
35+
public function getAllByLoadBalancerId($id)
36+
{
37+
return $this->getAll([
38+
'load_balancer_id' => $id
39+
]);
40+
}
41+
}

0 commit comments

Comments
 (0)