200 lines
6.7 KiB
Markdown
200 lines
6.7 KiB
Markdown
# garage.LayoutApi
|
|
|
|
All URIs are relative to *http://localhost:3903/v0*
|
|
|
|
Method | HTTP request | Description
|
|
------------- | ------------- | -------------
|
|
[**addLayout**](LayoutApi.md#addLayout) | **POST** /layout | Send modifications to the cluster layout
|
|
[**applyLayout**](LayoutApi.md#applyLayout) | **POST** /layout/apply | Apply staged layout
|
|
[**getLayout**](LayoutApi.md#getLayout) | **GET** /layout | Details on the current and staged layout
|
|
[**revertLayout**](LayoutApi.md#revertLayout) | **POST** /layout/revert | Clear staged layout
|
|
|
|
|
|
|
|
## addLayout
|
|
|
|
> addLayout(requestBody)
|
|
|
|
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.
|
|
|
|
### Example
|
|
|
|
```javascript
|
|
import garage from 'garage_administration_api_v0garage_v0_8_0';
|
|
let defaultClient = garage.ApiClient.instance;
|
|
// Configure Bearer access token for authorization: bearerAuth
|
|
let bearerAuth = defaultClient.authentications['bearerAuth'];
|
|
bearerAuth.accessToken = "YOUR ACCESS TOKEN"
|
|
|
|
let apiInstance = new garage.LayoutApi();
|
|
let requestBody = {key: new garage.NodeClusterInfo()}; // {String: NodeClusterInfo} | 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.
|
|
apiInstance.addLayout(requestBody).then(() => {
|
|
console.log('API called successfully.');
|
|
}, (error) => {
|
|
console.error(error);
|
|
});
|
|
|
|
```
|
|
|
|
### Parameters
|
|
|
|
|
|
Name | Type | Description | Notes
|
|
------------- | ------------- | ------------- | -------------
|
|
**requestBody** | [**{String: NodeClusterInfo}**](NodeClusterInfo.md)| 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. |
|
|
|
|
### Return type
|
|
|
|
null (empty response body)
|
|
|
|
### Authorization
|
|
|
|
[bearerAuth](../README.md#bearerAuth)
|
|
|
|
### HTTP request headers
|
|
|
|
- **Content-Type**: application/json
|
|
- **Accept**: Not defined
|
|
|
|
|
|
## applyLayout
|
|
|
|
> applyLayout(layoutVersion)
|
|
|
|
Apply staged layout
|
|
|
|
Applies to the cluster the layout changes currently registered as staged layout changes.
|
|
|
|
### Example
|
|
|
|
```javascript
|
|
import garage from 'garage_administration_api_v0garage_v0_8_0';
|
|
let defaultClient = garage.ApiClient.instance;
|
|
// Configure Bearer access token for authorization: bearerAuth
|
|
let bearerAuth = defaultClient.authentications['bearerAuth'];
|
|
bearerAuth.accessToken = "YOUR ACCESS TOKEN"
|
|
|
|
let apiInstance = new garage.LayoutApi();
|
|
let layoutVersion = new garage.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.
|
|
apiInstance.applyLayout(layoutVersion).then(() => {
|
|
console.log('API called successfully.');
|
|
}, (error) => {
|
|
console.error(error);
|
|
});
|
|
|
|
```
|
|
|
|
### Parameters
|
|
|
|
|
|
Name | Type | Description | Notes
|
|
------------- | ------------- | ------------- | -------------
|
|
**layoutVersion** | [**LayoutVersion**](LayoutVersion.md)| 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. |
|
|
|
|
### Return type
|
|
|
|
null (empty response body)
|
|
|
|
### Authorization
|
|
|
|
[bearerAuth](../README.md#bearerAuth)
|
|
|
|
### HTTP request headers
|
|
|
|
- **Content-Type**: application/json
|
|
- **Accept**: Not defined
|
|
|
|
|
|
## getLayout
|
|
|
|
> ClusterLayout getLayout()
|
|
|
|
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`.*
|
|
|
|
### Example
|
|
|
|
```javascript
|
|
import garage from 'garage_administration_api_v0garage_v0_8_0';
|
|
let defaultClient = garage.ApiClient.instance;
|
|
// Configure Bearer access token for authorization: bearerAuth
|
|
let bearerAuth = defaultClient.authentications['bearerAuth'];
|
|
bearerAuth.accessToken = "YOUR ACCESS TOKEN"
|
|
|
|
let apiInstance = new garage.LayoutApi();
|
|
apiInstance.getLayout().then((data) => {
|
|
console.log('API called successfully. Returned data: ' + data);
|
|
}, (error) => {
|
|
console.error(error);
|
|
});
|
|
|
|
```
|
|
|
|
### Parameters
|
|
|
|
This endpoint does not need any parameter.
|
|
|
|
### Return type
|
|
|
|
[**ClusterLayout**](ClusterLayout.md)
|
|
|
|
### Authorization
|
|
|
|
[bearerAuth](../README.md#bearerAuth)
|
|
|
|
### HTTP request headers
|
|
|
|
- **Content-Type**: Not defined
|
|
- **Accept**: application/json
|
|
|
|
|
|
## revertLayout
|
|
|
|
> revertLayout(layoutVersion)
|
|
|
|
Clear staged layout
|
|
|
|
Clears all of the staged layout changes.
|
|
|
|
### Example
|
|
|
|
```javascript
|
|
import garage from 'garage_administration_api_v0garage_v0_8_0';
|
|
let defaultClient = garage.ApiClient.instance;
|
|
// Configure Bearer access token for authorization: bearerAuth
|
|
let bearerAuth = defaultClient.authentications['bearerAuth'];
|
|
bearerAuth.accessToken = "YOUR ACCESS TOKEN"
|
|
|
|
let apiInstance = new garage.LayoutApi();
|
|
let layoutVersion = new garage.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.
|
|
apiInstance.revertLayout(layoutVersion).then(() => {
|
|
console.log('API called successfully.');
|
|
}, (error) => {
|
|
console.error(error);
|
|
});
|
|
|
|
```
|
|
|
|
### Parameters
|
|
|
|
|
|
Name | Type | Description | Notes
|
|
------------- | ------------- | ------------- | -------------
|
|
**layoutVersion** | [**LayoutVersion**](LayoutVersion.md)| 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. |
|
|
|
|
### Return type
|
|
|
|
null (empty response body)
|
|
|
|
### Authorization
|
|
|
|
[bearerAuth](../README.md#bearerAuth)
|
|
|
|
### HTTP request headers
|
|
|
|
- **Content-Type**: application/json
|
|
- **Accept**: Not defined
|
|
|