Skip to content

Commit

Permalink
Add port_id param
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Powers committed Jan 7, 2025
1 parent 55049b2 commit f867699
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions chi/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,17 +426,19 @@ def _format_addresses(self, addresses):
)
return formatted

def associate_floating_ip(self, fip: Optional[str] = None) -> None:
def associate_floating_ip(self, fip: Optional[str] = None, port_id: Optional[str] = None) -> None:
"""
Associates a floating IP with the server.
Args:
fip (str, optional): The floating IP to associate with the server. If not provided, a new floating IP will be allocated.
port_id (str): Optional port ID to assign the floating IP to. If not
provided, the will use the first routable port on the server.
Returns:
None
"""
associate_floating_ip(self.id, fip)
associate_floating_ip(self.id, fip, port_id)
self.refresh()

def detach_floating_ip(self, fip: str) -> None:
Expand Down

0 comments on commit f867699

Please sign in to comment.