diff --git a/CHANGELOG.md b/CHANGELOG.md index 6db2be3f..6328e759 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ CHANGE LOG * UPCOMING +## 4.1.1 (UPCOMING) + +* Fixed incorrect floating IP IDs + + ## 4.1.0 (25/01/2021) * Added app platform API support diff --git a/src/Api/FloatingIp.php b/src/Api/FloatingIp.php index 7b7a8bd3..2495ab84 100644 --- a/src/Api/FloatingIp.php +++ b/src/Api/FloatingIp.php @@ -38,15 +38,15 @@ public function getAll() } /** - * @param int $id + * @param string $ipAddress * * @throws ExceptionInterface * * @return FloatingIpEntity */ - public function getById(int $id) + public function getById(string $ipAddress) { - $ip = $this->get(\sprintf('floating_ips/%s', $id)); + $ip = $this->get(\sprintf('floating_ips/%s', $ipAddress)); return new FloatingIpEntity($ip->floating_ip); } @@ -80,27 +80,27 @@ public function createReserved(string $regionSlug) } /** - * @param int $id + * @param string $ipAddress * * @throws ExceptionInterface * * @return void */ - public function remove(int $id): void + public function remove(string $ipAddress): void { - $this->delete(\sprintf('floating_ips/%s', $id)); + $this->delete(\sprintf('floating_ips/%s', $ipAddress)); } /** - * @param int $id + * @param string $ipAddress * * @throws ExceptionInterface * * @return ActionEntity[] */ - public function getActions(int $id) + public function getActions(string $ipAddress) { - $actions = $this->get(\sprintf('floating_ips/%s/actions', $id)); + $actions = $this->get(\sprintf('floating_ips/%s/actions', $ipAddress)); return \array_map(function ($action) { return new ActionEntity($action); @@ -108,56 +108,56 @@ public function getActions(int $id) } /** - * @param int $id - * @param int $actionId + * @param string $ipAddress + * @param int $actionId * * @throws ExceptionInterface * * @return ActionEntity */ - public function getActionById(int $id, int $actionId) + public function getActionById(string $ipAddress, int $actionId) { - $action = $this->get(\sprintf('floating_ips/%s/actions/%d', $id, $actionId)); + $action = $this->get(\sprintf('floating_ips/%s/actions/%d', $ipAddress, $actionId)); return new ActionEntity($action->action); } /** - * @param int $id - * @param int $dropletId + * @param string $ipAddress + * @param int $dropletId * * @throws ExceptionInterface * * @return ActionEntity */ - public function assign(int $id, int $dropletId) + public function assign(string $ipAddress, int $dropletId) { - return $this->executeAction($id, ['type' => 'assign', 'droplet_id' => $dropletId]); + return $this->executeAction($ipAddress, ['type' => 'assign', 'droplet_id' => $dropletId]); } /** - * @param int $id + * @param string $ipAddress * * @throws ExceptionInterface * * @return ActionEntity */ - public function unassign(int $id) + public function unassign(string $ipAddress) { - return $this->executeAction($id, ['type' => 'unassign']); + return $this->executeAction($ipAddress, ['type' => 'unassign']); } /** - * @param int $id - * @param array $options + * @param string $ipAddress + * @param array $options * * @throws ExceptionInterface * * @return ActionEntity */ - private function executeAction(int $id, array $options) + private function executeAction(string $ipAddress, array $options) { - $action = $this->post(\sprintf('floating_ips/%s/actions', $id), $options); + $action = $this->post(\sprintf('floating_ips/%s/actions', $ipAddress), $options); return new ActionEntity($action->action); } diff --git a/vendor-bin/phpstan/composer.json b/vendor-bin/phpstan/composer.json index f57323a7..5ed3ed35 100644 --- a/vendor-bin/phpstan/composer.json +++ b/vendor-bin/phpstan/composer.json @@ -1,7 +1,7 @@ { "require": { "php": "^7.2.5 || ^8.0", - "phpstan/phpstan": "0.12.69", + "phpstan/phpstan": "0.12.71", "phpstan/phpstan-deprecation-rules": "0.12.6", "phpstan/phpstan-strict-rules": "0.12.9", "thecodingmachine/phpstan-strict-rules": "0.12.1",