166 lines
6.4 KiB
Markdown
166 lines
6.4 KiB
Markdown
# garage-admin-sdk
|
|
Administrate your Garage cluster programatically, including status, layout, keys, buckets, and maintainance tasks.
|
|
|
|
*Disclaimer: The API is not stable yet, hence its v0 tag. The API can change at any time, and changes can include breaking backward compatibility. Read the changelog and upgrade your scripts before upgrading. Additionnaly, this specification is very early stage and can contain bugs, especially on error return codes/types that are not tested yet. Do not expect a well finished and polished product!*
|
|
|
|
|
|
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
|
|
|
- API version: v0.7.3
|
|
- Package version: 0.7.3
|
|
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
|
|
|
|
## Requirements.
|
|
|
|
Python >=3.6
|
|
|
|
## Installation & Usage
|
|
### pip install
|
|
|
|
If the python package is hosted on a repository, you can install directly using:
|
|
|
|
```sh
|
|
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
|
|
```
|
|
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)
|
|
|
|
Then import the package:
|
|
```python
|
|
import garage_admin_sdk
|
|
```
|
|
|
|
### Setuptools
|
|
|
|
Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
|
|
|
|
```sh
|
|
python setup.py install --user
|
|
```
|
|
(or `sudo python setup.py install` to install the package for all users)
|
|
|
|
Then import the package:
|
|
```python
|
|
import garage_admin_sdk
|
|
```
|
|
|
|
## Getting Started
|
|
|
|
Please follow the [installation procedure](#installation--usage) and then run the following:
|
|
|
|
```python
|
|
|
|
import time
|
|
import garage_admin_sdk
|
|
from pprint import pprint
|
|
from garage_admin_sdk.api import key_api
|
|
from garage_admin_sdk.model.add_key_request import AddKeyRequest
|
|
from garage_admin_sdk.model.import_key_request import ImportKeyRequest
|
|
from garage_admin_sdk.model.key_info import KeyInfo
|
|
from garage_admin_sdk.model.list_keys200_response_inner import ListKeys200ResponseInner
|
|
from garage_admin_sdk.model.update_key_request import UpdateKeyRequest
|
|
# 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 = key_api.KeyApi(api_client)
|
|
add_key_request = AddKeyRequest(
|
|
name="test-key",
|
|
) # AddKeyRequest | \"You can set a friendly name for this key, send an empty string instead\"
|
|
|
|
try:
|
|
# Create a new API key
|
|
api_response = api_instance.add_key(add_key_request)
|
|
pprint(api_response)
|
|
except garage_admin_sdk.ApiException as e:
|
|
print("Exception when calling KeyApi->add_key: %s\n" % e)
|
|
```
|
|
|
|
## Documentation for API Endpoints
|
|
|
|
All URIs are relative to *http://localhost:3903/v0*
|
|
|
|
Class | Method | HTTP request | Description
|
|
------------ | ------------- | ------------- | -------------
|
|
*KeyApi* | [**add_key**](docs/KeyApi.md#add_key) | **POST** /key | Create a new API key
|
|
*KeyApi* | [**delete_key**](docs/KeyApi.md#delete_key) | **DELETE** /key?id={access_key} | Delete a key
|
|
*KeyApi* | [**get_key**](docs/KeyApi.md#get_key) | **GET** /key?id={access_key} | Get key information
|
|
*KeyApi* | [**import_key**](docs/KeyApi.md#import_key) | **POST** /key/import | Import an existing key
|
|
*KeyApi* | [**list_keys**](docs/KeyApi.md#list_keys) | **GET** /key | List all keys
|
|
*KeyApi* | [**search_key**](docs/KeyApi.md#search_key) | **GET** /key?search={pattern} | Select key by pattern
|
|
*KeyApi* | [**update_key**](docs/KeyApi.md#update_key) | **POST** /key?id={access_key} | Update a key
|
|
*LayoutApi* | [**add_layout**](docs/LayoutApi.md#add_layout) | **POST** /layout | Send modifications to the cluster layout
|
|
*LayoutApi* | [**apply_layout**](docs/LayoutApi.md#apply_layout) | **POST** /layout/apply | Apply staged layout
|
|
*LayoutApi* | [**get_layout**](docs/LayoutApi.md#get_layout) | **GET** /layout | Details on the current and staged layout
|
|
*LayoutApi* | [**revert_layout**](docs/LayoutApi.md#revert_layout) | **POST** /layout/revert | Clear staged layout
|
|
*NodesApi* | [**add_node**](docs/NodesApi.md#add_node) | **POST** /connect | Connect target node to other Garage nodes
|
|
*NodesApi* | [**get_nodes**](docs/NodesApi.md#get_nodes) | **GET** /status | Status of this node and other nodes in the cluster
|
|
|
|
|
|
## Documentation For Models
|
|
|
|
- [AddKeyRequest](docs/AddKeyRequest.md)
|
|
- [AddNode200ResponseInner](docs/AddNode200ResponseInner.md)
|
|
- [ClusterLayout](docs/ClusterLayout.md)
|
|
- [GetNodes200Response](docs/GetNodes200Response.md)
|
|
- [ImportKeyRequest](docs/ImportKeyRequest.md)
|
|
- [KeyInfo](docs/KeyInfo.md)
|
|
- [KeyInfoBucketsInner](docs/KeyInfoBucketsInner.md)
|
|
- [KeyInfoBucketsInnerPermissions](docs/KeyInfoBucketsInnerPermissions.md)
|
|
- [KeyInfoPermissions](docs/KeyInfoPermissions.md)
|
|
- [LayoutVersion](docs/LayoutVersion.md)
|
|
- [ListKeys200ResponseInner](docs/ListKeys200ResponseInner.md)
|
|
- [NodeClusterInfo](docs/NodeClusterInfo.md)
|
|
- [NodeNetworkInfo](docs/NodeNetworkInfo.md)
|
|
- [UpdateKeyRequest](docs/UpdateKeyRequest.md)
|
|
- [UpdateKeyRequestAllow](docs/UpdateKeyRequestAllow.md)
|
|
- [UpdateKeyRequestDeny](docs/UpdateKeyRequestDeny.md)
|
|
|
|
|
|
## Documentation For Authorization
|
|
|
|
|
|
## bearerAuth
|
|
|
|
- **Type**: Bearer authentication
|
|
|
|
|
|
## Author
|
|
|
|
|
|
|
|
|
|
## Notes for Large OpenAPI documents
|
|
If the OpenAPI document is large, imports in garage_admin_sdk.apis and garage_admin_sdk.models may fail with a
|
|
RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:
|
|
|
|
Solution 1:
|
|
Use specific imports for apis and models like:
|
|
- `from garage_admin_sdk.api.default_api import DefaultApi`
|
|
- `from garage_admin_sdk.model.pet import Pet`
|
|
|
|
Solution 2:
|
|
Before importing the package, adjust the maximum recursion limit as shown below:
|
|
```
|
|
import sys
|
|
sys.setrecursionlimit(1500)
|
|
import garage_admin_sdk
|
|
from garage_admin_sdk.apis import *
|
|
from garage_admin_sdk.models import *
|
|
```
|
|
|