2022-11-13 11:28:54 +00:00
/ * *
2023-11-22 17:30:42 +00:00
* Garage Administration API v0 + garage - v0 . 9.0
2022-11-13 11:28:54 +00:00
* 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 ! *
*
2023-11-22 17:30:42 +00:00
* The version of the OpenAPI document : v0 . 9.0
2022-11-13 11:28:54 +00:00
*
*
* 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
2023-11-22 17:30:42 +00:00
* @ version v0 . 9.0
2022-11-13 11:28:54 +00:00
* /
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 ;
}
/ * *
* 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
2022-11-13 11:56:24 +00:00
* @ return { Promise } a { @ link https : //www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<module:model/AddNode200ResponseInner>} and HTTP response
2022-11-13 11:28:54 +00:00
* /
2022-11-13 11:56:24 +00:00
addNodeWithHttpInfo ( requestBody ) {
2022-11-13 11:28:54 +00:00
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 ,
2022-11-13 11:56:24 +00:00
authNames , contentTypes , accepts , returnType , null
2022-11-13 11:28:54 +00:00
) ;
}
/ * *
2022-11-13 11:56:24 +00:00
* 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
* @ return { Promise } a { @ link https : //www.promisejs.org/|Promise}, with data of type {@link Array.<module:model/AddNode200ResponseInner>}
2022-11-13 11:28:54 +00:00
* /
2022-11-13 11:56:24 +00:00
addNode ( requestBody ) {
return this . addNodeWithHttpInfo ( requestBody )
. then ( function ( response _and _data ) {
return response _and _data . data ;
} ) ;
}
2022-11-13 11:28:54 +00:00
/ * *
* Status of this node and other nodes in the cluster
2023-11-22 17:30:42 +00:00
* 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 * Capacity is given in bytes *
2022-11-13 11:56:24 +00:00
* @ return { Promise } a { @ link https : //www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetNodes200Response} and HTTP response
2022-11-13 11:28:54 +00:00
* /
2022-11-13 11:56:24 +00:00
getNodesWithHttpInfo ( ) {
2022-11-13 11:28:54 +00:00
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 ,
2022-11-13 11:56:24 +00:00
authNames , contentTypes , accepts , returnType , null
2022-11-13 11:28:54 +00:00
) ;
}
2022-11-13 11:56:24 +00:00
/ * *
* Status of this node and other nodes in the cluster
2023-11-22 17:30:42 +00:00
* 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 * Capacity is given in bytes *
2022-11-13 11:56:24 +00:00
* @ return { Promise } a { @ link https : //www.promisejs.org/|Promise}, with data of type {@link module:model/GetNodes200Response}
* /
getNodes ( ) {
return this . getNodesWithHttpInfo ( )
. then ( function ( response _and _data ) {
return response _and _data . data ;
} ) ;
}
2022-11-13 11:28:54 +00:00
}