client

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Overview

Package client 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")

	// ErrPermissionDenied returned when the subject does not permissions to access the resource
	ErrPermissionDenied = errors.New("client does not have permissions")

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

	// ErrHTTPError 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 ...Option) *Client

NewClient creates a new lb api client

func (*Client) GetLoadBalancer

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

GetLoadBalancer returns a load balancer by id

type GQLClient

type GQLClient interface {
	Query(tx context.Context, q interface{}, variables map[string]interface{}, options ...graphql.Option) error
}

GQLClient is an interface for a graphql client

type GetLoadBalancer

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

GetLoadBalancer is a struct that represents the GetLoadBalancer GraphQL query

type IPAddress

type IPAddress struct {
	ID       string
	IP       string
	Reserved bool
}

IPAddress is a struct that represents the IPAddress GraphQL type

type LoadBalancer

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

LoadBalancer is a struct that represents the LoadBalancer GraphQL type

type LocationNode

type LocationNode struct {
	ID string
}

LocationNode is a struct that represents the LocationNode GraphQL type

type Option

type Option func(*Client)

Option is a function that modifies a client

func WithHTTPClient

func WithHTTPClient(cli *http.Client) Option

WithHTTPClient functional option to set the http client

type OriginEdges

type OriginEdges struct {
	Node OriginNode
}

OriginEdges is a struct that represents the OriginEdges GraphQL type

type OriginNode

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

OriginNode is a struct that represents the OriginNode GraphQL type

type Origins

type Origins struct {
	Edges []OriginEdges
}

Origins is a struct that represents the Origins GraphQL type

type OwnerNode

type OwnerNode struct {
	ID string
}

OwnerNode is a struct that represents the OwnerNode GraphQL type

type Pool

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

Pool is a struct that represents the Pool GraphQL type

type PortEdges

type PortEdges struct {
	Node PortNode
}

PortEdges is a struct that represents the PortEdges GraphQL type

type PortNode

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

PortNode is a struct that represents the PortNode GraphQL type

type Ports

type Ports struct {
	Edges []PortEdges
}

Ports is a struct that represents the Ports GraphQL type

Jump to

Keyboard shortcuts

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