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

12 KiB

garage_admin_sdk.LayoutApi

All URIs are relative to http://localhost:3903/v0

Method HTTP request Description
layout_apply_post POST /layout/apply Apply staged layout
layout_get GET /layout Details on the current and staged layout
layout_post POST /layout Send modifications to the cluster layout
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

  • 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.  (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)
    except garage_admin_sdk.ApiException as e:
        print("Exception when calling LayoutApi->layout_apply_post: %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. [optional]

Return type

void (empty response body)

Authorization

bearerAuth

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]

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

  • 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.layout_get()
        pprint(api_response)
    except garage_admin_sdk.ApiException as e:
        print("Exception when calling LayoutApi->layout_get: %s\n" % e)

Parameters

This endpoint does not need any parameter.

Return type

ClusterLayout

Authorization

bearerAuth

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]

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

  • 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(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)
    except garage_admin_sdk.ApiException as e:
        print("Exception when calling LayoutApi->layout_post: %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. [optional]

Return type

void (empty response body)

Authorization

bearerAuth

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]

layout_revert_post

layout_revert_post()

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.  (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)
    except garage_admin_sdk.ApiException as e:
        print("Exception when calling LayoutApi->layout_revert_post: %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. [optional]

Return type

void (empty response body)

Authorization

bearerAuth

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]