Skip to main content

FloatingIP

The FloatingIP class provides an interface to interact with OpenStack floating IPs, allowing you to retrieve information about floating IP addresses and their associations.

Constructor

FloatingIP(fip_id=None, name=None, cloud=Cloud())
Initialize a FloatingIP instance.
fip_id
str
The unique identifier of the floating IP. Either fip_id or name should be provided.
name
str
The floating IP address value. Either fip_id or name should be provided.
cloud
Cloud
default:"Cloud()"
The Cloud instance to use for OpenStack operations. Defaults to a new Cloud instance.

Properties

ip

@property
def ip(self) -> str
ip
str
Returns the Floating IP value.

name

@property
def name(self) -> str
name
str
Returns the Floating IP value. Note: name and ip are the same thing for this class.

id

@property
def id(self) -> str
id
str
Returns the FIP ID associated to this Floating IP.

fixed_ip

@property
def fixed_ip(self) -> str
fixed_ip
str
Returns the Fixed IP associated to this Floating IP.

port

@property
def port(self) -> str
port
str
Returns the port associated to this Floating IP.

project

@property
def project(self) -> Project
project
Project
Returns the Project associated to this Floating IP.

Usage Example

from myos.ip import FloatingIP

# Initialize floating IP by IP address
fip = FloatingIP(name="192.168.1.100")

# Initialize by ID
fip = FloatingIP(fip_id="abc123-def456-ghi789")

# Access floating IP properties
print(fip.ip)         # Get the floating IP address
print(fip.id)         # Get the floating IP ID
print(fip.fixed_ip)   # Get the associated fixed IP
print(fip.port)       # Get the associated port ID

# Get the project that owns this floating IP
project = fip.project
print(project.id)

Build docs developers (and LLMs) love