@devopness/sdk-js
Version:
Devopness API JS/TS SDK - Painless essential DevOps to everyone
211 lines (210 loc) • 10.4 kB
JavaScript
/* eslint-disable */
/**
* devopness API
* Devopness API - Painless essential DevOps to everyone
*
* The version of the OpenAPI document: latest
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DaemonsApiService = void 0;
const ApiBaseService_1 = require("../../../services/ApiBaseService");
const ApiResponse_1 = require("../../../common/ApiResponse");
const Exceptions_1 = require("../../../common/Exceptions");
/**
* DaemonsApiService - Auto-generated
*/
class DaemonsApiService extends ApiBaseService_1.ApiBaseService {
/**
*
* @summary Add a Daemon to the given environment
* @param {number} environmentId The ID of the environment.
* @param {DaemonEnvironmentCreate} daemonEnvironmentCreate A JSON object containing the resource data
*/
addEnvironmentDaemon(environmentId, daemonEnvironmentCreate) {
return __awaiter(this, void 0, void 0, function* () {
if (environmentId === null || environmentId === undefined) {
throw new Exceptions_1.ArgumentNullException('environmentId', 'addEnvironmentDaemon');
}
if (daemonEnvironmentCreate === null || daemonEnvironmentCreate === undefined) {
throw new Exceptions_1.ArgumentNullException('daemonEnvironmentCreate', 'addEnvironmentDaemon');
}
let queryString = '';
const requestUrl = '/environments/{environment_id}/daemons' + (queryString ? `?${queryString}` : '');
const response = yield this.post(requestUrl.replace(`{${"environment_id"}}`, encodeURIComponent(String(environmentId))), daemonEnvironmentCreate);
return new ApiResponse_1.ApiResponse(response);
});
}
/**
*
* @summary Delete a given Daemon
* @param {number} daemonId The ID of the daemon.
*/
deleteDaemon(daemonId) {
return __awaiter(this, void 0, void 0, function* () {
if (daemonId === null || daemonId === undefined) {
throw new Exceptions_1.ArgumentNullException('daemonId', 'deleteDaemon');
}
let queryString = '';
const requestUrl = '/daemons/{daemon_id}' + (queryString ? `?${queryString}` : '');
const response = yield this.delete(requestUrl.replace(`{${"daemon_id"}}`, encodeURIComponent(String(daemonId))));
return new ApiResponse_1.ApiResponse(response);
});
}
/**
*
* @summary Get a Daemon by ID
* @param {number} daemonId The ID of the daemon.
*/
getDaemon(daemonId) {
return __awaiter(this, void 0, void 0, function* () {
if (daemonId === null || daemonId === undefined) {
throw new Exceptions_1.ArgumentNullException('daemonId', 'getDaemon');
}
let queryString = '';
const requestUrl = '/daemons/{daemon_id}' + (queryString ? `?${queryString}` : '');
const response = yield this.get(requestUrl.replace(`{${"daemon_id"}}`, encodeURIComponent(String(daemonId))));
return new ApiResponse_1.ApiResponse(response);
});
}
/**
*
* @summary Get current status of a daemon
* @param {number} daemonId The ID of the daemon.
* @param {DaemonGetStatus} daemonGetStatus A JSON object containing the resource data
*/
getStatusDaemon(daemonId, daemonGetStatus) {
return __awaiter(this, void 0, void 0, function* () {
if (daemonId === null || daemonId === undefined) {
throw new Exceptions_1.ArgumentNullException('daemonId', 'getStatusDaemon');
}
if (daemonGetStatus === null || daemonGetStatus === undefined) {
throw new Exceptions_1.ArgumentNullException('daemonGetStatus', 'getStatusDaemon');
}
let queryString = '';
const requestUrl = '/daemons/{daemon_id}/get-status' + (queryString ? `?${queryString}` : '');
const response = yield this.post(requestUrl.replace(`{${"daemon_id"}}`, encodeURIComponent(String(daemonId))), daemonGetStatus);
return new ApiResponse_1.ApiResponse(response);
});
}
/**
*
* @summary Return a list of all Daemons belonging to an environment
* @param {number} environmentId The ID of the environment.
* @param {number} [page] Number of the page to be retrieved
* @param {number} [perPage] Number of items returned per page
*/
listEnvironmentDaemons(environmentId, page, perPage) {
return __awaiter(this, void 0, void 0, function* () {
if (environmentId === null || environmentId === undefined) {
throw new Exceptions_1.ArgumentNullException('environmentId', 'listEnvironmentDaemons');
}
let queryString = '';
const queryParams = { page: page, per_page: perPage, };
for (const key in queryParams) {
if (queryParams[key] === undefined || queryParams[key] === null) {
continue;
}
queryString += (queryString ? '&' : '') + `${key}=${encodeURI(queryParams[key])}`;
}
const requestUrl = '/environments/{environment_id}/daemons' + (queryString ? `?${queryString}` : '');
const response = yield this.get(requestUrl.replace(`{${"environment_id"}}`, encodeURIComponent(String(environmentId))));
return new ApiResponse_1.ApiResponse(response);
});
}
/**
*
* @summary Restart a Daemon
* @param {number} daemonId The ID of the daemon.
* @param {DaemonRestart} daemonRestart A JSON object containing the resource data
*/
restartDaemon(daemonId, daemonRestart) {
return __awaiter(this, void 0, void 0, function* () {
if (daemonId === null || daemonId === undefined) {
throw new Exceptions_1.ArgumentNullException('daemonId', 'restartDaemon');
}
if (daemonRestart === null || daemonRestart === undefined) {
throw new Exceptions_1.ArgumentNullException('daemonRestart', 'restartDaemon');
}
let queryString = '';
const requestUrl = '/daemons/{daemon_id}/restart' + (queryString ? `?${queryString}` : '');
const response = yield this.post(requestUrl.replace(`{${"daemon_id"}}`, encodeURIComponent(String(daemonId))), daemonRestart);
return new ApiResponse_1.ApiResponse(response);
});
}
/**
*
* @summary Start a Daemon
* @param {number} daemonId The ID of the daemon.
* @param {DaemonStart} daemonStart A JSON object containing the resource data
*/
startDaemon(daemonId, daemonStart) {
return __awaiter(this, void 0, void 0, function* () {
if (daemonId === null || daemonId === undefined) {
throw new Exceptions_1.ArgumentNullException('daemonId', 'startDaemon');
}
if (daemonStart === null || daemonStart === undefined) {
throw new Exceptions_1.ArgumentNullException('daemonStart', 'startDaemon');
}
let queryString = '';
const requestUrl = '/daemons/{daemon_id}/start' + (queryString ? `?${queryString}` : '');
const response = yield this.post(requestUrl.replace(`{${"daemon_id"}}`, encodeURIComponent(String(daemonId))), daemonStart);
return new ApiResponse_1.ApiResponse(response);
});
}
/**
*
* @summary Stop a Daemon
* @param {number} daemonId The ID of the daemon.
* @param {DaemonStop} daemonStop A JSON object containing the resource data
*/
stopDaemon(daemonId, daemonStop) {
return __awaiter(this, void 0, void 0, function* () {
if (daemonId === null || daemonId === undefined) {
throw new Exceptions_1.ArgumentNullException('daemonId', 'stopDaemon');
}
if (daemonStop === null || daemonStop === undefined) {
throw new Exceptions_1.ArgumentNullException('daemonStop', 'stopDaemon');
}
let queryString = '';
const requestUrl = '/daemons/{daemon_id}/stop' + (queryString ? `?${queryString}` : '');
const response = yield this.post(requestUrl.replace(`{${"daemon_id"}}`, encodeURIComponent(String(daemonId))), daemonStop);
return new ApiResponse_1.ApiResponse(response);
});
}
/**
*
* @summary Update an existing Daemon
* @param {number} daemonId The ID of the daemon.
* @param {DaemonUpdate} daemonUpdate A JSON object containing the resource data
*/
updateDaemon(daemonId, daemonUpdate) {
return __awaiter(this, void 0, void 0, function* () {
if (daemonId === null || daemonId === undefined) {
throw new Exceptions_1.ArgumentNullException('daemonId', 'updateDaemon');
}
if (daemonUpdate === null || daemonUpdate === undefined) {
throw new Exceptions_1.ArgumentNullException('daemonUpdate', 'updateDaemon');
}
let queryString = '';
const requestUrl = '/daemons/{daemon_id}' + (queryString ? `?${queryString}` : '');
const response = yield this.put(requestUrl.replace(`{${"daemon_id"}}`, encodeURIComponent(String(daemonId))), daemonUpdate);
return new ApiResponse_1.ApiResponse(response);
});
}
}
exports.DaemonsApiService = DaemonsApiService;
;