machine

package
v0.0.0-...-6d42826 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: AGPL-3.0 Imports: 14 Imported by: 2

Documentation

Overview

Package machine implements the API interface used by the machiner worker.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(registry facade.FacadeRegistry)

Register is called to expose a package of facades onto a given registry.

Types

type ControllerConfigService

type ControllerConfigService interface {
	ControllerConfig(context.Context) (controller.Config, error)
}

ControllerConfigService defines the methods on the controller config service that are needed by the machiner API.

type MachineService

type MachineService interface {
	// EnsureDeadMachine sets the provided machine's life status to Dead.
	// No error is returned if the provided machine doesn't exist, just nothing
	// gets updated.
	EnsureDeadMachine(ctx context.Context, machineName machine.Name) error
	// IsMachineController returns whether the machine is a controller machine.
	// It returns a NotFound if the given machine doesn't exist.
	IsMachineController(context.Context, machine.Name) (bool, error)
}

MachineService defines the methods that the facade assumes from the Machine service.

type MachinerAPI

type MachinerAPI struct {
	*common.LifeGetter
	*common.StatusSetter
	*common.DeadEnsurer
	*common.AgentEntityWatcher
	*common.APIAddresser
	*networkingcommon.NetworkConfigAPI
	// contains filtered or unexported fields
}

MachinerAPI implements the API used by the machiner worker.

func NewMachinerAPIForState

func NewMachinerAPIForState(
	ctx context.Context,
	ctrlSt, st *state.State,
	clock clock.Clock,
	controllerConfigService ControllerConfigService,
	cloudService common.CloudService,
	networkService NetworkService,
	machineService MachineService,
	watcherRegistry facade.WatcherRegistry,
	resources facade.Resources,
	authorizer facade.Authorizer,
) (*MachinerAPI, error)

NewMachinerAPIForState creates a new instance of the Machiner API.

func (*MachinerAPI) APIAddresses

func (api *MachinerAPI) APIAddresses(ctx context.Context) (result params.StringsResult, err error)

APIAddresses returns the list of addresses used to connect to the API.

func (*MachinerAPI) APIHostPorts

func (api *MachinerAPI) APIHostPorts(ctx context.Context) (result params.APIHostPortsResult, err error)

APIHostPorts returns the API server addresses.

func (*MachinerAPI) IsController

func (api *MachinerAPI) IsController(ctx context.Context, args params.Entities) (params.IsControllerResults, error)

IsController returns if the given machine is a controller machine.

func (*MachinerAPI) RecordAgentStartInformation

func (api *MachinerAPI) RecordAgentStartInformation(ctx context.Context, args params.RecordAgentStartInformationArgs) (params.ErrorResults, error)

RecordAgentStartInformation syncs the machine model with information reported by a machine agent when it starts.

func (*MachinerAPI) RecordAgentStartTime

func (api *MachinerAPI) RecordAgentStartTime(ctx context.Context, args params.Entities) (params.ErrorResults, error)

RecordAgentStartTime updates the agent start time field in the machine doc.

func (*MachinerAPI) SetMachineAddresses

func (api *MachinerAPI) SetMachineAddresses(ctx context.Context, args params.SetMachinesAddresses) (params.ErrorResults, error)

type MachinerAPIv5

type MachinerAPIv5 struct {
	*MachinerAPI
}

MachinerAPI5 stubs out the Jobs() and SetMachineAddresses() methods.

func (*MachinerAPIv5) Jobs

Jobs is not supported in MachinerAPI at version 5. Deprecated: Jobs is being deprecated. Use IsController instead.

func (*MachinerAPIv5) SetMachineAddresses

func (api *MachinerAPIv5) SetMachineAddresses(ctx context.Context, args params.SetMachinesAddresses) (params.ErrorResults, error)

SetMachineAddresses is not supported in MachinerAPI at version 5.

type NetworkService

type NetworkService interface {
	// GetAllSpaces returns all spaces for the model.
	GetAllSpaces(ctx context.Context) (network.SpaceInfos, error)
	// GetAllSubnets returns all the subnets for the model.
	GetAllSubnets(ctx context.Context) (network.SubnetInfos, error)
	// AddSubnet creates and returns a new subnet.
	AddSubnet(ctx context.Context, args network.SubnetInfo) (network.Id, error)
}

NetworkService is the interface that is used to interact with the network spaces/subnets.

Jump to

Keyboard shortcuts

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