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

20 KiB

garage_admin_sdk.KeyApi

All URIs are relative to http://localhost:3903/v0

Method HTTP request Description
key_import_post POST /key/import Import an existing key
key_post POST /key Create a new API key
keyidaccess_key_delete DELETE /key?id={access_key} Delete a key
keyidaccess_key_get GET /key?id={access_key} Get key information
keyidaccess_key_post POST /key?id={access_key} Update a key
keysearchpattern_get GET /key?search={pattern} Select key by pattern
list_keys GET /key List all keys

key_import_post

KeyInfo key_import_post()

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.key_import_post_request import KeyImportPostRequest
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)
    key_import_post_request = KeyImportPostRequest(
        name="test-key",
        access_key_id="GK31c2f218a2e44f485b94239e",
        secret_access_key="b892c0665f0ada8a4755dae98baa3b133590e11dae3bcc1f9d769d67f16c3835",
    ) # KeyImportPostRequest | Information on the key to import  (optional)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Import an existing key
        api_response = api_instance.key_import_post(key_import_post_request=key_import_post_request)
        pprint(api_response)
    except garage_admin_sdk.ApiException as e:
        print("Exception when calling KeyApi->key_import_post: %s\n" % e)

Parameters

Name Type Description Notes
key_import_post_request KeyImportPostRequest Information on the key to import [optional]

Return type

KeyInfo

Authorization

bearerAuth

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]

key_post

KeyInfo key_post()

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_get_request import KeyGetRequest
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)
    key_get_request = KeyGetRequest(
        name="test-key",
    ) # KeyGetRequest | \"You can optionnaly set a friendly name for this key\"  (optional)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Create a new API key
        api_response = api_instance.key_post(key_get_request=key_get_request)
        pprint(api_response)
    except garage_admin_sdk.ApiException as e:
        print("Exception when calling KeyApi->key_post: %s\n" % e)

Parameters

Name Type Description Notes
key_get_request KeyGetRequest "You can optionnaly set a friendly name for this key" [optional]

Return type

KeyInfo

Authorization

bearerAuth

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]

keyidaccess_key_delete

keyidaccess_key_delete(access_key)

Delete a key

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.keyidaccess_key_delete(access_key)
    except garage_admin_sdk.ApiException as e:
        print("Exception when calling KeyApi->keyidaccess_key_delete: %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

bearerAuth

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]

keyidaccess_key_get

KeyInfo keyidaccess_key_get(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.keyidaccess_key_get(access_key)
        pprint(api_response)
    except garage_admin_sdk.ApiException as e:
        print("Exception when calling KeyApi->keyidaccess_key_get: %s\n" % e)

Parameters

Name Type Description Notes
access_key str The exact API access key generated by Garage

Return type

KeyInfo

Authorization

bearerAuth

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]

keyidaccess_key_post

KeyInfo keyidaccess_key_post(access_key)

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.key_id_access_key_delete_request import KeyIdAccessKeyDeleteRequest
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
    key_id_access_key_delete_request = KeyIdAccessKeyDeleteRequest(
        name="test-key",
        allow=KeyIdAccessKeyDeleteRequestAllow(
            create_bucket=True,
        ),
        deny=KeyIdAccessKeyDeleteRequestDeny(
            create_bucket=True,
        ),
    ) # KeyIdAccessKeyDeleteRequest | For a given key, provide a first set with the permissions to grant, and a second set with the permissions to remove  (optional)

    # example passing only required values which don't have defaults set
    try:
        # Update a key
        api_response = api_instance.keyidaccess_key_post(access_key)
        pprint(api_response)
    except garage_admin_sdk.ApiException as e:
        print("Exception when calling KeyApi->keyidaccess_key_post: %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.keyidaccess_key_post(access_key, key_id_access_key_delete_request=key_id_access_key_delete_request)
        pprint(api_response)
    except garage_admin_sdk.ApiException as e:
        print("Exception when calling KeyApi->keyidaccess_key_post: %s\n" % e)

Parameters

Name Type Description Notes
access_key str The exact API access key generated by Garage
key_id_access_key_delete_request KeyIdAccessKeyDeleteRequest For a given key, provide a first set with the permissions to grant, and a second set with the permissions to remove [optional]

Return type

KeyInfo

Authorization

bearerAuth

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]

keysearchpattern_get

KeyInfo keysearchpattern_get(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.keysearchpattern_get(pattern)
        pprint(api_response)
    except garage_admin_sdk.ApiException as e:
        print("Exception when calling KeyApi->keysearchpattern_get: %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

KeyInfo

Authorization

bearerAuth

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]

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

**[ListKeys200ResponseInner]**

Authorization

bearerAuth

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]