lbapi

package
v0.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package lbapi provides a client for interacting with the load balancer api

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnauthorized returned when the request is not authorized
	ErrUnauthorized = errors.New("client is unauthorized")

	// ErrNotfound returned when the load balancer ID not found
	ErrLBNotfound = errors.New("loadbalancer ID not found")

	// ErrLBHTTPError returned when the http response is an error
	ErrHTTPError = errors.New("loadbalancer api http error")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client creates a new lb api client against a specific endpoint

func NewClient

func NewClient(url string, opts ...ClientOption) *Client

NewClient creates a new lb api client

func (*Client) GetLoadBalancer

func (c *Client) GetLoadBalancer(ctx context.Context, id string) (*GetLoadBalancer, error)

GetLoadBalancer returns a load balancer by id

type ClientOption

type ClientOption func(*Client)

ClientOption is a function that modifies a client

func WithHTTPClient

func WithHTTPClient(cli *http.Client) ClientOption

WithHTTPClient functional option to set the http client

type GQLClient

type GQLClient interface {
	Query(ctx context.Context, q interface{}, variables map[string]interface{}) error
}

GQLClient is an interface for a graphql client

type GetLoadBalancer

type GetLoadBalancer struct {
	LoadBalancer LoadBalancer `graphql:"loadBalancer(id: $id)"`
}

type IPAddress added in v0.0.2

type IPAddress struct {
	ID       string
	IP       string
	Reserved bool
}

type LoadBalancer

type LoadBalancer struct {
	ID          string
	Name        string
	Owner       OwnerNode
	Location    LocationNode
	IPAddresses []IPAddress `graphql:"IPAddresses" json:"IPAddresses"`
	Ports       Ports
}

type LocationNode added in v0.0.2

type LocationNode struct {
	ID string
}

type OriginEdges

type OriginEdges struct {
	Node OriginNode
}

type OriginNode

type OriginNode struct {
	ID         string
	Name       string
	Target     string
	PortNumber int64
	Active     bool
}

type Origins

type Origins struct {
	Edges []OriginEdges
}

type OwnerNode added in v0.0.2

type OwnerNode struct {
	ID string
}

type Pool

type Pool struct {
	ID       string
	Name     string
	Protocol string
	Origins  Origins
}

type PortEdges

type PortEdges struct {
	Node PortNode
}

type PortNode

type PortNode struct {
	ID     string
	Name   string
	Number int64
	Pools  []Pool
}

type Ports

type Ports struct {
	Edges []PortEdges
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL