@canonical/jujulib
Version:
Juju API client
166 lines (164 loc) • 5.15 kB
JavaScript
/**
Juju Charms version 4.
This facade is available on:
Models
NOTE: This file was generated using the Juju schema
from Juju 3.0-beta4 at the git SHA a13ab81a.
Do not manually edit this file.
*/
import { autoBind } from "../../utils.js";
/**
API implements the charms interface and is the concrete
implementation of the API end point.
*/
class CharmsV4 {
constructor(transport, info) {
this.NAME = "Charms";
this.VERSION = 4;
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: 4,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
AddCharmWithAuthorization 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().
The authorization macaroon, args.CharmStoreMacaroon, may be
omitted, in which case this call is equivalent to AddCharm.
*/
addCharmWithAuthorization(params) {
return new Promise((resolve, reject) => {
const req = {
type: "Charms",
request: "AddCharmWithAuthorization",
version: 4,
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: 4,
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: 4,
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: 4,
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: 4,
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: 4,
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: 4,
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: 4,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
}
CharmsV4.NAME = "Charms";
CharmsV4.VERSION = 4;
export default CharmsV4;
//# sourceMappingURL=CharmsV4.js.map