client

package
v0.0.0-...-6580c4d Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flatten

func Flatten(tree any) ([][]string, error)

Flatten a multi level object into a flat list of {key, value} pairs

Types

type Client

type Client struct {
	Config          *ConfigService
	ContainerImages *ContainerImageService
	// contains filtered or unexported fields
}

func New

func New(url string, key string) *Client

func NewWithClient

func NewWithClient(c *http.Client, url string, key string) *Client

func (*Client) Request

func (c *Client) Request(ctx context.Context, endpoint string, payload any) (any, error)

Post a raw request with `payload` to `endpoint`.

type ConfigService

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

func (*ConfigService) Delete

func (svc *ConfigService) Delete(ctx context.Context, path string, value ...any) error

Delete values at the specified path.

If `value` is nil or zero length the whole `path` will be deleted. If `value` is a string it will be directly deleted. For lists maps, and any nesting of those types, each individual value will be deleted in a batch.

func (*ConfigService) LoadFile

func (svc *ConfigService) LoadFile(ctx context.Context, file string) error

Load a configuration file

func (*ConfigService) Save

func (svc *ConfigService) Save(ctx context.Context) error

Save the running configuration to the default startup configuration

func (*ConfigService) SaveFile

func (svc *ConfigService) SaveFile(ctx context.Context, file string) error

Save the running configuration to the specified file

func (*ConfigService) Set

func (svc *ConfigService) Set(ctx context.Context, path string, value any) error

Set the configuration at the specified path.

If `value` is a string it will be directly set. For lists maps, and any nesting of those types, each individual value will be set in a batch.

func (*ConfigService) Show

func (svc *ConfigService) Show(ctx context.Context, path string) (any, error)

Return the configuration tree at the specified path

type ContainerImage

type ContainerImage struct {
	Name    string
	Tag     string
	ImageID string
}

type ContainerImageService

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

func (*ContainerImageService) Add

func (svc *ContainerImageService) Add(ctx context.Context, image string) error

Add container image

func (*ContainerImageService) Delete

func (svc *ContainerImageService) Delete(ctx context.Context, image string) error

Delete container image

func (*ContainerImageService) Show

Return the list of container images

Jump to

Keyboard shortcuts

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