import latitudesh_python_sdk
from latitudesh_python_sdk import Latitudesh
import os
with Latitudesh(
bearer=os.getenv("LATITUDESH_BEARER", ""),
) as latitudesh:
res = latitudesh.firewalls.update(firewall_id="fw_r0MK4O4kDa95w", data={
"type": latitudesh_python_sdk.UpdateFirewallFirewallsType.FIREWALLS,
"attributes": {
"name": "new-name",
"rules": [
{
"from_": "192.168.42.72",
"to": "192.168.43.51",
"protocol": latitudesh_python_sdk.UpdateFirewallFirewallsProtocol.TCP,
"port": "80",
},
],
},
})
# Handle response
print(res){
"data": {
"id": "fw_r0MK4O4kDa95w",
"type": "firewalls",
"attributes": {
"name": "new-name",
"project": {
"id": "proj_aKXgRdR3qv9k5",
"name": "Rustic Wooden Clock",
"slug": "rustic-wooden-clock"
},
"rules": [
{
"from": "192.168.42.72",
"to": "192.168.43.51",
"port": "80",
"protocol": "TCP",
"default": false
}
]
}
}
}Updates a firewall by its ID.
import latitudesh_python_sdk
from latitudesh_python_sdk import Latitudesh
import os
with Latitudesh(
bearer=os.getenv("LATITUDESH_BEARER", ""),
) as latitudesh:
res = latitudesh.firewalls.update(firewall_id="fw_r0MK4O4kDa95w", data={
"type": latitudesh_python_sdk.UpdateFirewallFirewallsType.FIREWALLS,
"attributes": {
"name": "new-name",
"rules": [
{
"from_": "192.168.42.72",
"to": "192.168.43.51",
"protocol": latitudesh_python_sdk.UpdateFirewallFirewallsProtocol.TCP,
"port": "80",
},
],
},
})
# Handle response
print(res){
"data": {
"id": "fw_r0MK4O4kDa95w",
"type": "firewalls",
"attributes": {
"name": "new-name",
"project": {
"id": "proj_aKXgRdR3qv9k5",
"name": "Rustic Wooden Clock",
"slug": "rustic-wooden-clock"
},
"rules": [
{
"from": "192.168.42.72",
"to": "192.168.43.51",
"port": "80",
"protocol": "TCP",
"default": false
}
]
}
}
}Was this page helpful?