instancemutater

package
v0.0.0-...-b9bb202 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WithTracer = base.WithTracer

WithTracer returns an Option that configures the Client to use the supplied tracer.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(caller base.APICaller, options ...Option) *Client

NewClient creates a new instance mutater facade using the input caller.

func NewClientFromFacade

func NewClientFromFacade(facadeCaller base.FacadeCaller) *Client

NewClientFromFacade creates a new instance mutater facade using the input facade caller.

func (*Client) Machine

func (c *Client) Machine(ctx context.Context, tag names.MachineTag) (MutaterMachine, error)

Machine provides access to methods of a state.Machine through the facade.

func (*Client) WatchModelMachines

func (c *Client) WatchModelMachines(ctx context.Context) (watcher.StringsWatcher, error)

WatchModelMachines returns a StringsWatcher reporting changes to machines and not containers.

type Machine

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

Machine represents a juju machine as seen by an instancemutater worker.

func (*Machine) CharmProfilingInfo

func (m *Machine) CharmProfilingInfo(ctx context.Context) (*UnitProfileInfo, error)

CharmProfilingInfo implements MutaterMachine.CharmProfilingInfo.

func (*Machine) ContainerType

func (m *Machine) ContainerType(ctx context.Context) (instance.ContainerType, error)

ContainerType implements MutaterMachine.ContainerType.

func (*Machine) InstanceId

func (m *Machine) InstanceId(ctx context.Context) (string, error)

InstanceId implements MutaterMachine.InstanceId.

func (*Machine) Life

func (m *Machine) Life() life.Value

Life implements MutaterMachine.Life.

func (*Machine) Refresh

func (m *Machine) Refresh(ctx context.Context) error

Refresh implements MutaterMachine.Refresh.

func (*Machine) SetCharmProfiles

func (m *Machine) SetCharmProfiles(ctx context.Context, profiles []string) error

SetCharmProfiles implements MutaterMachine.SetCharmProfiles.

func (*Machine) SetModificationStatus

func (m *Machine) SetModificationStatus(ctx context.Context, status status.Status, info string, data map[string]interface{}) error

SetModificationStatus implements MutaterMachine.SetModificationStatus.

func (*Machine) Tag

func (m *Machine) Tag() names.MachineTag

Tag implements MutaterMachine.Tag.

func (*Machine) WatchContainers

func (m *Machine) WatchContainers(ctx context.Context) (watcher.StringsWatcher, error)

WatchContainers returns a StringsWatcher reporting changes to containers.

func (*Machine) WatchLXDProfileVerificationNeeded

func (m *Machine) WatchLXDProfileVerificationNeeded(ctx context.Context) (watcher.NotifyWatcher, error)

WatchLXDProfileVerificationNeeded implements MutaterMachine.WatchLXDProfileVerificationNeeded.

func (*Machine) WatchUnits

func (m *Machine) WatchUnits(ctx context.Context) (watcher.StringsWatcher, error)

WatchUnits implements MutaterMachine.WatchUnits.

type MutaterMachine

type MutaterMachine interface {

	// InstanceId returns the provider specific instance id for this machine
	InstanceId(context.Context) (string, error)

	// CharmProfilingInfo returns info to update lxd profiles on the machine
	CharmProfilingInfo(context.Context) (*UnitProfileInfo, error)

	// ContainerType returns the container type for this machine.
	ContainerType(context.Context) (instance.ContainerType, error)

	// SetCharmProfiles records the given slice of charm profile names.
	SetCharmProfiles(context.Context, []string) error

	// Tag returns the current machine tag
	Tag() names.MachineTag

	// Life returns the machine's lifecycle value.
	Life() life.Value

	// Refresh updates the cached local copy of the machine's data.
	Refresh(context.Context) error

	// WatchUnits returns a watcher.StringsWatcher for watching units of a given
	// machine.
	WatchUnits(context.Context) (watcher.StringsWatcher, error)

	// WatchLXDProfileVerificationNeeded returns a NotifyWatcher, notifies when the
	// following changes happen:
	//  - application charm URL changes and there is a lxd profile
	//  - unit is add or removed and there is a lxd profile
	WatchLXDProfileVerificationNeeded(context.Context) (watcher.NotifyWatcher, error)

	// WatchContainers returns a watcher.StringsWatcher for watching
	// containers of a given machine.
	WatchContainers(ctx context.Context) (watcher.StringsWatcher, error)

	// SetModificationStatus sets the provider specific modification status
	// for a machine. Allowing the propagation of status messages to the
	// operator.
	SetModificationStatus(ctx context.Context, status status.Status, info string, data map[string]interface{}) error
}

MutatorMachine represents the machine methods required for the instancemutater.

type Option

type Option = base.Option

Option is a function that can be used to configure a Client.

type UnitProfileChanges

type UnitProfileChanges struct {
	ApplicationName string
	Revision        int
	Profile         lxdprofile.Profile
}

UnitProfileChanges provides the application name, revision and profile of the current charm referenced by this application.

type UnitProfileInfo

type UnitProfileInfo struct {
	ModelName       string
	InstanceId      instance.Id
	ProfileChanges  []UnitProfileChanges
	CurrentProfiles []string
}

UnitProfileInfo is data required by the instancemutater to determine what any changes are required to a machine's lxd profiles.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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