Skip to main content
POST
/
firewalls
/
{firewall_id}
/
assignments
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.Assignments.Create(ctx, "fw_Av9BVDavORm1W", operations.CreateFirewallAssignmentFirewallsAssignmentsRequestBody{
        Data: operations.CreateFirewallAssignmentFirewallsAssignmentsData{
            Type: operations.CreateFirewallAssignmentFirewallsAssignmentsTypeFirewallAssignments,
            Attributes: &operations.CreateFirewallAssignmentFirewallsAssignmentsAttributes{
                ServerID: "sv_lpbV0DgRq4AWz",
            },
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.FirewallServer != nil {
        // handle response
    }
}
{
  "data": {
    "id": "fwasg_0g1mbDwBqLv5B",
    "type": "firewall_assignments",
    "attributes": {
      "server": {
        "id": "sv_lpbV0DgRq4AWz",
        "hostname": "Incredible Paper Chair",
        "primary_ipv4": "248.110.161.199"
      },
      "firewall_id": "fw_Av9BVDavORm1W"
    }
  }
}

Authorizations

Authorization
string
header
required

Path Parameters

firewall_id
string
required

The Firewall ID

Body

data
object
required

Response

201 - application/vnd.api+json

Created

id
string
type
enum<string>
Available options:
firewall_servers
attributes
object