meterstatus

package
v0.0.0-...-a753888 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: AGPL-3.0 Imports: 12 Imported by: 3

Documentation

Overview

Package meterstatus provides the meter status API facade.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MeterStatusWrapper

func MeterStatusWrapper(getter func() (state.MeterStatus, error)) (state.MeterStatus, error)

MeterStatusWrapper takes a MeterStatus and converts it into an 'api friendly' form where Not Set and Not Available (which are important distinctions in state) are converted into Amber and Red respectively in the api.

func Register

func Register(registry facade.FacadeRegistry)

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

Types

type MeterStatus

type MeterStatus interface {
	GetMeterStatus(args params.Entities) (params.MeterStatusResults, error)
	WatchMeterStatus(args params.Entities) (params.NotifyWatchResults, error)
}

MeterStatus defines the methods exported by the meter status API facade.

type MeterStatusAPI

type MeterStatusAPI struct {
	*common.UnitStateAPI
	// contains filtered or unexported fields
}

MeterStatusAPI implements the MeterStatus interface and is the concrete implementation of the API endpoint. Additionally, it embeds common.UnitStateAPI to allow meter status workers to access their controller-backed internal state.

func NewMeterStatusAPI

func NewMeterStatusAPI(
	st MeterStatusState,
	resources facade.Resources,
	authorizer facade.Authorizer,
) (*MeterStatusAPI, error)

NewMeterStatusAPI creates a new API endpoint for dealing with unit meter status.

func (*MeterStatusAPI) GetMeterStatus

func (m *MeterStatusAPI) GetMeterStatus(args params.Entities) (params.MeterStatusResults, error)

GetMeterStatus returns meter status information for each unit.

func (*MeterStatusAPI) WatchMeterStatus

func (m *MeterStatusAPI) WatchMeterStatus(args params.Entities) (params.NotifyWatchResults, error)

WatchMeterStatus returns a NotifyWatcher for observing changes to each unit's meter status.

type MeterStatusState

type MeterStatusState interface {
	ApplyOperation(state.ModelOperation) error
	ControllerConfig() (controller.Config, error)

	// Application returns a application state by name.
	Application(name string) (*state.Application, error)

	// Unit returns a unit by name.
	Unit(id string) (*state.Unit, error)
}

MeterStatusState represents the state of an model required by the MeterStatus.

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