ravendb
Version:
RavenDB client for Node.js
76 lines • 2.73 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EditClientCertificateOperation = void 0;
const index_js_1 = require("../../../Exceptions/index.js");
const RaftIdGenerator_js_1 = require("../../../Utility/RaftIdGenerator.js");
const RavenCommand_js_1 = require("../../../Http/RavenCommand.js");
class EditClientCertificateOperation {
_thumbprint;
_permissions;
_name;
_clearance;
constructor(parameters) {
if (!parameters) {
(0, index_js_1.throwError)("InvalidArgumentException", "Parameters cannot be null");
}
if (!parameters.name) {
(0, index_js_1.throwError)("InvalidArgumentException", "Name cannot be null");
}
if (!parameters.thumbprint) {
(0, index_js_1.throwError)("InvalidArgumentException", "Thumbprint cannot be null");
}
if (!parameters.permissions) {
(0, index_js_1.throwError)("InvalidArgumentException", "Permissions cannot be null");
}
if (!parameters.clearance) {
(0, index_js_1.throwError)("InvalidArgumentException", "Clearance cannot be null");
}
this._name = parameters.name;
this._thumbprint = parameters.thumbprint;
this._permissions = parameters.permissions;
this._clearance = parameters.clearance;
}
get resultType() {
return "CommandResult";
}
getCommand(conventions) {
return new EditClientCertificateCommand(this._thumbprint, this._name, this._permissions, this._clearance);
}
}
exports.EditClientCertificateOperation = EditClientCertificateOperation;
class EditClientCertificateCommand extends RavenCommand_js_1.RavenCommand {
_thumbprint;
_permissions;
_name;
_clearance;
constructor(thumbprint, name, permissions, clearance) {
super();
this._thumbprint = thumbprint;
this._name = name;
this._permissions = permissions;
this._clearance = clearance;
}
get isReadRequest() {
return false;
}
createRequest(node) {
const uri = node.url + "/admin/certificates/edit";
const definition = {
thumbprint: this._thumbprint,
permissions: this._permissions,
securityClearance: this._clearance,
name: this._name
};
const body = this._serializer.serialize(definition);
return {
method: "POST",
uri,
headers: this._headers().typeAppJson().build(),
body
};
}
getRaftUniqueRequestId() {
return RaftIdGenerator_js_1.RaftIdGenerator.newId();
}
}
//# sourceMappingURL=EditClientCertificateOperation.js.map