ravendb
Version:
RavenDB client for Node.js
55 lines • 2.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReplaceClusterCertificateOperation = void 0;
const index_js_1 = require("../../../Exceptions/index.js");
const RavenCommand_js_1 = require("../../../Http/RavenCommand.js");
const RaftIdGenerator_js_1 = require("../../../Utility/RaftIdGenerator.js");
class ReplaceClusterCertificateOperation {
_certBytes;
_replaceImmediately;
constructor(certBytes, replaceImmediately) {
if (!certBytes) {
(0, index_js_1.throwError)("InvalidArgumentException", "CertBytes cannot be null");
}
this._certBytes = certBytes;
this._replaceImmediately = replaceImmediately;
}
get resultType() {
return "CommandResult";
}
getCommand(conventions) {
return new ReplaceClusterCertificateCommand(this._certBytes, this._replaceImmediately);
}
}
exports.ReplaceClusterCertificateOperation = ReplaceClusterCertificateOperation;
class ReplaceClusterCertificateCommand extends RavenCommand_js_1.RavenCommand {
_certBytes;
_replaceImmediately;
constructor(certBytes, replaceImmediately) {
super();
if (!certBytes) {
(0, index_js_1.throwError)("InvalidArgumentException", "CertBytes cannot be null");
}
this._certBytes = certBytes;
this._replaceImmediately = replaceImmediately;
}
get isReadRequest() {
return false;
}
createRequest(node) {
const uri = node.url + "/admin/certificates/replace-cluster-cert?replaceImmediately=" + (this._replaceImmediately ? "true" : "false");
const body = this._serializer.serialize({
Certificate: this._certBytes.toString("base64")
});
return {
uri,
method: "POST",
headers: this._headers().typeAppJson().build(),
body
};
}
getRaftUniqueRequestId() {
return RaftIdGenerator_js_1.RaftIdGenerator.newId();
}
}
//# sourceMappingURL=ReplaceClusterCertificateOperation.js.map