agent

package
v0.0.0-...-f88c608 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: AGPL-3.0 Imports: 23 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MongoIsMaster = mongo.IsMaster

MongoIsMaster is called by the IsMaster API call instead of mongo.IsMaster. It exists so it can be overridden by tests.

Functions

func Register

func Register(registry facade.FacadeRegistry)

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

Types

type AgentAPI

type AgentAPI struct {
	*common.PasswordChanger
	*common.RebootFlagClearer
	*commonmodel.ModelConfigWatcher
	*common.ControllerConfigAPI
	cloudspec.CloudSpecer
	// contains filtered or unexported fields
}

AgentAPI implements the version 3 of the API provided to an agent.

func NewAgentAPI

func NewAgentAPI(
	auth facade.Authorizer,
	resources facade.Resources,
	st *state.State,
	controllerConfigService ControllerConfigService,
	externalControllerService ExternalControllerService,
	cloudService CloudService,
	credentialService CredentialService,
	rebootMachineService MachineRebootService,
	modelConfigService ModelConfigService,
	applicationService ApplicationService,
	watcherRegistry facade.WatcherRegistry,
) (*AgentAPI, error)

NewAgentAPI returns an agent API facade.

func NewAgentAPIV3

func NewAgentAPIV3(ctx facade.ModelContext) (*AgentAPI, error)

NewAgentAPIV3 returns an object implementing version 3 of the Agent API with the given authorizer representing the currently logged in client.

func (*AgentAPI) GetEntities

func (*AgentAPI) IsMaster

func (api *AgentAPI) IsMaster(ctx context.Context) (params.IsMasterResult, error)

func (*AgentAPI) StateServingInfo

func (api *AgentAPI) StateServingInfo(ctx context.Context) (result params.StateServingInfo, err error)

func (*AgentAPI) WatchCredentials

func (api *AgentAPI) WatchCredentials(ctx context.Context, args params.Entities) (params.NotifyWatchResults, error)

WatchCredentials watches for changes to the specified credentials.

type ApplicationService

type ApplicationService interface {
	GetUnitLife(ctx context.Context, name unit.Name) (life.Value, error)
}

ApplicationService provides access to the application service.

type CloudService

type CloudService interface {
	// Cloud returns the named cloud.
	Cloud(ctx context.Context, name string) (*cloud.Cloud, error)
	// WatchCloud returns a watcher that observes changes to the specified cloud.
	WatchCloud(ctx context.Context, name string) (watcher.NotifyWatcher, error)
}

CloudService provides access to clouds.

type ControllerConfigService

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

ControllerConfigService is the interface that gets ControllerConfig form DB.

type CredentialService

type CredentialService interface {
	// CloudCredential returns the cloud credential for the given tag.
	CloudCredential(ctx context.Context, key credential.Key) (cloud.Credential, error)

	// WatchCredential returns a watcher that observes changes to the specified
	// credential.
	WatchCredential(ctx context.Context, key credential.Key) (watcher.NotifyWatcher, error)
}

CredentialService provides access to credentials.

type ExternalControllerService

type ExternalControllerService interface {
	// ControllerForModel returns the controller record that's associated
	// with the modelUUID.
	ControllerForModel(ctx context.Context, modelUUID string) (*crossmodel.ControllerInfo, error)

	// UpdateExternalController persists the input controller
	// record.
	UpdateExternalController(ctx context.Context, ec crossmodel.ControllerInfo) error
}

ExternalControllerService defines the methods that the controller facade needs from the controller state.

type MachineRebootService

type MachineRebootService interface {
	// RequireMachineReboot sets the machine referenced by its UUID as requiring a reboot.
	RequireMachineReboot(ctx context.Context, uuid string) error

	// ClearMachineReboot removes the reboot flag of the machine referenced by its UUID if a reboot has previously been required.
	ClearMachineReboot(ctx context.Context, uuid string) error

	// IsMachineRebootRequired checks if the machine referenced by its UUID requires a reboot.
	IsMachineRebootRequired(ctx context.Context, uuid string) (bool, error)

	// ShouldRebootOrShutdown determines whether a machine should reboot or shutdown
	ShouldRebootOrShutdown(ctx context.Context, uuid string) (machine.RebootAction, error)

	// GetMachineUUID returns the UUID of a machine identified by its name.
	// It returns an errors.MachineNotFound if the machine does not exist.
	GetMachineUUID(ctx context.Context, machineName machine.Name) (string, error)
}

MachineRebootService is an interface that defines methods for managing machine reboots.

type ModelConfigService

type ModelConfigService interface {
	// ModelConfig returns the current config for the model.
	ModelConfig(ctx context.Context) (*config.Config, error)
	// Watch returns a watcher that returns keys for any changes to model
	// config.
	Watch() (watcher.StringsWatcher, error)
}

ModelConfigService is an interface that provides access to the model configuration.

Jump to

Keyboard shortcuts

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