meterstatus

package
v0.0.0-...-9ec3720 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: AGPL-3.0 Imports: 11 Imported by: 0

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.

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 NewMeterStatusFacade

func NewMeterStatusFacade(ctx facade.Context) (*MeterStatusAPI, error)

NewMeterStatusFacade provides the signature required for facade registration.

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 MeterStatusAPIV1

type MeterStatusAPIV1 struct {
	MeterStatusAPI
}

MeterStatusAPIV1 implements V1 of the Meter Status API.

func NewMeterStatusAPIV1

func NewMeterStatusAPIV1(
	st MeterStatusState,
	resources facade.Resources,
	authorizer facade.Authorizer,
) (*MeterStatusAPIV1, error)

NewMeterStatusAPIV1 creates an instance of the V1 MeterStatus API.

func NewMeterStatusFacadeV1

func NewMeterStatusFacadeV1(ctx facade.Context) (*MeterStatusAPIV1, error)

NewMeterStatusFacadeV1 provides the signature required for the V1 facade registration.

func (*MeterStatusAPIV1) SetState

func (u *MeterStatusAPIV1) SetState(_ struct{})

SetState isn't on the v1 API.

func (*MeterStatusAPIV1) State

func (u *MeterStatusAPIV1) State(_ struct{})

State isn't on the v1 API.

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