177 lines
5.4 KiB
JavaScript
177 lines
5.4 KiB
JavaScript
/**
|
|
* Flamenco manager
|
|
* Render Farm manager API
|
|
*
|
|
* The version of the OpenAPI document: 1.0.0
|
|
*
|
|
*
|
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
* https://openapi-generator.tech
|
|
* Do not edit the class manually.
|
|
*
|
|
*/
|
|
|
|
|
|
import ApiClient from "../ApiClient";
|
|
import Error from '../model/Error';
|
|
import Worker from '../model/Worker';
|
|
import WorkerList from '../model/WorkerList';
|
|
import WorkerStatusChangeRequest from '../model/WorkerStatusChangeRequest';
|
|
|
|
/**
|
|
* WorkerMgt service.
|
|
* @module manager/WorkerMgtApi
|
|
* @version 0.0.0
|
|
*/
|
|
export default class WorkerMgtApi {
|
|
|
|
/**
|
|
* Constructs a new WorkerMgtApi.
|
|
* @alias module:manager/WorkerMgtApi
|
|
* @class
|
|
* @param {module:ApiClient} [apiClient] Optional API client implementation to use,
|
|
* default to {@link module:ApiClient#instance} if unspecified.
|
|
*/
|
|
constructor(apiClient) {
|
|
this.apiClient = apiClient || ApiClient.instance;
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* Fetch info about the worker.
|
|
* @param {String} workerId
|
|
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Worker} and HTTP response
|
|
*/
|
|
fetchWorkerWithHttpInfo(workerId) {
|
|
let postBody = null;
|
|
// verify the required parameter 'workerId' is set
|
|
if (workerId === undefined || workerId === null) {
|
|
throw new Error("Missing the required parameter 'workerId' when calling fetchWorker");
|
|
}
|
|
|
|
let pathParams = {
|
|
'worker_id': workerId
|
|
};
|
|
let queryParams = {
|
|
};
|
|
let headerParams = {
|
|
};
|
|
let formParams = {
|
|
};
|
|
|
|
let authNames = [];
|
|
let contentTypes = [];
|
|
let accepts = ['application/json'];
|
|
let returnType = Worker;
|
|
return this.apiClient.callApi(
|
|
'/api/worker-mgt/workers/{worker_id}', 'GET',
|
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
authNames, contentTypes, accepts, returnType, null
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Fetch info about the worker.
|
|
* @param {String} workerId
|
|
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Worker}
|
|
*/
|
|
fetchWorker(workerId) {
|
|
return this.fetchWorkerWithHttpInfo(workerId)
|
|
.then(function(response_and_data) {
|
|
return response_and_data.data;
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* Get list of workers.
|
|
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/WorkerList} and HTTP response
|
|
*/
|
|
fetchWorkersWithHttpInfo() {
|
|
let postBody = null;
|
|
|
|
let pathParams = {
|
|
};
|
|
let queryParams = {
|
|
};
|
|
let headerParams = {
|
|
};
|
|
let formParams = {
|
|
};
|
|
|
|
let authNames = [];
|
|
let contentTypes = [];
|
|
let accepts = ['application/json'];
|
|
let returnType = WorkerList;
|
|
return this.apiClient.callApi(
|
|
'/api/worker-mgt/workers', 'GET',
|
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
authNames, contentTypes, accepts, returnType, null
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get list of workers.
|
|
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/WorkerList}
|
|
*/
|
|
fetchWorkers() {
|
|
return this.fetchWorkersWithHttpInfo()
|
|
.then(function(response_and_data) {
|
|
return response_and_data.data;
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* @param {String} workerId
|
|
* @param {module:model/WorkerStatusChangeRequest} workerStatusChangeRequest The status change to request.
|
|
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
|
|
*/
|
|
requestWorkerStatusChangeWithHttpInfo(workerId, workerStatusChangeRequest) {
|
|
let postBody = workerStatusChangeRequest;
|
|
// verify the required parameter 'workerId' is set
|
|
if (workerId === undefined || workerId === null) {
|
|
throw new Error("Missing the required parameter 'workerId' when calling requestWorkerStatusChange");
|
|
}
|
|
// verify the required parameter 'workerStatusChangeRequest' is set
|
|
if (workerStatusChangeRequest === undefined || workerStatusChangeRequest === null) {
|
|
throw new Error("Missing the required parameter 'workerStatusChangeRequest' when calling requestWorkerStatusChange");
|
|
}
|
|
|
|
let pathParams = {
|
|
'worker_id': workerId
|
|
};
|
|
let queryParams = {
|
|
};
|
|
let headerParams = {
|
|
};
|
|
let formParams = {
|
|
};
|
|
|
|
let authNames = [];
|
|
let contentTypes = ['application/json'];
|
|
let accepts = ['application/json'];
|
|
let returnType = null;
|
|
return this.apiClient.callApi(
|
|
'/api/worker-mgt/workers/{worker_id}/setstatus', 'POST',
|
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
authNames, contentTypes, accepts, returnType, null
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @param {String} workerId
|
|
* @param {module:model/WorkerStatusChangeRequest} workerStatusChangeRequest The status change to request.
|
|
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
|
|
*/
|
|
requestWorkerStatusChange(workerId, workerStatusChangeRequest) {
|
|
return this.requestWorkerStatusChangeWithHttpInfo(workerId, workerStatusChangeRequest)
|
|
.then(function(response_and_data) {
|
|
return response_and_data.data;
|
|
});
|
|
}
|
|
|
|
|
|
}
|