Skip to content
Docs

    List VPCs

    client.Networking.VPCs.List(ctx, query) (*Cursor[VPC], error)
    GET/v1/networking/vpcs

    List all VPCs

    ParametersExpand Collapse
    query VPCListParams
    ProjectID param.Field[string]

    Project ID of resources to request

    Cursor param.Field[string]Optional

    Pagination cursor returned by a previous request. Only valid for the same filters and sort order.

    Limit param.Field[int64]Optional

    Maximum number of items to return

    maximum100
    minimum10
    Name param.Field[string]Optional

    Filter by a case-insensitive substring of the VPC name

    Region param.Field[string]Optional

    Filter by region

    Sort param.Field[string]Optional

    Comma-separated sort terms in precedence order, each field:asc or field:desc. Fields: created_at, updated_at, name, status

    Status param.Field[VPCListParamsStatus]Optional

    Filter by VPC status

    const VPCListParamsStatusPending VPCListParamsStatus = "pending"
    const VPCListParamsStatusCreating VPCListParamsStatus = "creating"
    const VPCListParamsStatusUpdating VPCListParamsStatus = "updating"
    const VPCListParamsStatusReady VPCListParamsStatus = "ready"
    const VPCListParamsStatusDeleting VPCListParamsStatus = "deleting"
    const VPCListParamsStatusError VPCListParamsStatus = "error"
    Tags param.Field[[]string]Optional

    Filter by tags. Repeat the parameter to require several tags; a VPC must carry all of them.

    ReturnsExpand Collapse
    type VPC struct{…}

    VPC details.

    ID string

    Unique identifier for the VPC.

    CreatedAt Time

    When the VPC was created.

    formatdate-time
    FirewallRuleIDs []string

    IDs of the Firewall Rules associated with the VPC.

    Name string

    Name of the VPC.

    ProjectID string

    Project ID the VPC belongs to.

    Region RegionName

    Region the resource is in.

    Status of the resource.

    One of the following:
    const ResourceStatusPending ResourceStatus = "pending"
    const ResourceStatusCreating ResourceStatus = "creating"
    const ResourceStatusUpdating ResourceStatus = "updating"
    const ResourceStatusReady ResourceStatus = "ready"
    const ResourceStatusDeleting ResourceStatus = "deleting"
    const ResourceStatusDeleted ResourceStatus = "deleted"
    const ResourceStatusError ResourceStatus = "error"
    Subnet Subnet

    Subnet of the VPC.

    ID string

    Unique identifier for the Subnet.

    CIDR string

    CIDR block for the Subnet.

    CreatedAt Time

    When the Subnet was created.

    formatdate-time
    Name string

    Name of the Subnet.

    UpdatedAt Time

    When the Subnet was updated.

    formatdate-time
    Tags []string

    Tags to attach to the VPC.

    UpdatedAt Time

    When the VPC was updated.

    formatdate-time

    List VPCs

    package main
    
    import (
      "context"
      "fmt"
    
      "github.com/nirvana-labs/nirvana-go"
      "github.com/nirvana-labs/nirvana-go/networking"
      "github.com/nirvana-labs/nirvana-go/option"
    )
    
    func main() {
      client := nirvana.NewClient(
        option.WithAPIKey("My API Key"),
      )
      page, err := client.Networking.VPCs.List(context.TODO(), networking.VPCListParams{
        ProjectID: "project_id",
      })
      if err != nil {
        panic(err.Error())
      }
      fmt.Printf("%+v\n", page)
    }
    
    {
      "items": [
        {
          "id": "123e4567-e89b-12d3-a456-426614174000",
          "created_at": "2025-01-01T00:00:00Z",
          "firewall_rule_ids": [
            "123e4567-e89b-12d3-a456-426614174001",
            "123e4567-e89b-12d3-a456-426614174002"
          ],
          "name": "my-vpc",
          "project_id": "123e4567-e89b-12d3-a456-426614174000",
          "region": "us-sva-2",
          "status": "ready",
          "subnet": {
            "id": "123e4567-e89b-12d3-a456-426614174000",
            "cidr": "10.128.35.128/25",
            "created_at": "2025-01-01T00:00:00Z",
            "name": "my-subnet",
            "updated_at": "2025-01-01T00:00:00Z"
          },
          "tags": [
            "production",
            "ethereum"
          ],
          "updated_at": "2025-01-01T00:00:00Z"
        }
      ],
      "pagination": {
        "next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
        "previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
        "total_count": 125
      }
    }
    Returns Examples
    {
      "items": [
        {
          "id": "123e4567-e89b-12d3-a456-426614174000",
          "created_at": "2025-01-01T00:00:00Z",
          "firewall_rule_ids": [
            "123e4567-e89b-12d3-a456-426614174001",
            "123e4567-e89b-12d3-a456-426614174002"
          ],
          "name": "my-vpc",
          "project_id": "123e4567-e89b-12d3-a456-426614174000",
          "region": "us-sva-2",
          "status": "ready",
          "subnet": {
            "id": "123e4567-e89b-12d3-a456-426614174000",
            "cidr": "10.128.35.128/25",
            "created_at": "2025-01-01T00:00:00Z",
            "name": "my-subnet",
            "updated_at": "2025-01-01T00:00:00Z"
          },
          "tags": [
            "production",
            "ethereum"
          ],
          "updated_at": "2025-01-01T00:00:00Z"
        }
      ],
      "pagination": {
        "next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
        "previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
        "total_count": 125
      }
    }