@canonical/jujulib
Version:
Juju API client
92 lines (91 loc) • 2.78 kB
JavaScript
/**
Juju MeterStatus version 2.
This facade is available on:
Controller-machine-agent
Machine-agent
Unit-agent
Models
NOTE: This file was generated using the Juju schema
from Juju 3.3 at the git SHA 65fa4c1ee5.
Do not manually edit this file.
*/
import { autoBind } from "../../utils.js";
/**
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.
*/
class MeterStatusV2 {
constructor(transport, info) {
this.NAME = "MeterStatus";
this.VERSION = 2;
this._transport = transport;
this._info = info;
// Automatically bind all methods to instances.
autoBind(this);
}
/**
GetMeterStatus returns meter status information for each unit.
*/
getMeterStatus(params) {
return new Promise((resolve, reject) => {
const req = {
type: "MeterStatus",
request: "GetMeterStatus",
version: 2,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
SetState sets the state persisted by the charm running in this unit
and the state internal to the uniter for this unit.
*/
setState(params) {
return new Promise((resolve, reject) => {
const req = {
type: "MeterStatus",
request: "SetState",
version: 2,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
State returns the state persisted by the charm running in this unit
and the state internal to the uniter for this unit.
*/
state(params) {
return new Promise((resolve, reject) => {
const req = {
type: "MeterStatus",
request: "State",
version: 2,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
WatchMeterStatus returns a NotifyWatcher for observing changes
to each unit's meter status.
*/
watchMeterStatus(params) {
return new Promise((resolve, reject) => {
const req = {
type: "MeterStatus",
request: "WatchMeterStatus",
version: 2,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
}
MeterStatusV2.NAME = "MeterStatus";
MeterStatusV2.VERSION = 2;
export default MeterStatusV2;
//# sourceMappingURL=MeterStatusV2.js.map