UNPKG

ravendb

Version:
80 lines 2.81 kB
import { throwError } from "../../../Exceptions/index.js"; import { getHeaders } from "../../../Utility/HttpUtil.js"; import { RavenCommand } from "../../../Http/RavenCommand.js"; import { RaftIdGenerator } from "../../../Utility/RaftIdGenerator.js"; export class PutClientCertificateOperation { _certificate; _permissions; _name; _clearance; _twoFactorAuthenticationKey; constructor(name, certificate, permissions, clearance, twoFactorAuthenticationKey) { if (!certificate) { throwError("InvalidArgumentException", "Certificate cannot be null"); } if (!permissions) { throwError("InvalidArgumentException", "Permissions cannot be null."); } if (!name) { throwError("InvalidArgumentException", "Name cannot be null"); } this._certificate = certificate; this._permissions = permissions; this._name = name; this._clearance = clearance; this._twoFactorAuthenticationKey = twoFactorAuthenticationKey; } get resultType() { return "CommandResult"; } getCommand(conventions) { return new PutClientCertificateCommand(this._name, this._certificate, this._permissions, this._clearance, this._twoFactorAuthenticationKey); } } class PutClientCertificateCommand extends RavenCommand { _certificate; _permissions; _name; _clearance; _twoFactorAuthenticationKey; constructor(name, certificate, permissions, clearance, twoFactorAuthenticationKey) { super(); if (!certificate) { throwError("InvalidArgumentException", "Certificate cannot be null"); } if (!permissions) { throwError("InvalidArgumentException", "Permissions cannot be null."); } this._certificate = certificate; this._permissions = permissions; this._name = name; this._clearance = clearance; this._twoFactorAuthenticationKey = twoFactorAuthenticationKey; } get isReadRequest() { return false; } createRequest(node) { const uri = node.url + "/admin/certificates"; const body = this._serializer .serialize({ Name: this._name, Certificate: this._certificate, SecurityClearance: this._clearance, Permissions: this._permissions, TwoFactorAuthenticationKey: this._twoFactorAuthenticationKey ?? undefined }); return { uri, method: "PUT", headers: getHeaders() .typeAppJson() .build(), body }; } getRaftUniqueRequestId() { return RaftIdGenerator.newId(); } } //# sourceMappingURL=PutClientCertificateOperation.js.map