|
||
---|---|---|
.openapi-generator | ||
docs | ||
garage_admin_sdk | ||
test | ||
.gitignore | ||
.gitlab-ci.yml | ||
.openapi-generator-ignore | ||
.travis.yml | ||
git_push.sh | ||
README.md | ||
requirements.txt | ||
setup.cfg | ||
setup.py | ||
test-requirements.txt | ||
tox.ini |
garage-admin-sdk-python
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 project:
- API version: v0.9.0
- Package version: 0.9.0
- 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:
pip install git+https://git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-python.git
(you may need to run pip
with root permission: sudo pip install git+https://git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-python.git
)
Then import the package:
import garage_admin_sdk
Setuptools
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install
to install the package for all users)
Then import the package:
import garage_admin_sdk
Getting Started
Please follow the installation procedure and then run the following:
import time
import garage_admin_sdk
from pprint import pprint
from garage_admin_sdk.api import bucket_api
from garage_admin_sdk.model.allow_bucket_key_request import AllowBucketKeyRequest
from garage_admin_sdk.model.bucket_info import BucketInfo
from garage_admin_sdk.model.create_bucket_request import CreateBucketRequest
from garage_admin_sdk.model.list_buckets200_response_inner import ListBuckets200ResponseInner
from garage_admin_sdk.model.update_bucket_request import UpdateBucketRequest
# Defining the host is optional and defaults to http://localhost:3903/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = garage_admin_sdk.Configuration(
host = "http://localhost:3903/v1"
)
# 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 = bucket_api.BucketApi(api_client)
allow_bucket_key_request = AllowBucketKeyRequest(
bucket_id="e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b",
access_key_id="GK31c2f218a2e44f485b94239e",
permissions=AllowBucketKeyRequestPermissions(
read=True,
write=True,
owner=True,
),
) # AllowBucketKeyRequest | Aliases to put on the new bucket
try:
# Allow key
api_response = api_instance.allow_bucket_key(allow_bucket_key_request)
pprint(api_response)
except garage_admin_sdk.ApiException as e:
print("Exception when calling BucketApi->allow_bucket_key: %s\n" % e)
Documentation for API Endpoints
All URIs are relative to http://localhost:3903/v1
Class | Method | HTTP request | Description |
---|---|---|---|
BucketApi | allow_bucket_key | POST /bucket/allow | Allow key |
BucketApi | create_bucket | POST /bucket | Create a bucket |
BucketApi | delete_bucket | DELETE /bucket | Delete a bucket |
BucketApi | delete_bucket_global_alias | DELETE /bucket/alias/global | Delete a global alias |
BucketApi | delete_bucket_local_alias | DELETE /bucket/alias/local | Delete a local alias |
BucketApi | deny_bucket_key | POST /bucket/deny | Deny key |
BucketApi | get_bucket_info | GET /bucket | Get a bucket |
BucketApi | list_buckets | GET /bucket?list | List all buckets |
BucketApi | put_bucket_global_alias | PUT /bucket/alias/global | Add a global alias |
BucketApi | put_bucket_local_alias | PUT /bucket/alias/local | Add a local alias |
BucketApi | update_bucket | PUT /bucket | Update a bucket |
KeyApi | add_key | POST /key?list | Create a new API key |
KeyApi | delete_key | DELETE /key | Delete a key |
KeyApi | get_key | GET /key | Get key information |
KeyApi | import_key | POST /key/import | Import an existing key |
KeyApi | list_keys | GET /key?list | List all keys |
KeyApi | update_key | POST /key | Update a key |
LayoutApi | add_layout | POST /layout | Send modifications to the cluster layout |
LayoutApi | apply_layout | POST /layout/apply | Apply staged layout |
LayoutApi | get_layout | GET /layout | Details on the current and staged layout |
LayoutApi | revert_layout | POST /layout/revert | Clear staged layout |
NodesApi | add_node | POST /connect | Connect a new node |
NodesApi | get_health | GET /health | Cluster health report |
NodesApi | get_nodes | GET /status | Describe cluster |
Documentation For Models
- AddKeyRequest
- AddNode200ResponseInner
- AllowBucketKeyRequest
- AllowBucketKeyRequestPermissions
- ApplyLayout200Response
- BucketInfo
- BucketInfoQuotas
- BucketInfoWebsiteConfig
- BucketKeyInfo
- ClusterLayout
- CreateBucketRequest
- CreateBucketRequestLocalAlias
- CreateBucketRequestLocalAliasAllow
- GetHealth200Response
- GetNodes200Response
- ImportKeyRequest
- KeyInfo
- KeyInfoBucketsInner
- KeyInfoBucketsInnerPermissions
- KeyInfoPermissions
- LayoutVersion
- ListBuckets200ResponseInner
- ListBuckets200ResponseInnerLocalAliasesInner
- ListKeys200ResponseInner
- NodeClusterInfo
- NodeNetworkInfo
- NodeRoleChange
- NodeRoleRemove
- NodeRoleUpdate
- UpdateBucketRequest
- UpdateBucketRequestQuotas
- UpdateBucketRequestWebsiteAccess
- UpdateKeyRequest
- UpdateKeyRequestAllow
- UpdateKeyRequestDeny
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 *