@canonical/jujulib
Version:
Juju API client
136 lines (135 loc) • 4.2 kB
JavaScript
/**
Juju UserManager version 2.
This facade is available on:
Controllers
NOTE: This file was generated using the Juju schema
from Juju 3.0-beta1 at the git SHA 61c87ab7e1.
Do not manually edit this file.
*/
import { autoBind } from "../../utils.js";
/**
UserManagerAPI implements the user manager interface and is the concrete
implementation of the api end point.
*/
class UserManagerV2 {
constructor(transport, info) {
this.NAME = "UserManager";
this.VERSION = 2;
this._transport = transport;
this._info = info;
// Automatically bind all methods to instances.
autoBind(this);
}
/**
AddUser adds a user with a username, and either a password or
a randomly generated secret key which will be returned.
*/
addUser(params) {
return new Promise((resolve, reject) => {
const req = {
type: "UserManager",
request: "AddUser",
version: 2,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
DisableUser disables one or more users. If the user is already disabled,
the action is considered a success.
*/
disableUser(params) {
return new Promise((resolve, reject) => {
const req = {
type: "UserManager",
request: "DisableUser",
version: 2,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
EnableUser enables one or more users. If the user is already enabled,
the action is considered a success.
*/
enableUser(params) {
return new Promise((resolve, reject) => {
const req = {
type: "UserManager",
request: "EnableUser",
version: 2,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
RemoveUser permanently removes a user from the current controller for each
entity provided. While the user is permanently removed we keep it's
information around for auditing purposes.
TODO(redir): Add information about getting deleted user information when we
add that capability.
*/
removeUser(params) {
return new Promise((resolve, reject) => {
const req = {
type: "UserManager",
request: "RemoveUser",
version: 2,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
ResetPassword resets password for supplied users by
invalidating current passwords (if any) and generating
new random secret keys which will be returned.
Users cannot reset their own password.
*/
resetPassword(params) {
return new Promise((resolve, reject) => {
const req = {
type: "UserManager",
request: "ResetPassword",
version: 2,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
SetPassword changes the stored password for the specified users.
*/
setPassword(params) {
return new Promise((resolve, reject) => {
const req = {
type: "UserManager",
request: "SetPassword",
version: 2,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
UserInfo returns information on a user.
*/
userInfo(params) {
return new Promise((resolve, reject) => {
const req = {
type: "UserManager",
request: "UserInfo",
version: 2,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
}
UserManagerV2.NAME = "UserManager";
UserManagerV2.VERSION = 2;
export default UserManagerV2;
//# sourceMappingURL=UserManagerV2.js.map