Authorizations
Path Parameters
The Firewall ID
package main
import(
"context"
"os"
latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
"github.com/latitudesh/latitudesh-go-sdk/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := latitudeshgosdk.New(
latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
)
res, err := s.Firewalls.Update(ctx, "fw_6A05EdQ1dvKYQ", operations.UpdateFirewallFirewallsRequestBody{
Data: operations.UpdateFirewallFirewallsData{
Type: operations.UpdateFirewallFirewallsTypeFirewalls,
Attributes: &operations.UpdateFirewallFirewallsAttributes{
Name: latitudeshgosdk.Pointer("new-name"),
Rules: []operations.UpdateFirewallFirewallsRules{
operations.UpdateFirewallFirewallsRules{
From: latitudeshgosdk.Pointer("192.168.1.0/24"),
To: latitudeshgosdk.Pointer("ANY"),
Protocol: operations.UpdateFirewallFirewallsProtocolTCP.ToPointer(),
Port: latitudeshgosdk.Pointer("80"),
},
},
},
},
})
if err != nil {
log.Fatal(err)
}
if res.Firewall != nil {
// handle response
}
}{
"data": {
"id": "fw_6A05EdQ1dvKYQ",
"type": "firewalls",
"attributes": {
"name": "new-name",
"project": {
"id": "proj_Ee8pKq05DWAob",
"name": "Small Wooden Chair",
"slug": "small-wooden-chair"
},
"rules": [
{
"from": "192.168.1.0/24",
"to": "ANY",
"port": "80",
"protocol": "TCP",
"default": false
}
]
}
}
}Update a firewall
package main
import(
"context"
"os"
latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
"github.com/latitudesh/latitudesh-go-sdk/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := latitudeshgosdk.New(
latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
)
res, err := s.Firewalls.Update(ctx, "fw_6A05EdQ1dvKYQ", operations.UpdateFirewallFirewallsRequestBody{
Data: operations.UpdateFirewallFirewallsData{
Type: operations.UpdateFirewallFirewallsTypeFirewalls,
Attributes: &operations.UpdateFirewallFirewallsAttributes{
Name: latitudeshgosdk.Pointer("new-name"),
Rules: []operations.UpdateFirewallFirewallsRules{
operations.UpdateFirewallFirewallsRules{
From: latitudeshgosdk.Pointer("192.168.1.0/24"),
To: latitudeshgosdk.Pointer("ANY"),
Protocol: operations.UpdateFirewallFirewallsProtocolTCP.ToPointer(),
Port: latitudeshgosdk.Pointer("80"),
},
},
},
},
})
if err != nil {
log.Fatal(err)
}
if res.Firewall != nil {
// handle response
}
}{
"data": {
"id": "fw_6A05EdQ1dvKYQ",
"type": "firewalls",
"attributes": {
"name": "new-name",
"project": {
"id": "proj_Ee8pKq05DWAob",
"name": "Small Wooden Chair",
"slug": "small-wooden-chair"
},
"rules": [
{
"from": "192.168.1.0/24",
"to": "ANY",
"port": "80",
"protocol": "TCP",
"default": false
}
]
}
}
}The Firewall ID
Show child attributes
Was this page helpful?