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

201 lines
8.2 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 ClusterLayout from '../model/ClusterLayout';
import LayoutVersion from '../model/LayoutVersion';
import NodeClusterInfo from '../model/NodeClusterInfo';
/**
* Layout service.
* @module api/LayoutApi
* @version v0.8.0
*/
export default class LayoutApi {
/**
* Constructs a new LayoutApi.
* @alias module:api/LayoutApi
* @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 addLayout operation.
* @callback module:api/LayoutApi~addLayoutCallback
* @param {String} error Error message, if any.
* @param data This operation does not return a value.
* @param {String} response The complete HTTP response.
*/
/**
* Send modifications to the cluster layout
* Send modifications to the cluster layout. These modifications will be included in the staged role changes, visible in subsequent calls of `GET /layout`. Once the set of staged changes is satisfactory, the user may call `POST /layout/apply` to apply the changed changes, or `POST /layout/revert` to clear all of the staged changes in the layout. Note that setting the capacity to `null` will configure the node as a gateway.
* @param {Object.<String, module:model/{String: NodeClusterInfo}>} requestBody To add a new node to the layout or to change the configuration of an existing node, simply set the values you want. To remove a node, set it to `null` instead of passing a configuration object. Contrary to the CLI that may update only a subset of the fields capacity, zone and tags, when calling this API all of these values must be specified.
* @param {module:api/LayoutApi~addLayoutCallback} callback The callback function, accepting three arguments: error, data, response
*/
addLayout(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 addLayout");
}
let pathParams = {
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = ['bearerAuth'];
let contentTypes = ['application/json'];
let accepts = [];
let returnType = null;
return this.apiClient.callApi(
'/layout', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback
);
}
/**
* Callback function to receive the result of the applyLayout operation.
* @callback module:api/LayoutApi~applyLayoutCallback
* @param {String} error Error message, if any.
* @param data This operation does not return a value.
* @param {String} response The complete HTTP response.
*/
/**
* Apply staged layout
* Applies to the cluster the layout changes currently registered as staged layout changes.
* @param {module:model/LayoutVersion} layoutVersion Similarly to the CLI, the body must include the version of the new layout that will be created, which MUST be 1 + the value of the currently existing layout in the cluster.
* @param {module:api/LayoutApi~applyLayoutCallback} callback The callback function, accepting three arguments: error, data, response
*/
applyLayout(layoutVersion, callback) {
let postBody = layoutVersion;
// verify the required parameter 'layoutVersion' is set
if (layoutVersion === undefined || layoutVersion === null) {
throw new Error("Missing the required parameter 'layoutVersion' when calling applyLayout");
}
let pathParams = {
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = ['bearerAuth'];
let contentTypes = ['application/json'];
let accepts = [];
let returnType = null;
return this.apiClient.callApi(
'/layout/apply', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback
);
}
/**
* Callback function to receive the result of the getLayout operation.
* @callback module:api/LayoutApi~getLayoutCallback
* @param {String} error Error message, if any.
* @param {module:model/ClusterLayout} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Details on the current and staged layout
* Returns the cluster's current layout, including: - Currently configured cluster layout - Staged changes to the cluster layout *The info returned by this endpoint is a subset of the info returned by `GET /status`.*
* @param {module:api/LayoutApi~getLayoutCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/ClusterLayout}
*/
getLayout(callback) {
let postBody = null;
let pathParams = {
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = ['bearerAuth'];
let contentTypes = [];
let accepts = ['application/json'];
let returnType = ClusterLayout;
return this.apiClient.callApi(
'/layout', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback
);
}
/**
* Callback function to receive the result of the revertLayout operation.
* @callback module:api/LayoutApi~revertLayoutCallback
* @param {String} error Error message, if any.
* @param data This operation does not return a value.
* @param {String} response The complete HTTP response.
*/
/**
* Clear staged layout
* Clears all of the staged layout changes.
* @param {module:model/LayoutVersion} layoutVersion Reverting the staged changes is done by incrementing the version number and clearing the contents of the staged change list. Similarly to the CLI, the body must include the incremented version number, which MUST be 1 + the value of the currently existing layout in the cluster.
* @param {module:api/LayoutApi~revertLayoutCallback} callback The callback function, accepting three arguments: error, data, response
*/
revertLayout(layoutVersion, callback) {
let postBody = layoutVersion;
// verify the required parameter 'layoutVersion' is set
if (layoutVersion === undefined || layoutVersion === null) {
throw new Error("Missing the required parameter 'layoutVersion' when calling revertLayout");
}
let pathParams = {
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = ['bearerAuth'];
let contentTypes = ['application/json'];
let accepts = [];
let returnType = null;
return this.apiClient.callApi(
'/layout/revert', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback
);
}
}