UNPKG

ravendb

Version:
51 lines 1.77 kB
import { throwError } from "../../../Exceptions/index.js"; import { RavenCommand } from "../../../Http/RavenCommand.js"; import { RaftIdGenerator } from "../../../Utility/RaftIdGenerator.js"; export class ReplaceClusterCertificateOperation { _certBytes; _replaceImmediately; constructor(certBytes, replaceImmediately) { if (!certBytes) { 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); } } class ReplaceClusterCertificateCommand extends RavenCommand { _certBytes; _replaceImmediately; constructor(certBytes, replaceImmediately) { super(); if (!certBytes) { 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.newId(); } } //# sourceMappingURL=ReplaceClusterCertificateOperation.js.map