19 KiB
garage_admin_sdk.KeyApi
All URIs are relative to http://localhost:3903/v0
Method | HTTP request | Description |
---|---|---|
add_key | POST /key | Create a new API key |
delete_key | DELETE /key?id={access_key} | Delete a key |
get_key | GET /key?id={access_key} | Get key information |
import_key | POST /key/import | Import an existing key |
list_keys | GET /key | List all keys |
search_key | GET /key?search={pattern} | Select key by pattern |
update_key | POST /key?id={access_key} | Update a key |
add_key
KeyInfo add_key(add_key_request)
Create a new API key
Creates a new API access key.
Example
- Bearer Authentication (bearerAuth):
import time
import garage_admin_sdk
from garage_admin_sdk.api import key_api
from garage_admin_sdk.model.key_info import KeyInfo
from garage_admin_sdk.model.add_key_request import AddKeyRequest
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 = 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\"
# example passing only required values which don't have defaults set
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)
Parameters
Name | Type | Description | Notes |
---|---|---|---|
add_key_request | AddKeyRequest | "You can set a friendly name for this key, send an empty string instead" |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
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 key has been added | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
delete_key
delete_key(access_key)
Delete a key
Delete a key from the cluster. Its access will be removed from all the buckets. Buckets are not automatically deleted and can be dangling. You should manually delete them before.
Example
- Bearer Authentication (bearerAuth):
import time
import garage_admin_sdk
from garage_admin_sdk.api import key_api
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 = key_api.KeyApi(api_client)
access_key = "GK31c2f218a2e44f485b94239e" # str | The exact API access key generated by Garage
# example passing only required values which don't have defaults set
try:
# Delete a key
api_instance.delete_key(access_key)
except garage_admin_sdk.ApiException as e:
print("Exception when calling KeyApi->delete_key: %s\n" % e)
Parameters
Name | Type | Description | Notes |
---|---|---|---|
access_key | str | The exact API access key generated by Garage |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- 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. | - |
200 | The key has been deleted | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
get_key
KeyInfo get_key(access_key)
Get key information
Return information about a specific key and return its information
Example
- Bearer Authentication (bearerAuth):
import time
import garage_admin_sdk
from garage_admin_sdk.api import key_api
from garage_admin_sdk.model.key_info import KeyInfo
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 = key_api.KeyApi(api_client)
access_key = "GK31c2f218a2e44f485b94239e" # str | The exact API access key generated by Garage
# example passing only required values which don't have defaults set
try:
# Get key information
api_response = api_instance.get_key(access_key)
pprint(api_response)
except garage_admin_sdk.ApiException as e:
print("Exception when calling KeyApi->get_key: %s\n" % e)
Parameters
Name | Type | Description | Notes |
---|---|---|---|
access_key | str | The exact API access key generated by Garage |
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 handle your request. Check your connectivity with the rest of the cluster. | - |
200 | Returns information about the key | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
import_key
KeyInfo import_key(import_key_request)
Import an existing key
Imports an existing API key. This feature must only be used for migrations and backup restore. Do not use it to generate custom key identifiers or you will break your Garage cluster.
Example
- Bearer Authentication (bearerAuth):
import time
import garage_admin_sdk
from garage_admin_sdk.api import key_api
from garage_admin_sdk.model.import_key_request import ImportKeyRequest
from garage_admin_sdk.model.key_info import KeyInfo
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 = key_api.KeyApi(api_client)
import_key_request = ImportKeyRequest(
name="test-key",
access_key_id="GK31c2f218a2e44f485b94239e",
secret_access_key="b892c0665f0ada8a4755dae98baa3b133590e11dae3bcc1f9d769d67f16c3835",
) # ImportKeyRequest | Information on the key to import
# example passing only required values which don't have defaults set
try:
# Import an existing key
api_response = api_instance.import_key(import_key_request)
pprint(api_response)
except garage_admin_sdk.ApiException as e:
print("Exception when calling KeyApi->import_key: %s\n" % e)
Parameters
Name | Type | Description | Notes |
---|---|---|---|
import_key_request | ImportKeyRequest | Information on the key to import |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
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 key has been imported into the system | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
list_keys
[ListKeys200ResponseInner] list_keys()
List all keys
Returns all API access keys in the cluster.
Example
- Bearer Authentication (bearerAuth):
import time
import garage_admin_sdk
from garage_admin_sdk.api import key_api
from garage_admin_sdk.model.list_keys200_response_inner import ListKeys200ResponseInner
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 = key_api.KeyApi(api_client)
# example, this endpoint has no required or optional parameters
try:
# List all keys
api_response = api_instance.list_keys()
pprint(api_response)
except garage_admin_sdk.ApiException as e:
print("Exception when calling KeyApi->list_keys: %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 handle your request. Check your connectivity with the rest of the cluster. | - |
200 | Returns the key identifier (aka `AWS_ACCESS_KEY_ID`) and its associated, human friendly, name if any (otherwise return an empty string) | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
search_key
KeyInfo search_key(pattern)
Select key by pattern
Find the first key matching the given pattern based on its identifier aor friendly name and return its information.
Example
- Bearer Authentication (bearerAuth):
import time
import garage_admin_sdk
from garage_admin_sdk.api import key_api
from garage_admin_sdk.model.key_info import KeyInfo
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 = key_api.KeyApi(api_client)
pattern = "test-k" # str | A pattern (beginning or full string) corresponding to a key identifier or friendly name
# example passing only required values which don't have defaults set
try:
# Select key by pattern
api_response = api_instance.search_key(pattern)
pprint(api_response)
except garage_admin_sdk.ApiException as e:
print("Exception when calling KeyApi->search_key: %s\n" % e)
Parameters
Name | Type | Description | Notes |
---|---|---|---|
pattern | str | A pattern (beginning or full string) corresponding to a key identifier or friendly name |
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 handle your request. Check your connectivity with the rest of the cluster. | - |
200 | Returns information about the key | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
update_key
KeyInfo update_key(access_key, update_key_request)
Update a key
Updates information about the specified API access key.
Example
- Bearer Authentication (bearerAuth):
import time
import garage_admin_sdk
from garage_admin_sdk.api import key_api
from garage_admin_sdk.model.update_key_request import UpdateKeyRequest
from garage_admin_sdk.model.key_info import KeyInfo
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 = key_api.KeyApi(api_client)
access_key = "GK31c2f218a2e44f485b94239e" # str | The exact API access key generated by Garage
update_key_request = UpdateKeyRequest(
name="test-key",
allow=UpdateKeyRequestAllow(
create_bucket=True,
),
deny=UpdateKeyRequestDeny(
create_bucket=True,
),
) # UpdateKeyRequest | For a given key, provide a first set with the permissions to grant, and a second set with the permissions to remove
# example passing only required values which don't have defaults set
try:
# Update a key
api_response = api_instance.update_key(access_key, update_key_request)
pprint(api_response)
except garage_admin_sdk.ApiException as e:
print("Exception when calling KeyApi->update_key: %s\n" % e)
Parameters
Name | Type | Description | Notes |
---|---|---|---|
access_key | str | The exact API access key generated by Garage | |
update_key_request | UpdateKeyRequest | For a given key, provide a first set with the permissions to grant, and a second set with the permissions to remove |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
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 | Returns information about the key | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]