@canonical/jujulib
Version:
Juju API client
60 lines (59 loc) • 1.8 kB
JavaScript
/**
Juju LeadershipService 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";
/**
LeadershipService implements a variant of leadership.Claimer for consumption
over the API.
*/
class LeadershipServiceV2 {
constructor(transport, info) {
this.NAME = "LeadershipService";
this.VERSION = 2;
this._transport = transport;
this._info = info;
// Automatically bind all methods to instances.
autoBind(this);
}
/**
BlockUntilLeadershipReleased blocks the caller until leadership is
released for the given service.
*/
blockUntilLeadershipReleased(params) {
return new Promise((resolve, reject) => {
const req = {
type: "LeadershipService",
request: "BlockUntilLeadershipReleased",
version: 2,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
ClaimLeadership makes a leadership claim with the given parameters.
*/
claimLeadership(params) {
return new Promise((resolve, reject) => {
const req = {
type: "LeadershipService",
request: "ClaimLeadership",
version: 2,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
}
LeadershipServiceV2.NAME = "LeadershipService";
LeadershipServiceV2.VERSION = 2;
export default LeadershipServiceV2;
//# sourceMappingURL=LeadershipServiceV2.js.map