import { Latitudesh } from "latitudesh-typescript-sdk";
const latitudesh = new Latitudesh({
bearer: process.env["LATITUDESH_BEARER"] ?? "",
});
async function run() {
const result = await latitudesh.firewalls.update({
firewallId: "fw_r0MK4O4kDa95w",
requestBody: {
data: {
type: "firewalls",
attributes: {
name: "new-name",
rules: [
{
from: "192.168.42.72",
to: "192.168.43.51",
protocol: "TCP",
port: "80",
},
],
},
},
},
});
console.log(result);
}
run();{
"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
}
]
}
}
}Update a firewall
import { Latitudesh } from "latitudesh-typescript-sdk";
const latitudesh = new Latitudesh({
bearer: process.env["LATITUDESH_BEARER"] ?? "",
});
async function run() {
const result = await latitudesh.firewalls.update({
firewallId: "fw_r0MK4O4kDa95w",
requestBody: {
data: {
type: "firewalls",
attributes: {
name: "new-name",
rules: [
{
from: "192.168.42.72",
to: "192.168.43.51",
protocol: "TCP",
port: "80",
},
],
},
},
},
});
console.log(result);
}
run();{
"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?