garage-admin-sdk-generator/python/docs/LayoutApi.md

331 lines
12 KiB
Markdown
Raw Normal View History

2022-09-13 14:00:03 +00:00
# garage_admin_sdk.LayoutApi
2022-09-12 15:02:35 +00:00
All URIs are relative to *http://localhost:3903/v0*
Method | HTTP request | Description
------------- | ------------- | -------------
[**add_layout**](LayoutApi.md#add_layout) | **POST** /layout | Send modifications to the cluster layout
[**apply_layout**](LayoutApi.md#apply_layout) | **POST** /layout/apply | Apply staged layout
[**get_layout**](LayoutApi.md#get_layout) | **GET** /layout | Details on the current and staged layout
[**revert_layout**](LayoutApi.md#revert_layout) | **POST** /layout/revert | Clear staged layout
2022-09-12 15:02:35 +00:00
# **add_layout**
2022-09-14 13:45:21 +00:00
> add_layout(request_body)
2022-09-12 15:02:35 +00:00
Send modifications to the cluster layout
2022-09-12 15:02:35 +00:00
2022-09-23 18:59:23 +00:00
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.
2022-09-12 15:02:35 +00:00
### Example
2022-09-12 15:13:43 +00:00
* Bearer Authentication (bearerAuth):
2022-09-12 15:02:35 +00:00
```python
import time
2022-09-13 14:00:03 +00:00
import garage_admin_sdk
from garage_admin_sdk.api import layout_api
from garage_admin_sdk.model.node_cluster_info import NodeClusterInfo
2022-09-12 15:02:35 +00:00
from pprint import pprint
# Defining the host is optional and defaults to http://localhost:3903/v0
# See configuration.py for a list of all supported configuration parameters.
2022-09-13 14:00:03 +00:00
configuration = garage_admin_sdk.Configuration(
2022-09-12 15:02:35 +00:00
host = "http://localhost:3903/v0"
)
2022-09-12 15:13:43 +00:00
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: bearerAuth
2022-09-13 14:00:03 +00:00
configuration = garage_admin_sdk.Configuration(
2022-09-12 15:13:43 +00:00
access_token = 'YOUR_BEARER_TOKEN'
)
2022-09-12 15:02:35 +00:00
# Enter a context with an instance of the API client
2022-09-13 14:00:03 +00:00
with garage_admin_sdk.ApiClient(configuration) as api_client:
2022-09-12 15:02:35 +00:00
# Create an instance of the API class
api_instance = layout_api.LayoutApi(api_client)
request_body = {
2022-09-14 13:45:21 +00:00
"key": NodeClusterInfo(
zone="dc1",
capacity=4,
tags=["gateway","fast"],
),
} # {str: (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.
2022-09-12 15:02:35 +00:00
# example passing only required values which don't have defaults set
try:
# Send modifications to the cluster layout
2022-09-14 13:45:21 +00:00
api_instance.add_layout(request_body)
2022-09-13 14:00:03 +00:00
except garage_admin_sdk.ApiException as e:
print("Exception when calling LayoutApi->add_layout: %s\n" % e)
2022-09-12 15:02:35 +00:00
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
2022-09-14 13:45:21 +00:00
**request_body** | [**{str: (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. |
2022-09-12 15:02:35 +00:00
### Return type
void (empty response body)
### Authorization
2022-09-12 15:13:43 +00:00
[bearerAuth](../README.md#bearerAuth)
2022-09-12 15:02:35 +00:00
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**500** | The server can not handle your request. Check your connectivity with the rest of the cluster. | - |
**400** | Invalid syntax or requested change | - |
**200** | The layout modification has been correctly staged | - |
2022-09-12 15:02:35 +00:00
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **apply_layout**
2022-09-14 13:45:21 +00:00
> apply_layout(layout_version)
2022-09-12 15:02:35 +00:00
Apply staged layout
2022-09-12 15:02:35 +00:00
Applies to the cluster the layout changes currently registered as staged layout changes.
2022-09-12 15:02:35 +00:00
### Example
2022-09-12 15:13:43 +00:00
* Bearer Authentication (bearerAuth):
2022-09-12 15:02:35 +00:00
```python
import time
2022-09-13 14:00:03 +00:00
import garage_admin_sdk
from garage_admin_sdk.api import layout_api
from garage_admin_sdk.model.layout_version import LayoutVersion
2022-09-12 15:02:35 +00:00
from pprint import pprint
# Defining the host is optional and defaults to http://localhost:3903/v0
# See configuration.py for a list of all supported configuration parameters.
2022-09-13 14:00:03 +00:00
configuration = garage_admin_sdk.Configuration(
2022-09-12 15:02:35 +00:00
host = "http://localhost:3903/v0"
)
2022-09-12 15:13:43 +00:00
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: bearerAuth
2022-09-13 14:00:03 +00:00
configuration = garage_admin_sdk.Configuration(
2022-09-12 15:13:43 +00:00
access_token = 'YOUR_BEARER_TOKEN'
)
2022-09-12 15:02:35 +00:00
# Enter a context with an instance of the API client
2022-09-13 14:00:03 +00:00
with garage_admin_sdk.ApiClient(configuration) as api_client:
2022-09-12 15:02:35 +00:00
# Create an instance of the API class
api_instance = layout_api.LayoutApi(api_client)
layout_version = LayoutVersion(
version=13,
2022-09-14 13:45:21 +00:00
) # 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.
2022-09-12 15:02:35 +00:00
# example passing only required values which don't have defaults set
2022-09-12 15:02:35 +00:00
try:
# Apply staged layout
2022-09-14 13:45:21 +00:00
api_instance.apply_layout(layout_version)
2022-09-13 14:00:03 +00:00
except garage_admin_sdk.ApiException as e:
print("Exception when calling LayoutApi->apply_layout: %s\n" % e)
2022-09-12 15:02:35 +00:00
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
2022-09-14 13:45:21 +00:00
**layout_version** | [**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. |
2022-09-12 15:02:35 +00:00
### Return type
void (empty response body)
2022-09-12 15:02:35 +00:00
### Authorization
2022-09-12 15:13:43 +00:00
[bearerAuth](../README.md#bearerAuth)
2022-09-12 15:02:35 +00:00
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
2022-09-12 15:02:35 +00:00
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**500** | The server can not handle your request. Check your connectivity with the rest of the cluster. | - |
**400** | Invalid syntax or requested change | - |
**200** | The staged layout has been applied as the new layout of the cluster, a rebalance has been triggered. | - |
2022-09-12 15:02:35 +00:00
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **get_layout**
> ClusterLayout get_layout()
2022-09-12 15:02:35 +00:00
Details on the current and staged layout
2022-09-12 15:02:35 +00:00
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`.*
2022-09-12 15:02:35 +00:00
### Example
2022-09-12 15:13:43 +00:00
* Bearer Authentication (bearerAuth):
2022-09-12 15:02:35 +00:00
```python
import time
2022-09-13 14:00:03 +00:00
import garage_admin_sdk
from garage_admin_sdk.api import layout_api
from garage_admin_sdk.model.cluster_layout import ClusterLayout
2022-09-12 15:02:35 +00:00
from pprint import pprint
# Defining the host is optional and defaults to http://localhost:3903/v0
# See configuration.py for a list of all supported configuration parameters.
2022-09-13 14:00:03 +00:00
configuration = garage_admin_sdk.Configuration(
2022-09-12 15:02:35 +00:00
host = "http://localhost:3903/v0"
)
2022-09-12 15:13:43 +00:00
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: bearerAuth
2022-09-13 14:00:03 +00:00
configuration = garage_admin_sdk.Configuration(
2022-09-12 15:13:43 +00:00
access_token = 'YOUR_BEARER_TOKEN'
)
2022-09-12 15:02:35 +00:00
# Enter a context with an instance of the API client
2022-09-13 14:00:03 +00:00
with garage_admin_sdk.ApiClient(configuration) as api_client:
2022-09-12 15:02:35 +00:00
# Create an instance of the API class
api_instance = layout_api.LayoutApi(api_client)
# example, this endpoint has no required or optional parameters
2022-09-12 15:02:35 +00:00
try:
# Details on the current and staged layout
api_response = api_instance.get_layout()
pprint(api_response)
2022-09-13 14:00:03 +00:00
except garage_admin_sdk.ApiException as e:
print("Exception when calling LayoutApi->get_layout: %s\n" % e)
2022-09-12 15:02:35 +00:00
```
### Parameters
This endpoint does not need any parameter.
2022-09-12 15:02:35 +00:00
### Return type
[**ClusterLayout**](ClusterLayout.md)
2022-09-12 15:02:35 +00:00
### Authorization
2022-09-12 15:13:43 +00:00
[bearerAuth](../README.md#bearerAuth)
2022-09-12 15:02:35 +00:00
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
2022-09-12 15:02:35 +00:00
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**500** | The server can not answer your request because it is in a bad state | - |
**200** | Returns the cluster's current cluster layout: - Currently configured cluster layout - Staged changes to the cluster layout | - |
2022-09-12 15:02:35 +00:00
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **revert_layout**
2022-09-14 13:45:21 +00:00
> revert_layout(layout_version)
2022-09-12 15:02:35 +00:00
Clear staged layout
Clears all of the staged layout changes.
### Example
2022-09-12 15:13:43 +00:00
* Bearer Authentication (bearerAuth):
2022-09-12 15:02:35 +00:00
```python
import time
2022-09-13 14:00:03 +00:00
import garage_admin_sdk
from garage_admin_sdk.api import layout_api
from garage_admin_sdk.model.layout_version import LayoutVersion
2022-09-12 15:02:35 +00:00
from pprint import pprint
# Defining the host is optional and defaults to http://localhost:3903/v0
# See configuration.py for a list of all supported configuration parameters.
2022-09-13 14:00:03 +00:00
configuration = garage_admin_sdk.Configuration(
2022-09-12 15:02:35 +00:00
host = "http://localhost:3903/v0"
)
2022-09-12 15:13:43 +00:00
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: bearerAuth
2022-09-13 14:00:03 +00:00
configuration = garage_admin_sdk.Configuration(
2022-09-12 15:13:43 +00:00
access_token = 'YOUR_BEARER_TOKEN'
)
2022-09-12 15:02:35 +00:00
# Enter a context with an instance of the API client
2022-09-13 14:00:03 +00:00
with garage_admin_sdk.ApiClient(configuration) as api_client:
2022-09-12 15:02:35 +00:00
# Create an instance of the API class
api_instance = layout_api.LayoutApi(api_client)
layout_version = LayoutVersion(
version=13,
2022-09-14 13:45:21 +00:00
) # 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.
2022-09-12 15:02:35 +00:00
# example passing only required values which don't have defaults set
try:
# Clear staged layout
2022-09-14 13:45:21 +00:00
api_instance.revert_layout(layout_version)
2022-09-13 14:00:03 +00:00
except garage_admin_sdk.ApiException as e:
print("Exception when calling LayoutApi->revert_layout: %s\n" % e)
2022-09-12 15:02:35 +00:00
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
2022-09-14 13:45:21 +00:00
**layout_version** | [**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. |
2022-09-12 15:02:35 +00:00
### Return type
void (empty response body)
### Authorization
2022-09-12 15:13:43 +00:00
[bearerAuth](../README.md#bearerAuth)
2022-09-12 15:02:35 +00:00
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**500** | The server can not handle your request. Check your connectivity with the rest of the cluster. | - |
**400** | Invalid syntax or requested change | - |
**200** | The staged layout has been cleared, you can start again sending modification from a fresh copy with `POST /layout`. | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)