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

589 lines
19 KiB
Markdown
Raw Normal View History

2022-09-13 14:00:03 +00:00
# garage_admin_sdk.KeyApi
2022-09-12 15:02:35 +00:00
All URIs are relative to *http://localhost:3903/v0*
Method | HTTP request | Description
------------- | ------------- | -------------
[**add_key**](KeyApi.md#add_key) | **POST** /key | Create a new API key
[**delete_key**](KeyApi.md#delete_key) | **DELETE** /key?id={access_key} | Delete a key
[**get_key**](KeyApi.md#get_key) | **GET** /key?id={access_key} | Get key information
[**import_key**](KeyApi.md#import_key) | **POST** /key/import | Import an existing key
2022-09-12 15:02:35 +00:00
[**list_keys**](KeyApi.md#list_keys) | **GET** /key | List all keys
[**search_key**](KeyApi.md#search_key) | **GET** /key?search={pattern} | Select key by pattern
[**update_key**](KeyApi.md#update_key) | **POST** /key?id={access_key} | Update a key
2022-09-12 15:02:35 +00:00
# **add_key**
> KeyInfo add_key()
2022-09-12 15:02:35 +00:00
Create a new API key
2022-09-12 15:02:35 +00:00
Creates a new API access key.
2022-09-12 15:02:35 +00:00
### Example
2022-09-12 15:13:43 +00:00
* Bearer Authentication (bearerAuth):
2022-09-12 15:02:35 +00:00
```python
import time
2022-09-13 14:00:03 +00:00
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
2022-09-12 15:02:35 +00:00
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.
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)
add_key_request = AddKeyRequest(
2022-09-12 15:02:35 +00:00
name="test-key",
) # AddKeyRequest | \"You can optionnaly set a friendly name for this key\" (optional)
2022-09-12 15:02:35 +00:00
# example passing only required values which don't have defaults set
# and optional values
try:
# Create a new API key
api_response = api_instance.add_key(add_key_request=add_key_request)
2022-09-12 15:02:35 +00:00
pprint(api_response)
2022-09-13 14:00:03 +00:00
except garage_admin_sdk.ApiException as e:
print("Exception when calling KeyApi->add_key: %s\n" % e)
2022-09-12 15:02:35 +00:00
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**add_key_request** | [**AddKeyRequest**](AddKeyRequest.md)| \"You can optionnaly set a friendly name for this key\" | [optional]
2022-09-12 15:02:35 +00:00
### Return type
[**KeyInfo**](KeyInfo.md)
### Authorization
2022-09-12 15:13:43 +00:00
[bearerAuth](../README.md#bearerAuth)
2022-09-12 15:02:35 +00:00
### 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 | - |
2022-09-12 15:02:35 +00:00
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **delete_key**
> delete_key(access_key)
2022-09-12 15:02:35 +00:00
Delete a key
2022-09-12 15:02:35 +00:00
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.
2022-09-12 15:02:35 +00:00
### Example
2022-09-12 15:13:43 +00:00
* Bearer Authentication (bearerAuth):
2022-09-12 15:02:35 +00:00
```python
import time
2022-09-13 14:00:03 +00:00
import garage_admin_sdk
from garage_admin_sdk.api import key_api
2022-09-12 15:02:35 +00:00
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.
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)
access_key = "GK31c2f218a2e44f485b94239e" # str | The exact API access key generated by Garage
2022-09-12 15:02:35 +00:00
# example passing only required values which don't have defaults set
try:
# Delete a key
api_instance.delete_key(access_key)
2022-09-13 14:00:03 +00:00
except garage_admin_sdk.ApiException as e:
print("Exception when calling KeyApi->delete_key: %s\n" % e)
2022-09-12 15:02:35 +00:00
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**access_key** | **str**| The exact API access key generated by Garage |
2022-09-12 15:02:35 +00:00
### Return type
void (empty response body)
2022-09-12 15:02:35 +00:00
### Authorization
2022-09-12 15:13:43 +00:00
[bearerAuth](../README.md#bearerAuth)
2022-09-12 15:02:35 +00:00
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
2022-09-12 15:02:35 +00:00
### 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 | - |
2022-09-12 15:02:35 +00:00
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **get_key**
> KeyInfo get_key(access_key)
2022-09-12 15:02:35 +00:00
Get key information
Return information about a specific key and return its information
2022-09-12 15:02:35 +00:00
### Example
2022-09-12 15:13:43 +00:00
* Bearer Authentication (bearerAuth):
2022-09-12 15:02:35 +00:00
```python
import time
2022-09-13 14:00:03 +00:00
import garage_admin_sdk
from garage_admin_sdk.api import key_api
from garage_admin_sdk.model.key_info import KeyInfo
2022-09-12 15:02:35 +00:00
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.
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)
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)
2022-09-13 14:00:03 +00:00
except garage_admin_sdk.ApiException as e:
print("Exception when calling KeyApi->get_key: %s\n" % e)
2022-09-12 15:02:35 +00:00
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**access_key** | **str**| The exact API access key generated by Garage |
### Return type
[**KeyInfo**](KeyInfo.md)
2022-09-12 15:02:35 +00:00
### Authorization
2022-09-12 15:13:43 +00:00
[bearerAuth](../README.md#bearerAuth)
2022-09-12 15:02:35 +00:00
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
2022-09-12 15:02:35 +00:00
### 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 | - |
2022-09-12 15:02:35 +00:00
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **import_key**
> KeyInfo import_key()
2022-09-12 15:02:35 +00:00
Import an existing key
2022-09-12 15:02:35 +00:00
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.**
2022-09-12 15:02:35 +00:00
### Example
2022-09-12 15:13:43 +00:00
* Bearer Authentication (bearerAuth):
2022-09-12 15:02:35 +00:00
```python
import time
2022-09-13 14:00:03 +00:00
import garage_admin_sdk
from garage_admin_sdk.api import key_api
from garage_admin_sdk.model.import_key_request import ImportKeyRequest
2022-09-13 14:00:03 +00:00
from garage_admin_sdk.model.key_info import KeyInfo
2022-09-12 15:02:35 +00:00
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.
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)
import_key_request = ImportKeyRequest(
name="test-key",
access_key_id="GK31c2f218a2e44f485b94239e",
secret_access_key="b892c0665f0ada8a4755dae98baa3b133590e11dae3bcc1f9d769d67f16c3835",
) # ImportKeyRequest | Information on the key to import (optional)
2022-09-12 15:02:35 +00:00
# example passing only required values which don't have defaults set
# and optional values
2022-09-12 15:02:35 +00:00
try:
# Import an existing key
api_response = api_instance.import_key(import_key_request=import_key_request)
2022-09-12 15:02:35 +00:00
pprint(api_response)
2022-09-13 14:00:03 +00:00
except garage_admin_sdk.ApiException as e:
print("Exception when calling KeyApi->import_key: %s\n" % e)
2022-09-12 15:02:35 +00:00
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**import_key_request** | [**ImportKeyRequest**](ImportKeyRequest.md)| Information on the key to import | [optional]
2022-09-12 15:02:35 +00:00
### Return type
[**KeyInfo**](KeyInfo.md)
### Authorization
2022-09-12 15:13:43 +00:00
[bearerAuth](../README.md#bearerAuth)
2022-09-12 15:02:35 +00:00
### HTTP request headers
- **Content-Type**: application/json
2022-09-12 15:02:35 +00:00
- **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 | - |
2022-09-12 15:02:35 +00:00
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **list_keys**
> [ListKeys200ResponseInner] list_keys()
2022-09-12 15:02:35 +00:00
List all keys
2022-09-12 15:02:35 +00:00
Returns all API access keys in the cluster.
2022-09-12 15:02:35 +00:00
### Example
2022-09-12 15:13:43 +00:00
* Bearer Authentication (bearerAuth):
2022-09-12 15:02:35 +00:00
```python
import time
2022-09-13 14:00:03 +00:00
import garage_admin_sdk
from garage_admin_sdk.api import key_api
from garage_admin_sdk.model.list_keys200_response_inner import ListKeys200ResponseInner
2022-09-12 15:02:35 +00:00
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.
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)
# example, this endpoint has no required or optional parameters
2022-09-12 15:02:35 +00:00
try:
# List all keys
api_response = api_instance.list_keys()
2022-09-12 15:02:35 +00:00
pprint(api_response)
2022-09-13 14:00:03 +00:00
except garage_admin_sdk.ApiException as e:
print("Exception when calling KeyApi->list_keys: %s\n" % e)
2022-09-12 15:02:35 +00:00
```
### Parameters
This endpoint does not need any parameter.
2022-09-12 15:02:35 +00:00
### Return type
[**[ListKeys200ResponseInner]**](ListKeys200ResponseInner.md)
2022-09-12 15:02:35 +00:00
### Authorization
2022-09-12 15:13:43 +00:00
[bearerAuth](../README.md#bearerAuth)
2022-09-12 15:02:35 +00:00
### HTTP request headers
- **Content-Type**: Not defined
2022-09-12 15:02:35 +00:00
- **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) | - |
2022-09-12 15:02:35 +00:00
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **search_key**
> KeyInfo search_key(pattern)
2022-09-12 15:02:35 +00:00
Select key by pattern
Find the first key matching the given pattern based on its identifier aor friendly name and return its information.
### Example
2022-09-12 15:13:43 +00:00
* Bearer Authentication (bearerAuth):
2022-09-12 15:02:35 +00:00
```python
import time
2022-09-13 14:00:03 +00:00
import garage_admin_sdk
from garage_admin_sdk.api import key_api
from garage_admin_sdk.model.key_info import KeyInfo
2022-09-12 15:02:35 +00:00
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.
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)
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)
2022-09-12 15:02:35 +00:00
pprint(api_response)
2022-09-13 14:00:03 +00:00
except garage_admin_sdk.ApiException as e:
print("Exception when calling KeyApi->search_key: %s\n" % e)
2022-09-12 15:02:35 +00:00
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pattern** | **str**| A pattern (beginning or full string) corresponding to a key identifier or friendly name |
### Return type
[**KeyInfo**](KeyInfo.md)
### Authorization
2022-09-12 15:13:43 +00:00
[bearerAuth](../README.md#bearerAuth)
2022-09-12 15:02:35 +00:00
### 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]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **update_key**
> KeyInfo update_key(access_key)
2022-09-12 15:02:35 +00:00
Update a key
2022-09-12 15:02:35 +00:00
Updates information about the specified API access key.
2022-09-12 15:02:35 +00:00
### Example
2022-09-12 15:13:43 +00:00
* Bearer Authentication (bearerAuth):
2022-09-12 15:02:35 +00:00
```python
import time
2022-09-13 14:00:03 +00:00
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
2022-09-12 15:02:35 +00:00
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.
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)
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 (optional)
2022-09-12 15:02:35 +00:00
# example passing only required values which don't have defaults set
2022-09-12 15:02:35 +00:00
try:
# Update a key
api_response = api_instance.update_key(access_key)
2022-09-12 15:02:35 +00:00
pprint(api_response)
2022-09-13 14:00:03 +00:00
except garage_admin_sdk.ApiException as e:
print("Exception when calling KeyApi->update_key: %s\n" % e)
# example passing only required values which don't have defaults set
# and optional values
try:
# Update a key
api_response = api_instance.update_key(access_key, update_key_request=update_key_request)
pprint(api_response)
except garage_admin_sdk.ApiException as e:
print("Exception when calling KeyApi->update_key: %s\n" % e)
2022-09-12 15:02:35 +00:00
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**access_key** | **str**| The exact API access key generated by Garage |
**update_key_request** | [**UpdateKeyRequest**](UpdateKeyRequest.md)| For a given key, provide a first set with the permissions to grant, and a second set with the permissions to remove | [optional]
2022-09-12 15:02:35 +00:00
### Return type
[**KeyInfo**](KeyInfo.md)
2022-09-12 15:02:35 +00:00
### Authorization
2022-09-12 15:13:43 +00:00
[bearerAuth](../README.md#bearerAuth)
2022-09-12 15:02:35 +00:00
### HTTP request headers
- **Content-Type**: application/json
2022-09-12 15:02:35 +00:00
- **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 | - |
2022-09-12 15:02:35 +00:00
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)