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.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"
}
}
}Assign a server to 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.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"
}
}
}The Firewall ID
Show child attributes
Was this page helpful?