12 KiB
garage_admin_sdk.LayoutApi
All URIs are relative to http://localhost:3903/v0
Method | HTTP request | Description |
---|---|---|
add_layout | POST /layout | Send modifications to the cluster layout |
apply_layout | POST /layout/apply | Apply staged layout |
get_layout | GET /layout | Details on the current and staged layout |
revert_layout | POST /layout/revert | Clear staged layout |
add_layout
add_layout(request_body)
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
- Bearer Authentication (bearerAuth):
import time
import garage_admin_sdk
from garage_admin_sdk.api import layout_api
from garage_admin_sdk.model.node_cluster_info import NodeClusterInfo
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.
configuration = garage_admin_sdk.Configuration(
host = "http://localhost:3903/v0"
)
# 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
configuration = garage_admin_sdk.Configuration(
access_token = 'YOUR_BEARER_TOKEN'
)
# Enter a context with an instance of the API client
with garage_admin_sdk.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = layout_api.LayoutApi(api_client)
request_body = {
"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.
# example passing only required values which don't have defaults set
try:
# Send modifications to the cluster layout
api_instance.add_layout(request_body)
except garage_admin_sdk.ApiException as e:
print("Exception when calling LayoutApi->add_layout: %s\n" % e)
Parameters
Name | Type | Description | Notes |
---|---|---|---|
request_body | {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. |
Return type
void (empty response body)
Authorization
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] [Back to Model list] [Back to README]
apply_layout
apply_layout(layout_version)
Apply staged layout
Applies to the cluster the layout changes currently registered as staged layout changes.
Example
- Bearer Authentication (bearerAuth):
import time
import garage_admin_sdk
from garage_admin_sdk.api import layout_api
from garage_admin_sdk.model.layout_version import LayoutVersion
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.
configuration = garage_admin_sdk.Configuration(
host = "http://localhost:3903/v0"
)
# 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
configuration = garage_admin_sdk.Configuration(
access_token = 'YOUR_BEARER_TOKEN'
)
# Enter a context with an instance of the API client
with garage_admin_sdk.ApiClient(configuration) as api_client:
# 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.
# example passing only required values which don't have defaults set
try:
# Apply staged layout
api_instance.apply_layout(layout_version)
except garage_admin_sdk.ApiException as e:
print("Exception when calling LayoutApi->apply_layout: %s\n" % e)
Parameters
Name | Type | Description | Notes |
---|---|---|---|
layout_version | 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. |
Return type
void (empty response body)
Authorization
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] [Back to Model list] [Back to README]
get_layout
ClusterLayout get_layout()
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
- Bearer Authentication (bearerAuth):
import time
import garage_admin_sdk
from garage_admin_sdk.api import layout_api
from garage_admin_sdk.model.cluster_layout import ClusterLayout
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.
configuration = garage_admin_sdk.Configuration(
host = "http://localhost:3903/v0"
)
# 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
configuration = garage_admin_sdk.Configuration(
access_token = 'YOUR_BEARER_TOKEN'
)
# Enter a context with an instance of the API client
with garage_admin_sdk.ApiClient(configuration) as api_client:
# 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.get_layout()
pprint(api_response)
except garage_admin_sdk.ApiException as e:
print("Exception when calling LayoutApi->get_layout: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
Authorization
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] [Back to Model list] [Back to README]
revert_layout
revert_layout(layout_version)
Clear staged layout
Clears all of the staged layout changes.
Example
- Bearer Authentication (bearerAuth):
import time
import garage_admin_sdk
from garage_admin_sdk.api import layout_api
from garage_admin_sdk.model.layout_version import LayoutVersion
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.
configuration = garage_admin_sdk.Configuration(
host = "http://localhost:3903/v0"
)
# 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
configuration = garage_admin_sdk.Configuration(
access_token = 'YOUR_BEARER_TOKEN'
)
# Enter a context with an instance of the API client
with garage_admin_sdk.ApiClient(configuration) as api_client:
# 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.
# example passing only required values which don't have defaults set
try:
# Clear staged layout
api_instance.revert_layout(layout_version)
except garage_admin_sdk.ApiException as e:
print("Exception when calling LayoutApi->revert_layout: %s\n" % e)
Parameters
Name | Type | Description | Notes |
---|---|---|---|
layout_version | 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. |
Return type
void (empty response body)
Authorization
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] [Back to Model list] [Back to README]