landscape

package
v0.0.0-...-7db3de3 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Overview

Package landscape implements a client to the Landscape Host Agent API service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudInit

type CloudInit interface {
	WriteDistroData(distroName string, cloudInit string) error
	RemoveDistroData(distroName string) error
}

CloudInit is a cloud-init user data writer.

type Config

type Config interface {
	LandscapeClientConfig() (string, config.Source, error)

	Subscription() (string, config.Source, error)

	LandscapeAgentUID() (string, error)
	SetLandscapeAgentUID(string) error
}

Config is a configuration provider for ProToken and the Landscape URL.

type Controller

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

Controller is a light-weight structure used to send certain instructions to the Landscape service.

func (Controller) Reconnect

func (c Controller) Reconnect(ctx context.Context) (succcess bool)

Reconnect makes Landscape drop its current connection and start a new one. Blocks until the new connection is available (or failed).

func (Controller) SendUpdatedInfo

func (c Controller) SendUpdatedInfo(ctx context.Context) error

SendUpdatedInfo sends a message to the Landscape server with updated info about the machine and the distros.

type Option

type Option = func(*options)

Option is an optional argument for NewClient.

type Service

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

Service orquestrates the Landscape hostagent connection. It lasts for the entire lifetime of the program. It creates the executor and ensures there is always an active connection, creating a new one otherwise.

func New

func New(ctx context.Context, conf Config, db *database.DistroDB, cloudInit CloudInit, args ...Option) (s *Service, err error)

New creates a new Landscape service object.

func (*Service) Connect

func (s *Service) Connect() (err error)

Connect starts the connection and starts talking to the server. Call Stop to deallocate resources.

func (*Service) Controller

func (s *Service) Controller() Controller

Controller creates a controler for this service.

func (*Service) NotifyConfigUpdate

func (s *Service) NotifyConfigUpdate(ctx context.Context, landscapeConf, agentUID string)

NotifyConfigUpdate is called when the configuration changes. It will trigger a reconnection if needed.

func (*Service) NotifyUbuntuProUpdate

func (s *Service) NotifyUbuntuProUpdate(ctx context.Context, token string)

NotifyUbuntuProUpdate is called when the Ubuntu Pro token changes. It will trigger a reconnection if needed.

func (*Service) Stop

func (s *Service) Stop(ctx context.Context)

Stop terminates the connection and deallocates resources.

Directories

Path Synopsis
Package distroinstall exists to implement various utilities used by landscape that need to be mocked in tests.
Package distroinstall exists to implement various utilities used by landscape that need to be mocked in tests.

Jump to

Keyboard shortcuts

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