Skip to main content
PATCH
/
firewalls
/
{firewall_id}
Go (SDK)
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
        }
      ]
    }
  }
}

Authorizations

Authorization
string
header
required

Path Parameters

firewall_id
string
required

The Firewall ID

Body

data
object
required

Response

200 - application/vnd.api+json

Success

data
object
meta
object