garage-admin-sdk-js/src/api/NodesApi.js

119 lines
4.4 KiB
JavaScript

/**
* Garage Administration API v0+garage-v0.8.0
* Administrate your Garage cluster programatically, including status, layout, keys, buckets, and maintainance tasks. *Disclaimer: The API is not stable yet, hence its v0 tag. The API can change at any time, and changes can include breaking backward compatibility. Read the changelog and upgrade your scripts before upgrading. Additionnaly, this specification is very early stage and can contain bugs, especially on error return codes/types that are not tested yet. Do not expect a well finished and polished product!*
*
* The version of the OpenAPI document: v0.8.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 AddNode200ResponseInner from '../model/AddNode200ResponseInner';
import GetNodes200Response from '../model/GetNodes200Response';
/**
* Nodes service.
* @module api/NodesApi
* @version v0.8.0
*/
export default class NodesApi {
/**
* Constructs a new NodesApi.
* @alias module:api/NodesApi
* @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;
}
/**
* Callback function to receive the result of the addNode operation.
* @callback module:api/NodesApi~addNodeCallback
* @param {String} error Error message, if any.
* @param {Array.<module:model/AddNode200ResponseInner>} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Connect target node to other Garage nodes
* Instructs this Garage node to connect to other Garage nodes at specified `<node_id>@<net_address>`. `node_id` is generated automatically on node start.
* @param {Array.<String>} requestBody
* @param {module:api/NodesApi~addNodeCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link Array.<module:model/AddNode200ResponseInner>}
*/
addNode(requestBody, callback) {
let postBody = requestBody;
// verify the required parameter 'requestBody' is set
if (requestBody === undefined || requestBody === null) {
throw new Error("Missing the required parameter 'requestBody' when calling addNode");
}
let pathParams = {
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = ['bearerAuth'];
let contentTypes = ['application/json'];
let accepts = ['application/json'];
let returnType = [AddNode200ResponseInner];
return this.apiClient.callApi(
'/connect', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback
);
}
/**
* Callback function to receive the result of the getNodes operation.
* @callback module:api/NodesApi~getNodesCallback
* @param {String} error Error message, if any.
* @param {module:model/GetNodes200Response} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Status of this node and other nodes in the cluster
* Returns the cluster's current status, including: - ID of the node being queried and its version of the Garage daemon - Live nodes - Currently configured cluster layout - Staged changes to the cluster layout
* @param {module:api/NodesApi~getNodesCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/GetNodes200Response}
*/
getNodes(callback) {
let postBody = null;
let pathParams = {
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = ['bearerAuth'];
let contentTypes = [];
let accepts = ['application/json'];
let returnType = GetNodes200Response;
return this.apiClient.callApi(
'/status', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback
);
}
}