Skip to main content
GET
/
virtual_networks
/
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.PrivateNetworks.ListAssignments(ctx, operations.GetVirtualNetworksAssignmentsRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.VirtualNetworkAssignments != nil {
        for {
            // handle items

            res, err = res.Next()

            if err != nil {
                // handle error
            }

            if res == nil {
                break
            }
        }
    }
}
{
  "data": [
    {
      "id": "vnasg_KN4ydzavOVob3",
      "type": "virtual_network_assignment",
      "attributes": {
        "virtual_network_id": "vlan_0MoLqJvgq57pY",
        "vid": 4,
        "description": "Satterfield-Hirthe",
        "status": "connected",
        "server": {
          "id": "sv_lkg1DeZaOvZE5",
          "hostname": "db",
          "label": "BRC01",
          "locked": false,
          "status": "unknown"
        }
      }
    },
    {
      "id": "vnasg_0L6WO181DPlXy",
      "type": "virtual_network_assignment",
      "attributes": {
        "virtual_network_id": "vlan_Z8rodmpGO1jLB",
        "vid": 6,
        "description": "Lindgren Group",
        "status": "connecting",
        "server": {
          "id": "sv_vYAZqGoEqMQ94",
          "hostname": "api",
          "label": "BRC02",
          "locked": false,
          "status": "unknown"
        }
      }
    }
  ],
  "meta": {}
}

Authorizations

Authorization
string
header
required

Query Parameters

filter[server]
string

The server ID to filter by

filter[vid]
string

The vlan ID to filter by

filter[virtual_network_id]
string

The virtual network ID to filter by

page[size]
integer
default:20

Number of items to return per page

Required range: x >= 1
page[number]
integer
default:1

Page number to return (starts at 1)

Required range: x >= 1

Response

200 - application/vnd.api+json

Success

data
object[]
meta
object