import latitudesh_python_sdk
from latitudesh_python_sdk import Latitudesh
import os
with Latitudesh(
bearer=os.getenv("LATITUDESH_BEARER", ""),
) as latitudesh:
res = latitudesh.elastic_ips.create_elastic_ip(data={
"type": latitudesh_python_sdk.CreateElasticIPType.ELASTIC_IPS,
"attributes": {
"project_id": "proj_AoW6vRnwkvLn0",
"server_id": "sv_2GmAlJ6BXlK1a",
},
})
# Handle response
print(res){
"data": {
"id": null,
"type": "elastic_ips",
"attributes": {
"address": "177.54.156.7",
"status": "configuring",
"project": {
"id": "proj_AoW6vRnwkvLn0",
"name": "My Project",
"slug": "my-project"
}
}
}
}Creates a new Elastic IP and assigns it to the specified server. The IP is provisioned asynchronously—the response will show status configuring and the id will be null until provisioning completes.
Note: This feature requires the elastic_ips feature flag to be enabled for your team. Currently only IPv4 /32 addresses in routed mode are supported.
import latitudesh_python_sdk
from latitudesh_python_sdk import Latitudesh
import os
with Latitudesh(
bearer=os.getenv("LATITUDESH_BEARER", ""),
) as latitudesh:
res = latitudesh.elastic_ips.create_elastic_ip(data={
"type": latitudesh_python_sdk.CreateElasticIPType.ELASTIC_IPS,
"attributes": {
"project_id": "proj_AoW6vRnwkvLn0",
"server_id": "sv_2GmAlJ6BXlK1a",
},
})
# Handle response
print(res){
"data": {
"id": null,
"type": "elastic_ips",
"attributes": {
"address": "177.54.156.7",
"status": "configuring",
"project": {
"id": "proj_AoW6vRnwkvLn0",
"name": "My Project",
"slug": "my-project"
}
}
}
}Was this page helpful?