Skip to content

Commit 06c02f8

Browse files
rawvegTim Green
andauthored
5146 assign ip address to nic (#478)
* Removed duplicate method * Added assignToIpAddress method to allow assignment of Nic to Ip Address. * Fixed comment and missing brace Co-authored-by: Tim Green <tim.green@ukfast.co.uk>
1 parent 9e4cf83 commit 06c02f8

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/eCloud/NicClient.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,22 @@ public function loadEntity($data)
3333
$this->apiToFriendly($data, $this->getEntityMap())
3434
);
3535
}
36-
36+
37+
/**
38+
* Assigns an IP address with a NIC
39+
* @param $id
40+
* @param $ipAddressId
41+
* @return bool
42+
*/
43+
public function assignIpAddress($id, $ipAddressId)
44+
{
45+
$response = $this->post(
46+
$this->collectionPath . '/' . $id . '/ip-addresses',
47+
json_encode([ 'ip_address_id' => $ipAddressId ])
48+
);
49+
return $response->getStatusCode() == 202;
50+
}
51+
3752
/**
3853
* Get the IP address records associated with a NIC
3954
* @param $id

0 commit comments

Comments
 (0)