Skip to main content
GET
/
virtual_networks
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.List(ctx, operations.GetVirtualNetworksRequest{
        FilterTags: latitudeshgosdk.Pointer("tag_P284pBvBEoT492NeXgv7TPaR3k8,tag_nPpEv2AnR9u9RBrGLLJ3C89nZJN"),
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.VirtualNetworks != nil {
        for {
            // handle items

            res, err = res.Next()

            if err != nil {
                // handle error
            }

            if res == nil {
                break
            }
        }
    }
}
{
  "data": [
    {
      "id": "vlan_AW6Q2D9lqKLpr",
      "type": "virtual_networks",
      "attributes": {
        "tags": [
          {
            "id": "tag_Q2Ppk7YymBIWNy74NpgpTQZMRwl",
            "name": "tag1",
            "description": "Cupiditate doloremque reiciendis ut.",
            "color": "#030307"
          }
        ],
        "vid": 2040,
        "description": "Odit quod ratione exercitationem.",
        "created_at": null,
        "region": {
          "city": "Santiago 3",
          "country": "Chile",
          "site": {
            "id": "loc_aNmodj6ZdbE8W",
            "name": "Santiago 3",
            "slug": "SAN3",
            "facility": "Santiago 3"
          }
        },
        "project": {
          "id": "proj_RMLydp5WqQKr1",
          "name": "Lightweight Rubber Knife",
          "slug": "lightweight-rubber-knife",
          "description": "Fantastic Copper Watch",
          "billing_type": "Normal",
          "billing_method": "Normal",
          "bandwidth_alert": false,
          "environment": null,
          "billing": {
            "subscription_id": null,
            "type": "Normal",
            "method": "Normal"
          },
          "stats": {
            "databases": 0,
            "ip_addresses": 2,
            "prefixes": 0,
            "servers": 1,
            "storages": 0,
            "virtual_machines": 0,
            "vlans": 2
          }
        },
        "assignments_count": 1
      }
    }
  ],
  "meta": {}
}

Authorizations

Authorization
string
header
required

Query Parameters

filter[location]
string

The location slug to filter by

filter[project]
string

The project id or slug to filter by

filter[tags]
string

The tags ids to filter by, separated by comma, e.g. filter[tags]=tag_1,tag_2will return ssh keys with tag_1 AND tag_2

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