client

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ignition2_2 = sabakan.Ignition2_2
	Ignition2_3 = sabakan.Ignition2_3
)

Supported ignition versions

Variables

This section is empty.

Functions

func Is4xx

func Is4xx(err error) bool

Is4xx returns true if err contains 4xx status code

func Is5xx

func Is5xx(err error) bool

Is5xx returns true if err contains 5xx status code

func IsConflict

func IsConflict(err error) bool

IsConflict returns true if err contains 409 status code

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns true if err contains 404 status code

Types

type Client

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

Client is a sabakan client

func NewClient

func NewClient(endpoint string, http *http.Client) (*Client, error)

NewClient returns new client

func (*Client) AssetsDelete

func (c *Client) AssetsDelete(ctx context.Context, name string) error

AssetsDelete deletes an asset

func (*Client) AssetsIndex

func (c *Client) AssetsIndex(ctx context.Context) ([]string, error)

AssetsIndex retrieves index of assets

func (*Client) AssetsInfo

func (c *Client) AssetsInfo(ctx context.Context, name string) (*sabakan.Asset, error)

AssetsInfo retrieves meta data of an asset

func (*Client) AssetsUpload

func (c *Client) AssetsUpload(ctx context.Context, name, filename string, meta map[string]string) (*sabakan.AssetStatus, error)

AssetsUpload stores a file as an asset

func (*Client) CryptsDelete

func (c *Client) CryptsDelete(ctx context.Context, serial string) error

CryptsDelete removes all encryption keys of the machine specified by serial.

func (*Client) CryptsGet

func (c *Client) CryptsGet(ctx context.Context, serial, device string) ([]byte, error)

CryptsGet gets an encryption key from sabakan server.

func (*Client) CryptsPut

func (c *Client) CryptsPut(ctx context.Context, serial, device string, key []byte) error

CryptsPut puts an encryption key to sabakan server.

func (*Client) DHCPConfigGet

func (c *Client) DHCPConfigGet(ctx context.Context) (*sabakan.DHCPConfig, error)

DHCPConfigGet retrieves DHCP configurations

func (*Client) DHCPConfigSet

func (c *Client) DHCPConfigSet(ctx context.Context, conf *sabakan.DHCPConfig) error

DHCPConfigSet sets DHCP configurations

func (*Client) IPAMConfigGet

func (c *Client) IPAMConfigGet(ctx context.Context) (*sabakan.IPAMConfig, error)

IPAMConfigGet retrieves IPAM configurations

func (*Client) IPAMConfigSet

func (c *Client) IPAMConfigSet(ctx context.Context, conf *sabakan.IPAMConfig) error

IPAMConfigSet sets IPAM configurations

func (*Client) IgnitionsDelete

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

IgnitionsDelete deletes an ignition template specified by role and id

func (*Client) IgnitionsGet

func (c *Client) IgnitionsGet(ctx context.Context, role, id string) (*IgnitionTemplate, error)

IgnitionsGet gets an ignition template identified by role and id.

func (*Client) IgnitionsListIDs

func (c *Client) IgnitionsListIDs(ctx context.Context, role string) ([]string, error)

IgnitionsListIDs gets list of ignition template IDs for a role

func (*Client) IgnitionsSet

func (c *Client) IgnitionsSet(ctx context.Context, role, id string, tmpl *IgnitionTemplate) error

IgnitionsSet puts an ignition template file

func (*Client) ImagesDelete

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

ImagesDelete deletes image file.

func (*Client) ImagesIndex

func (c *Client) ImagesIndex(ctx context.Context, os string) (sabakan.ImageIndex, error)

ImagesIndex get index of images.

func (*Client) ImagesUpload

func (c *Client) ImagesUpload(ctx context.Context, os, id string, kernel io.Reader, kernelSize int64, initrd io.Reader, initrdSize int64) error

ImagesUpload upload image file.

func (*Client) KernelParamsGet

func (c *Client) KernelParamsGet(ctx context.Context, os string) (sabakan.KernelParams, error)

KernelParamsGet retrieves kernel parameters

func (*Client) KernelParamsSet

func (c *Client) KernelParamsSet(ctx context.Context, os string, params sabakan.KernelParams) error

KernelParamsSet sets kernel parameters

func (*Client) LogsGet

func (c *Client) LogsGet(ctx context.Context, since, until time.Time, w io.Writer) error

LogsGet retrieves audit logs.

func (*Client) MachinesCreate

func (c *Client) MachinesCreate(ctx context.Context, specs []*sabakan.MachineSpec) error

MachinesCreate create machines information to sabakan server

func (*Client) MachinesGet

func (c *Client) MachinesGet(ctx context.Context, params map[string]string) ([]sabakan.Machine, error)

MachinesGet get machine information from sabakan server

func (*Client) MachinesGetState

func (c *Client) MachinesGetState(ctx context.Context, serial string) (sabakan.MachineState, error)

MachinesGetState get the state of the machine from sabakan server

func (*Client) MachinesRemove

func (c *Client) MachinesRemove(ctx context.Context, serial string) error

MachinesRemove removes machine information from sabakan server

func (*Client) MachinesRemoveLabel

func (c *Client) MachinesRemoveLabel(ctx context.Context, serial string, label string) error

MachinesRemoveLabel removes a label from a machine on sabakan server.

func (*Client) MachinesSetLabel

func (c *Client) MachinesSetLabel(ctx context.Context, serial string, label, value string) error

MachinesSetLabel adds or updates a label for a machine on sabakan server.

func (*Client) MachinesSetRetireDate

func (c *Client) MachinesSetRetireDate(ctx context.Context, serial string, date time.Time) error

MachinesSetRetireDate set the retire date of the machine.

func (*Client) MachinesSetState

func (c *Client) MachinesSetState(ctx context.Context, serial string, state string) error

MachinesSetState set the state of the machine on sabakan server

type IgnitionTemplate

type IgnitionTemplate = sabakan.IgnitionTemplate

IgnitionTemplate represents an ignition template

func BuildIgnitionTemplate

func BuildIgnitionTemplate(sourceFile string, metadata map[string]interface{}) (*IgnitionTemplate, error)

BuildIgnitionTemplate constructs an IgnitionTemplate from source file.

type IgnitionVersion

type IgnitionVersion = sabakan.IgnitionVersion

IgnitionVersion represents ignition specification version in `major.minor`

type ImageIndex

type ImageIndex = sabakan.ImageIndex

ImageIndex is a list of *Image.

type RemoteFile

type RemoteFile struct {
	Name string `json:"name"`
	URL  string `json:"url"`
	Mode *int   `json:"mode"`
}

RemoteFile represents a remote file.

type SystemdUnit

type SystemdUnit struct {
	Name    string `json:"name"`
	Enabled bool   `json:"enabled"`
	Mask    bool   `json:"mask"`
}

SystemdUnit represents a systemd unit in Ignition template.

type TemplateSource

type TemplateSource struct {
	Version     IgnitionVersion `json:"version"`
	Include     string          `json:"include"`
	Passwd      string          `json:"passwd"`
	Files       []string        `json:"files"`
	RemoteFiles []RemoteFile    `json:"remote_files"`
	Systemd     []SystemdUnit   `json:"systemd"`
	Networkd    []string        `json:"networkd"`
}

TemplateSource represents YAML/JSON source file of Ignition template.

Jump to

Keyboard shortcuts

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