Skip to content
Docs

    List NKS Load Balancers

    client.NKS.Clusters.LoadBalancers.List(ctx, clusterID, query) (*Cursor[NKSLoadBalancer], error)
    GET/v1/nks/clusters/{cluster_id}/load_balancers

    List all load balancers in an NKS cluster

    ParametersExpand Collapse
    clusterID string
    query ClusterLoadBalancerListParams
    Cursor param.Field[string]Optional

    Pagination cursor returned by a previous request

    Limit param.Field[int64]Optional

    Maximum number of items to return

    maximum100
    minimum10
    ReturnsExpand Collapse
    type NKSLoadBalancer struct{…}

    NKS load balancer details.

    ID string

    Unique identifier for the load balancer.

    ClusterID string

    Cluster this load balancer belongs to.

    CreatedAt Time

    When the load balancer was first discovered.

    formatdate-time
    Namespace string

    Kubernetes namespace of the load balancer.

    PrivateIP string

    Private IP address of the load balancer.

    PublicIP string

    Public IP address assigned to this load balancer.

    PublicIPEnabled bool

    Whether a public IP is enabled for this load balancer.

    ServiceName string

    Kubernetes service name of the load balancer.

    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"
    UpdatedAt Time

    When the load balancer was last updated.

    formatdate-time

    List NKS Load Balancers

    package main
    
    import (
      "context"
      "fmt"
    
      "github.com/nirvana-labs/nirvana-go"
      "github.com/nirvana-labs/nirvana-go/nks"
      "github.com/nirvana-labs/nirvana-go/option"
    )
    
    func main() {
      client := nirvana.NewClient(
        option.WithAPIKey("My API Key"),
      )
      page, err := client.NKS.Clusters.LoadBalancers.List(
        context.TODO(),
        "cluster_id",
        nks.ClusterLoadBalancerListParams{
    
        },
      )
      if err != nil {
        panic(err.Error())
      }
      fmt.Printf("%+v\n", page)
    }
    
    {
      "items": [
        {
          "id": "123e4567-e89b-12d3-a456-426614174000",
          "cluster_id": "123e4567-e89b-12d3-a456-426614174000",
          "created_at": "2025-01-01T00:00:00Z",
          "namespace": "default",
          "private_ip": "10.0.0.50",
          "public_ip": "198.51.100.10",
          "public_ip_enabled": false,
          "service_name": "my-service",
          "status": "ready",
          "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",
          "cluster_id": "123e4567-e89b-12d3-a456-426614174000",
          "created_at": "2025-01-01T00:00:00Z",
          "namespace": "default",
          "private_ip": "10.0.0.50",
          "public_ip": "198.51.100.10",
          "public_ip_enabled": false,
          "service_name": "my-service",
          "status": "ready",
          "updated_at": "2025-01-01T00:00:00Z"
        }
      ],
      "pagination": {
        "next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
        "previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
        "total_count": 125
      }
    }