@canonical/jujulib
Version:
Juju API client
149 lines (148 loc) • 4.56 kB
JavaScript
/**
Juju Charms version 7.
This facade is available on:
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";
/**
APIv7 provides the Charms API facade for version 7.
v7 guarantees SupportedBases will be provided in ResolveCharms
*/
class CharmsV7 {
constructor(transport, info) {
this.NAME = "Charms";
this.VERSION = 7;
this._transport = transport;
this._info = info;
// Automatically bind all methods to instances.
autoBind(this);
}
/**
AddCharm adds the given charm URL (which must include revision) to the
environment, if it does not exist yet. Local charms are not supported,
only charm store and charm hub URLs. See also AddLocalCharm().
*/
addCharm(params) {
return new Promise((resolve, reject) => {
const req = {
type: "Charms",
request: "AddCharm",
version: 7,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
CharmInfo returns information about the requested charm.
*/
charmInfo(params) {
return new Promise((resolve, reject) => {
const req = {
type: "Charms",
request: "CharmInfo",
version: 7,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
CheckCharmPlacement checks if a charm is allowed to be placed with in a
given application.
*/
checkCharmPlacement(params) {
return new Promise((resolve, reject) => {
const req = {
type: "Charms",
request: "CheckCharmPlacement",
version: 7,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
GetDownloadInfos attempts to get the bundle corresponding to the charm url
and origin.
*/
getDownloadInfos(params) {
return new Promise((resolve, reject) => {
const req = {
type: "Charms",
request: "GetDownloadInfos",
version: 7,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
IsMetered returns whether or not the charm is metered.
TODO (cderici) only used for metered charms in cmd MeteredDeployAPI,
kept for client compatibility, remove in juju 4.0
*/
isMetered(params) {
return new Promise((resolve, reject) => {
const req = {
type: "Charms",
request: "IsMetered",
version: 7,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
List returns a list of charm URLs currently in the state.
If supplied parameter contains any names, the result will
be filtered to return only the charms with supplied names.
*/
list(params) {
return new Promise((resolve, reject) => {
const req = {
type: "Charms",
request: "List",
version: 7,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
ListCharmResources returns a series of resources for a given charm.
*/
listCharmResources(params) {
return new Promise((resolve, reject) => {
const req = {
type: "Charms",
request: "ListCharmResources",
version: 7,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
ResolveCharms resolves the given charm URLs with an optionally specified
preferred channel. Channel provided via CharmOrigin.
*/
resolveCharms(params) {
return new Promise((resolve, reject) => {
const req = {
type: "Charms",
request: "ResolveCharms",
version: 7,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
}
CharmsV7.NAME = "Charms";
CharmsV7.VERSION = 7;
export default CharmsV7;
//# sourceMappingURL=CharmsV7.js.map