Skip to content

Commit 7f0960d

Browse files
author
Paul McNally
committed
get the internal ip and floating ip for a vip
1 parent 30de55e commit 7f0960d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/eCloud/VipClient.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,28 @@ public function getEntityMap()
2626
];
2727
}
2828

29+
public function getInternalIp(Vip $vip)
30+
{
31+
if (empty($vip->ipAddressId)) {
32+
return null;
33+
}
34+
35+
return $this->ipAddresses()->getById($vip->ipAddressId)->ipAddress;
36+
}
37+
38+
public function getFloatingIp(Vip $vip)
39+
{
40+
if (!empty($vip->ipAddressId)) {
41+
$floatingIp = $this->floatingIps()->getAll(['resource_id' => $vip->ipAddressId]);
42+
43+
if (count($floatingIp) > 0) {
44+
return $floatingIp[0];
45+
}
46+
}
47+
48+
return null;
49+
}
50+
2951
public function loadEntity($data)
3052
{
3153
return new Vip(

0 commit comments

Comments
 (0)