linodego

package
v0.0.0-...-4463c60 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

README

Linode REST API Client

This package implements a minimal REST API client for the Linode REST v4 API.

This client only implements the endpoints usend on the Linode cloud provider, it is intended to be a drop-in replacement for the linodego official go client.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is the struct to perform API calls

func NewClient

func NewClient(hc *http.Client) (client Client)

NewClient factory to create new Client struct

func (*Client) CreateLKEClusterPool

func (c *Client) CreateLKEClusterPool(ctx context.Context, clusterID int, createOpts LKEClusterPoolCreateOptions) (*LKEClusterPool, error)

CreateLKEClusterPool creates a LKE Pool for for a LKE Cluster

func (*Client) DeleteLKEClusterPool

func (c *Client) DeleteLKEClusterPool(ctx context.Context, clusterID, id int) error

DeleteLKEClusterPool deletes the LKE Pool with the specified id

func (*Client) ListLKEClusterPools

func (c *Client) ListLKEClusterPools(ctx context.Context, clusterID int, opts *ListOptions) ([]LKEClusterPool, error)

ListLKEClusterPools lists LKE Pools

func (*Client) SetBaseURL

func (c *Client) SetBaseURL(url string) *Client

SetBaseURL sets the base URL of the Linode v4 API (https://api.linode.com/v4)

func (*Client) SetUserAgent

func (c *Client) SetUserAgent(ua string) *Client

SetUserAgent sets a custom user-agent for HTTP requests

type LKEClusterPool

type LKEClusterPool struct {
	ID      int                    `json:"id"`
	Count   int                    `json:"count"`
	Type    string                 `json:"type"`
	Disks   []LKEClusterPoolDisk   `json:"disks"`
	Linodes []LKEClusterPoolLinode `json:"nodes"`
}

LKEClusterPool represents a LKE Pool

type LKEClusterPoolCreateOptions

type LKEClusterPoolCreateOptions struct {
	Count int                  `json:"count"`
	Type  string               `json:"type"`
	Disks []LKEClusterPoolDisk `json:"disks"`
}

LKEClusterPoolCreateOptions fields are those accepted by CreateLKEClusterPool

type LKEClusterPoolDisk

type LKEClusterPoolDisk struct {
	Size int    `json:"size"`
	Type string `json:"type"`
}

LKEClusterPoolDisk represents a node disk in an LKEClusterPool object

type LKEClusterPoolLinode

type LKEClusterPoolLinode struct {
	ID         string          `json:"id"`
	InstanceID int             `json:"instance_id"`
	Status     LKELinodeStatus `json:"status"`
}

LKEClusterPoolLinode represents a node in a LKE Pool

type LKEClusterPoolResponse

type LKEClusterPoolResponse struct {
	Pools []LKEClusterPool `json:"data"`
	PageOptions
}

LKEClusterPoolResponse is the struct for unmarshaling response from the list of LKE pools API call

type LKELinodeStatus

type LKELinodeStatus string

LKELinodeStatus represents the status of a node in a LKE Pool

const (
	LKELinodeReady    LKELinodeStatus = "ready"
	LKELinodeNotReady LKELinodeStatus = "not_ready"
)

LKELinodeStatus constants reflect the current status of an node in a LKE Pool

type ListOptions

type ListOptions struct {
	*PageOptions
	PageSize int
	Filter   string
}

ListOptions are the pagination and filtering parameters for endpoints

type PageOptions

type PageOptions struct {
	Page    int `json:"page"`
	Pages   int `json:"pages"`
	Results int `json:"results"`
}

PageOptions are the pagination parameters for List endpoints

Jump to

Keyboard shortcuts

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