@canonical/jujulib
Version:
Juju API client
148 lines (147 loc) • 4.45 kB
JavaScript
/**
Juju Charms version 6.
This facade is available on:
Models
NOTE: This file was generated using the Juju schema
from Juju 3.2 at the git SHA 3a098707a1.
Do not manually edit this file.
*/
import { autoBind } from "../../utils.js";
/**
APIv6 provides the Charms API facade for version 6.
It removes the AddCharmWithAuthorization function, as
we no longer support macaroons.
*/
class CharmsV6 {
constructor(transport, info) {
this.NAME = "Charms";
this.VERSION = 6;
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: 6,
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: 6,
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: 6,
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: 6,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
IsMetered returns whether or not the charm is metered.
*/
isMetered(params) {
return new Promise((resolve, reject) => {
const req = {
type: "Charms",
request: "IsMetered",
version: 6,
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: 6,
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: 6,
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: 6,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
}
CharmsV6.NAME = "Charms";
CharmsV6.VERSION = 6;
export default CharmsV6;
//# sourceMappingURL=CharmsV6.js.map