UNPKG

@configurator/ravendb

Version:
71 lines 2.62 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PutClientCertificateOperation = void 0; const Exceptions_1 = require("../../../Exceptions"); const HttpUtil_1 = require("../../../Utility/HttpUtil"); const RavenCommand_1 = require("../../../Http/RavenCommand"); const RaftIdGenerator_1 = require("../../../Utility/RaftIdGenerator"); class PutClientCertificateOperation { constructor(name, certificate, permissions, clearance) { if (!certificate) { (0, Exceptions_1.throwError)("InvalidArgumentException", "Certificate cannot be null"); } if (!permissions) { (0, Exceptions_1.throwError)("InvalidArgumentException", "Permissions cannot be null."); } if (!name) { (0, Exceptions_1.throwError)("InvalidArgumentException", "Name cannot be null"); } this._certificate = certificate; this._permissions = permissions; this._name = name; this._clearance = clearance; } get resultType() { return "CommandResult"; } getCommand(conventions) { return new PutClientCertificateCommand(this._name, this._certificate, this._permissions, this._clearance); } } exports.PutClientCertificateOperation = PutClientCertificateOperation; class PutClientCertificateCommand extends RavenCommand_1.RavenCommand { constructor(name, certificate, permissions, clearance) { super(); if (!certificate) { (0, Exceptions_1.throwError)("InvalidArgumentException", "Certificate cannot be null"); } if (!permissions) { (0, Exceptions_1.throwError)("InvalidArgumentException", "Permissions cannot be null."); } this._certificate = certificate; this._permissions = permissions; this._name = name; this._clearance = clearance; } 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, }); return { uri, method: "PUT", headers: (0, HttpUtil_1.getHeaders)() .typeAppJson() .build(), body }; } getRaftUniqueRequestId() { return RaftIdGenerator_1.RaftIdGenerator.newId(); } } //# sourceMappingURL=PutClientCertificateOperation.js.map