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.PrivateNetworks.Create(ctx, operations.CreateVirtualNetworkPrivateNetworksRequestBody{
Data: operations.CreateVirtualNetworkPrivateNetworksData{
Type: operations.CreateVirtualNetworkPrivateNetworksTypeVirtualNetwork,
Attributes: operations.CreateVirtualNetworkPrivateNetworksAttributes{
Description: "São Paulo VLAN",
Site: operations.CreateVirtualNetworkPrivateNetworksSiteMia.ToPointer(),
Project: "incredible-granite-coat",
},
},
})
if err != nil {
log.Fatal(err)
}
if res.VirtualNetwork != nil {
// handle response
}
}{
"data": {
"id": "vlan_3YjJOLQjdvZ87",
"type": "virtual_networks",
"attributes": {
"tags": [],
"vid": 2000,
"name": "MIA-2000",
"description": "São Paulo VLAN",
"site": "MIA",
"created_at": "2025-07-16T18:37:16+00:00"
}
},
"meta": {}
}Creates a new Virtual Network.
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.PrivateNetworks.Create(ctx, operations.CreateVirtualNetworkPrivateNetworksRequestBody{
Data: operations.CreateVirtualNetworkPrivateNetworksData{
Type: operations.CreateVirtualNetworkPrivateNetworksTypeVirtualNetwork,
Attributes: operations.CreateVirtualNetworkPrivateNetworksAttributes{
Description: "São Paulo VLAN",
Site: operations.CreateVirtualNetworkPrivateNetworksSiteMia.ToPointer(),
Project: "incredible-granite-coat",
},
},
})
if err != nil {
log.Fatal(err)
}
if res.VirtualNetwork != nil {
// handle response
}
}{
"data": {
"id": "vlan_3YjJOLQjdvZ87",
"type": "virtual_networks",
"attributes": {
"tags": [],
"vid": 2000,
"name": "MIA-2000",
"description": "São Paulo VLAN",
"site": "MIA",
"created_at": "2025-07-16T18:37:16+00:00"
}
},
"meta": {}
}Show child attributes
Was this page helpful?