service

package
v0.0.0-...-56cb166 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModelService

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

ModelService is a modelagent service which can be used to get the running Juju agent version for the current model.

func NewModelService

func NewModelService(modelSt ModelState, st State, watcherFactory WatcherFactory) *ModelService

NewModelService returns a new ModelService.

func (*ModelService) GetMachineTargetAgentVersion

func (s *ModelService) GetMachineTargetAgentVersion(
	ctx context.Context,
	machineName machine.Name,
) (version.Number, error)

GetMachineTargetAgentVersion reports the target agent version that should be running on the provided machine identified by name. The following errors are possible: - machineerrors.MachineNotFound - github.com/juju/juju/domain/model/errors.NotFound

func (*ModelService) GetModelTargetAgentVersion

func (s *ModelService) GetModelTargetAgentVersion(
	ctx context.Context,
) (version.Number, error)

GetModelTargetAgentVersion returns the target agent version for the entire model. The following errors can be returned: - github.com/juju/juju/domain/model/errors.NotFound - When the model does not exist.

func (*ModelService) GetUnitTargetAgentVersion

func (s *ModelService) GetUnitTargetAgentVersion(
	ctx context.Context,
	unitName string,
) (version.Number, error)

GetUnitTargetAgentVersion reports the target agent version that should be being run on the provided unit identified by name. The following errors are possible: - applicationerrors.UnitNotFound - When the unit in question does not exist. - github.com/juju/juju/domain/model/errors.NotFound - When the model the unit belongs to no longer exists.

func (*ModelService) WatchMachineTargetAgentVersion

func (s *ModelService) WatchMachineTargetAgentVersion(
	ctx context.Context,
	machineName machine.Name,
) (watcher.NotifyWatcher, error)

WatchMachineTargetAgentVersion is responsible for watching the target agent version for machine and reporting when there has been a change via a watcher.NotifyWatcher. The following errors can be expected: - machineerrors.NotFound - When no machine exists for the provided name. - [modelerrors.NotFound] - When the model of the machine no longer exists.

func (*ModelService) WatchModelTargetAgentVersion

func (s *ModelService) WatchModelTargetAgentVersion(
	ctx context.Context,
) (watcher.NotifyWatcher, error)

WatchModelTargetAgentVersion is responsible for watching the target agent version of this model and reporting when a change has happened in the version.

func (*ModelService) WatchUnitTargetAgentVersion

func (s *ModelService) WatchUnitTargetAgentVersion(
	ctx context.Context,
	unitName string,
) (watcher.NotifyWatcher, error)

WatchUnitTargetAgentVersion is responsible for watching the target agent version for unit and reporting when there has been a change via a watcher.NotifyWatcher. The following errors can be expected: - applicationerrors.UnitNotFound - When no unit exists for the provided name. - [modelerrors.NotFound] - When the model of the unit no longer exists.

type ModelState

type ModelState interface {
	// CheckMachineExists check to see if the given machine exists in the model. If
	// the machine does not exist an error satisfying
	// [machineerrors.MachineNotFound] is returned.
	CheckMachineExists(context.Context, machine.Name) error

	// GetModelUUID returns the unique uuid for the model represented by this
	// state. If the model UUID is not found an error satisfying
	// [modelerrors.NotFound] is returned.
	GetModelUUID(context.Context) (model.UUID, error)

	// CheckUnitExists check to see if the given unit exists in the model. If
	// the unit does not exist an error satisfying
	// [applicationerrors.UnitNotFound] is returned.
	CheckUnitExists(context.Context, string) error
}

type Service

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

Service is a modelagent service which can be used to get the running Juju agent version for any given model.

func NewService

func NewService(st State) *Service

NewService returns a new modelagent service.

func (*Service) GetModelTargetAgentVersion

func (s *Service) GetModelTargetAgentVersion(
	ctx context.Context,
	modelID model.UUID,
) (version.Number, error)

GetModelTargetAgentVersion returns the agent version for the specified model. The following errors can be returned:

type State

type State interface {
	// GetModelTargetAgentVersion is responsible for returning the target
	// version the model is currently targeting for agents.
	GetModelTargetAgentVersion(context.Context, model.UUID) (version.Number, error)
}

State provides the state methods needed by the modelagent service.

type WatcherFactory

type WatcherFactory interface {
	// NewValueWatcher returns a watcher for a particular change value in a
	// namespace, based on the input change mask.
	NewValueWatcher(
		string,
		string,
		changestream.ChangeType,
	) (watcher.NotifyWatcher, error)
}

WatcherFactory provides a factory for constructing new watchers.

Jump to

Keyboard shortcuts

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