# Floating IPs ## Create `gpu_droplets.floating_ips.create(FloatingIPCreateParams**kwargs) -> FloatingIPCreateResponse` **post** `/v2/floating_ips` On creation, a floating IP must be either assigned to a Droplet or reserved to a region. * To create a new floating IP assigned to a Droplet, send a POST request to `/v2/floating_ips` with the `droplet_id` attribute. * To create a new floating IP reserved to a region, send a POST request to `/v2/floating_ips` with the `region` attribute. **Note**: In addition to the standard rate limiting, only 12 floating IPs may be created per 60 seconds. ### Parameters - **droplet\_id:** `int` The ID of the Droplet that the floating IP will be assigned to. ### Returns - `class FloatingIPCreateResponse` - **floating\_ip:** `Optional[FloatingIP]` - **links:** `Optional[Links]` - **actions:** `Optional[List[ActionLink]]` - **id:** `Optional[int]` A unique numeric ID that can be used to identify and reference an action. - **href:** `Optional[str]` A URL that can be used to access the action. - **rel:** `Optional[str]` A string specifying the type of the related action. - **droplets:** `Optional[List[ActionLink]]` - **id:** `Optional[int]` A unique numeric ID that can be used to identify and reference an action. - **href:** `Optional[str]` A URL that can be used to access the action. - **rel:** `Optional[str]` A string specifying the type of the related action. ### Example ```python from gradient import Gradient client = Gradient() floating_ip = client.gpu_droplets.floating_ips.create( droplet_id=2457247, ) print(floating_ip.floating_ip) ``` ## Retrieve `gpu_droplets.floating_ips.retrieve(strfloating_ip) -> FloatingIPRetrieveResponse` **get** `/v2/floating_ips/{floating_ip}` To show information about a floating IP, send a GET request to `/v2/floating_ips/$FLOATING_IP_ADDR`. ### Parameters - **floating\_ip:** `str` ### Returns - `class FloatingIPRetrieveResponse` - **floating\_ip:** `Optional[FloatingIP]` ### Example ```python from gradient import Gradient client = Gradient() floating_ip = client.gpu_droplets.floating_ips.retrieve( "192.168.1.1", ) print(floating_ip.floating_ip) ``` ## List `gpu_droplets.floating_ips.list(FloatingIPListParams**kwargs) -> FloatingIPListResponse` **get** `/v2/floating_ips` To list all of the floating IPs available on your account, send a GET request to `/v2/floating_ips`. ### Parameters - **page:** `int` Which 'page' of paginated results to return. - **per\_page:** `int` Number of items returned per page ### Returns - `class FloatingIPListResponse` - **meta:** `MetaProperties` Information about the response itself. - **floating\_ips:** `Optional[List[FloatingIP]]` - **droplet:** `Optional[Droplet]` The Droplet that the floating IP has been assigned to. When you query a floating IP, if it is assigned to a Droplet, the entire Droplet object will be returned. If it is not assigned, the value will be null.

Requires `droplet:read` scope. - `Droplet` - **DropletNull:** `Optional[object]` If the floating IP is not assigned to a Droplet, the value will be null. - **ip:** `Optional[str]` The public IP address of the floating IP. It also serves as its identifier. - **locked:** `Optional[bool]` A boolean value indicating whether or not the floating IP has pending actions preventing new ones from being submitted. - **project\_id:** `Optional[str]` The UUID of the project to which the reserved IP currently belongs.

Requires `project:read` scope. - **region:** `Optional[Region]` The region that the floating IP is reserved to. When you query a floating IP, the entire region object will be returned. - **links:** `Optional[PageLinks]` ### Example ```python from gradient import Gradient client = Gradient() floating_ips = client.gpu_droplets.floating_ips.list() print(floating_ips.meta) ``` ## Delete `gpu_droplets.floating_ips.delete(strfloating_ip)` **delete** `/v2/floating_ips/{floating_ip}` To delete a floating IP and remove it from your account, send a DELETE request to `/v2/floating_ips/$FLOATING_IP_ADDR`. A successful request will receive a 204 status code with no body in response. This indicates that the request was processed successfully. ### Parameters - **floating\_ip:** `str` ### Example ```python from gradient import Gradient client = Gradient() client.gpu_droplets.floating_ips.delete( "192.168.1.1", ) ``` ## Domain Types ### Floating IP - `class FloatingIP` - **droplet:** `Optional[Droplet]` The Droplet that the floating IP has been assigned to. When you query a floating IP, if it is assigned to a Droplet, the entire Droplet object will be returned. If it is not assigned, the value will be null.

Requires `droplet:read` scope. - `Droplet` - **DropletNull:** `Optional[object]` If the floating IP is not assigned to a Droplet, the value will be null. - **ip:** `Optional[str]` The public IP address of the floating IP. It also serves as its identifier. - **locked:** `Optional[bool]` A boolean value indicating whether or not the floating IP has pending actions preventing new ones from being submitted. - **project\_id:** `Optional[str]` The UUID of the project to which the reserved IP currently belongs.

Requires `project:read` scope. - **region:** `Optional[Region]` The region that the floating IP is reserved to. When you query a floating IP, the entire region object will be returned.