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

330 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
------------- | ------------- | -------------
[**layout_apply_post**](LayoutApi.md#layout_apply_post) | **POST** /layout/apply | Apply staged layout
[**layout_get**](LayoutApi.md#layout_get) | **GET** /layout | Details on the current and staged layout
[**layout_post**](LayoutApi.md#layout_post) | **POST** /layout | Send modifications to the cluster layout
[**layout_revert_post**](LayoutApi.md#layout_revert_post) | **POST** /layout/revert | Clear staged layout
# **layout_apply_post**
> layout_apply_post()
Apply staged layout
Applies to the cluster the layout changes currently registered as 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,
) # 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. (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
# Apply staged layout
api_instance.layout_apply_post(layout_version=layout_version)
2022-09-13 14:00:03 +00:00
except garage_admin_sdk.ApiException as e:
2022-09-12 15:02:35 +00:00
print("Exception when calling LayoutApi->layout_apply_post: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**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. | [optional]
### 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 applied as the new layout of the cluster, a rebalance has been triggered. | - |
[[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)
# **layout_get**
> ClusterLayout layout_get()
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
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
try:
# Details on the current and staged layout
api_response = api_instance.layout_get()
pprint(api_response)
2022-09-13 14:00:03 +00:00
except garage_admin_sdk.ApiException as e:
2022-09-12 15:02:35 +00:00
print("Exception when calling LayoutApi->layout_get: %s\n" % e)
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**ClusterLayout**](ClusterLayout.md)
### 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
### 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 | - |
[[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)
# **layout_post**
> layout_post()
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.
### 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 = {
"key": NodeClusterInfo(None),
} # {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. (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
# Send modifications to the cluster layout
api_instance.layout_post(request_body=request_body)
2022-09-13 14:00:03 +00:00
except garage_admin_sdk.ApiException as e:
2022-09-12 15:02:35 +00:00
print("Exception when calling LayoutApi->layout_post: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**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. | [optional]
### 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 | - |
[[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)
# **layout_revert_post**
> layout_revert_post()
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,
) # 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. (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
# Clear staged layout
api_instance.layout_revert_post(layout_version=layout_version)
2022-09-13 14:00:03 +00:00
except garage_admin_sdk.ApiException as e:
2022-09-12 15:02:35 +00:00
print("Exception when calling LayoutApi->layout_revert_post: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**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. | [optional]
### 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)