garage-admin-sdk-generator/python/README.md

169 lines
6.8 KiB
Markdown
Raw Normal View History

2022-09-13 14:00:03 +00:00
# garage-admin-sdk
2022-09-12 15:02:35 +00:00
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
2022-09-13 14:00:03 +00:00
- Package version: 0.7.3
2022-09-12 15:02:35 +00:00
- 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
2022-09-13 14:00:03 +00:00
import garage_admin_sdk
2022-09-12 15:02:35 +00:00
```
### 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
2022-09-13 14:00:03 +00:00
import garage_admin_sdk
2022-09-12 15:02:35 +00:00
```
## Getting Started
Please follow the [installation procedure](#installation--usage) and then run the following:
```python
import time
2022-09-13 14:00:03 +00:00
import garage_admin_sdk
2022-09-12 15:02:35 +00:00
from pprint import pprint
2022-09-13 14:00:03 +00:00
from garage_admin_sdk.api import key_api
from garage_admin_sdk.model.key_get_request import KeyGetRequest
from garage_admin_sdk.model.key_id_access_key_delete_request import KeyIdAccessKeyDeleteRequest
from garage_admin_sdk.model.key_import_post_request import KeyImportPostRequest
from garage_admin_sdk.model.key_info import KeyInfo
from garage_admin_sdk.model.list_keys200_response_inner import ListKeys200ResponseInner
2022-09-12 15:02:35 +00:00
# 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 = key_api.KeyApi(api_client)
key_import_post_request = KeyImportPostRequest(
name="test-key",
access_key_id="GK31c2f218a2e44f485b94239e",
secret_access_key="b892c0665f0ada8a4755dae98baa3b133590e11dae3bcc1f9d769d67f16c3835",
) # KeyImportPostRequest | Information on the key to import (optional)
try:
# Import an existing key
api_response = api_instance.key_import_post(key_import_post_request=key_import_post_request)
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 KeyApi->key_import_post: %s\n" % e)
```
## Documentation for API Endpoints
All URIs are relative to *http://localhost:3903/v0*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*KeyApi* | [**key_import_post**](docs/KeyApi.md#key_import_post) | **POST** /key/import | Import an existing key
*KeyApi* | [**key_post**](docs/KeyApi.md#key_post) | **POST** /key | Create a new API key
*KeyApi* | [**keyidaccess_key_delete**](docs/KeyApi.md#keyidaccess_key_delete) | **DELETE** /key?id={access_key} | Delete a key
*KeyApi* | [**keyidaccess_key_get**](docs/KeyApi.md#keyidaccess_key_get) | **GET** /key?id={access_key} | Get key information
*KeyApi* | [**keyidaccess_key_post**](docs/KeyApi.md#keyidaccess_key_post) | **POST** /key?id={access_key} | Update a key
*KeyApi* | [**keysearchpattern_get**](docs/KeyApi.md#keysearchpattern_get) | **GET** /key?search={pattern} | Select key by pattern
*KeyApi* | [**list_keys**](docs/KeyApi.md#list_keys) | **GET** /key | List all keys
*LayoutApi* | [**layout_apply_post**](docs/LayoutApi.md#layout_apply_post) | **POST** /layout/apply | Apply staged layout
*LayoutApi* | [**layout_get**](docs/LayoutApi.md#layout_get) | **GET** /layout | Details on the current and staged layout
*LayoutApi* | [**layout_post**](docs/LayoutApi.md#layout_post) | **POST** /layout | Send modifications to the cluster layout
*LayoutApi* | [**layout_revert_post**](docs/LayoutApi.md#layout_revert_post) | **POST** /layout/revert | Clear staged layout
*MembershipApi* | [**connect_post**](docs/MembershipApi.md#connect_post) | **POST** /connect | Connect target node to other Garage nodes
*MembershipApi* | [**status_get**](docs/MembershipApi.md#status_get) | **GET** /status | Status of this node and other nodes in the cluster
## Documentation For Models
- [ClusterLayout](docs/ClusterLayout.md)
- [ConnectPost200ResponseInner](docs/ConnectPost200ResponseInner.md)
- [KeyGetRequest](docs/KeyGetRequest.md)
- [KeyIdAccessKeyDeleteRequest](docs/KeyIdAccessKeyDeleteRequest.md)
- [KeyIdAccessKeyDeleteRequestAllow](docs/KeyIdAccessKeyDeleteRequestAllow.md)
2022-09-13 14:00:03 +00:00
- [KeyIdAccessKeyDeleteRequestDeny](docs/KeyIdAccessKeyDeleteRequestDeny.md)
2022-09-12 15:02:35 +00:00
- [KeyImportPostRequest](docs/KeyImportPostRequest.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)
- [StatusGet200Response](docs/StatusGet200Response.md)
## Documentation For Authorization
2022-09-12 15:13:43 +00:00
## bearerAuth
- **Type**: Bearer authentication
2022-09-12 15:02:35 +00:00
## Author
## Notes for Large OpenAPI documents
2022-09-13 14:00:03 +00:00
If the OpenAPI document is large, imports in garage_admin_sdk.apis and garage_admin_sdk.models may fail with a
2022-09-12 15:02:35 +00:00
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:
2022-09-13 14:00:03 +00:00
- `from garage_admin_sdk.api.default_api import DefaultApi`
- `from garage_admin_sdk.model.pet import Pet`
2022-09-12 15:02:35 +00:00
Solution 2:
Before importing the package, adjust the maximum recursion limit as shown below:
```
import sys
sys.setrecursionlimit(1500)
2022-09-13 14:00:03 +00:00
import garage_admin_sdk
from garage_admin_sdk.apis import *
from garage_admin_sdk.models import *
2022-09-12 15:02:35 +00:00
```