ravendb
Version:
RavenDB client for Node.js
54 lines • 1.61 kB
JavaScript
import { throwError } from "../../../Exceptions/index.js";
import { RavenCommand } from "../../../Http/RavenCommand.js";
export class GetServerWideBackupConfigurationOperation {
_name;
constructor(name) {
if (!name) {
throwError("InvalidArgumentException", "Name cannot be null");
}
this._name = name;
}
getCommand(conventions) {
return new GetServerWideBackupConfigurationCommand(this._name);
}
get resultType() {
return "CommandResult";
}
}
class GetServerWideBackupConfigurationCommand extends RavenCommand {
_name;
constructor(name) {
super();
if (!name) {
throwError("InvalidArgumentException", "Name cannot be null");
}
this._name = name;
}
get isReadRequest() {
return true;
}
createRequest(node) {
const uri = node.url + "/admin/configuration/server-wide/tasks?type=Backup&name=" + encodeURIComponent(this._name);
return {
method: "GET",
uri
};
}
async setResponseAsync(bodyStream, fromCache) {
if (!bodyStream) {
return;
}
let body = null;
const result = await this._defaultPipeline(_ => body = _).process(bodyStream);
const results = result.results;
if (results.length === 0) {
return body;
}
if (results.length > 1) {
this._throwInvalidResponse();
}
this.result = results[0];
return body;
}
}
//# sourceMappingURL=GetServerWideBackupConfigurationOperation.js.map