From b916cc1b32c2e63d9f05baca90be1004f7b85963 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Mon, 12 Sep 2022 17:13:43 +0200 Subject: [PATCH] Add authentication --- python/.openapi-generator/FILES | 19 ---- python/README.md | 15 +++- python/docs/KeyApi.md | 98 ++++++++++++++++++--- python/docs/LayoutApi.md | 56 ++++++++++-- python/docs/MembershipApi.md | 28 +++++- python/openapi_client/api/key_api.py | 28 ++++-- python/openapi_client/api/layout_api.py | 16 +++- python/openapi_client/api/membership_api.py | 8 +- python/openapi_client/configuration.py | 8 ++ 9 files changed, 217 insertions(+), 59 deletions(-) diff --git a/python/.openapi-generator/FILES b/python/.openapi-generator/FILES index 13a9d9b..9d5b133 100644 --- a/python/.openapi-generator/FILES +++ b/python/.openapi-generator/FILES @@ -1,6 +1,5 @@ .gitignore .gitlab-ci.yml -.openapi-generator-ignore .travis.yml README.md docs/ClusterLayout.md @@ -55,22 +54,4 @@ setup.cfg setup.py test-requirements.txt test/__init__.py -test/test_cluster_layout.py -test/test_connect_post200_response_inner.py -test/test_key_api.py -test/test_key_get_request.py -test/test_key_id_access_key_delete_request.py -test/test_key_id_access_key_delete_request_allow.py -test/test_key_import_post_request.py -test/test_key_info.py -test/test_key_info_buckets_inner.py -test/test_key_info_buckets_inner_permissions.py -test/test_key_info_permissions.py -test/test_layout_api.py -test/test_layout_version.py -test/test_list_keys200_response_inner.py -test/test_membership_api.py -test/test_node_cluster_info.py -test/test_node_network_info.py -test/test_status_get200_response.py tox.ini diff --git a/python/README.md b/python/README.md index 3263403..f962f51 100644 --- a/python/README.md +++ b/python/README.md @@ -64,6 +64,15 @@ configuration = openapi_client.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 = openapi_client.Configuration( + access_token = 'YOUR_BEARER_TOKEN' +) # Enter a context with an instance of the API client @@ -126,7 +135,11 @@ Class | Method | HTTP request | Description ## Documentation For Authorization - All endpoints do not require authorization. + +## bearerAuth + +- **Type**: Bearer authentication + ## Author diff --git a/python/docs/KeyApi.md b/python/docs/KeyApi.md index 6d0f58b..23223b1 100644 --- a/python/docs/KeyApi.md +++ b/python/docs/KeyApi.md @@ -22,6 +22,7 @@ Imports an existing API key. This feature must only be used for migrations and b ### Example +* Bearer Authentication (bearerAuth): ```python import time @@ -36,9 +37,18 @@ configuration = openapi_client.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 = openapi_client.Configuration( + access_token = 'YOUR_BEARER_TOKEN' +) # Enter a context with an instance of the API client -with openapi_client.ApiClient() as api_client: +with openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = key_api.KeyApi(api_client) key_import_post_request = KeyImportPostRequest( @@ -70,7 +80,7 @@ Name | Type | Description | Notes ### Authorization -No authorization required +[bearerAuth](../README.md#bearerAuth) ### HTTP request headers @@ -97,6 +107,7 @@ Creates a new API access key. ### Example +* Bearer Authentication (bearerAuth): ```python import time @@ -111,9 +122,18 @@ configuration = openapi_client.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 = openapi_client.Configuration( + access_token = 'YOUR_BEARER_TOKEN' +) # Enter a context with an instance of the API client -with openapi_client.ApiClient() as api_client: +with openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = key_api.KeyApi(api_client) key_get_request = KeyGetRequest( @@ -143,7 +163,7 @@ Name | Type | Description | Notes ### Authorization -No authorization required +[bearerAuth](../README.md#bearerAuth) ### HTTP request headers @@ -168,6 +188,7 @@ Delete a key ### Example +* Bearer Authentication (bearerAuth): ```python import time @@ -180,9 +201,18 @@ configuration = openapi_client.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 = openapi_client.Configuration( + access_token = 'YOUR_BEARER_TOKEN' +) # Enter a context with an instance of the API client -with openapi_client.ApiClient() as api_client: +with openapi_client.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 @@ -208,7 +238,7 @@ void (empty response body) ### Authorization -No authorization required +[bearerAuth](../README.md#bearerAuth) ### HTTP request headers @@ -234,6 +264,7 @@ Return information about a specific key and return its information ### Example +* Bearer Authentication (bearerAuth): ```python import time @@ -247,9 +278,18 @@ configuration = openapi_client.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 = openapi_client.Configuration( + access_token = 'YOUR_BEARER_TOKEN' +) # Enter a context with an instance of the API client -with openapi_client.ApiClient() as api_client: +with openapi_client.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 @@ -276,7 +316,7 @@ Name | Type | Description | Notes ### Authorization -No authorization required +[bearerAuth](../README.md#bearerAuth) ### HTTP request headers @@ -302,6 +342,7 @@ Updates information about the specified API access key. ### Example +* Bearer Authentication (bearerAuth): ```python import time @@ -316,9 +357,18 @@ configuration = openapi_client.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 = openapi_client.Configuration( + access_token = 'YOUR_BEARER_TOKEN' +) # Enter a context with an instance of the API client -with openapi_client.ApiClient() as api_client: +with openapi_client.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 @@ -364,7 +414,7 @@ Name | Type | Description | Notes ### Authorization -No authorization required +[bearerAuth](../README.md#bearerAuth) ### HTTP request headers @@ -391,6 +441,7 @@ Find the first key matching the given pattern based on its identifier aor friend ### Example +* Bearer Authentication (bearerAuth): ```python import time @@ -404,9 +455,18 @@ configuration = openapi_client.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 = openapi_client.Configuration( + access_token = 'YOUR_BEARER_TOKEN' +) # Enter a context with an instance of the API client -with openapi_client.ApiClient() as api_client: +with openapi_client.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 @@ -433,7 +493,7 @@ Name | Type | Description | Notes ### Authorization -No authorization required +[bearerAuth](../README.md#bearerAuth) ### HTTP request headers @@ -459,6 +519,7 @@ Returns all API access keys in the cluster. ### Example +* Bearer Authentication (bearerAuth): ```python import time @@ -472,9 +533,18 @@ configuration = openapi_client.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 = openapi_client.Configuration( + access_token = 'YOUR_BEARER_TOKEN' +) # Enter a context with an instance of the API client -with openapi_client.ApiClient() as api_client: +with openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = key_api.KeyApi(api_client) @@ -497,7 +567,7 @@ This endpoint does not need any parameter. ### Authorization -No authorization required +[bearerAuth](../README.md#bearerAuth) ### HTTP request headers diff --git a/python/docs/LayoutApi.md b/python/docs/LayoutApi.md index 4c3e266..3801170 100644 --- a/python/docs/LayoutApi.md +++ b/python/docs/LayoutApi.md @@ -19,6 +19,7 @@ Applies to the cluster the layout changes currently registered as staged layout ### Example +* Bearer Authentication (bearerAuth): ```python import time @@ -32,9 +33,18 @@ configuration = openapi_client.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 = openapi_client.Configuration( + access_token = 'YOUR_BEARER_TOKEN' +) # Enter a context with an instance of the API client -with openapi_client.ApiClient() as api_client: +with openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = layout_api.LayoutApi(api_client) layout_version = LayoutVersion( @@ -63,7 +73,7 @@ void (empty response body) ### Authorization -No authorization required +[bearerAuth](../README.md#bearerAuth) ### HTTP request headers @@ -90,6 +100,7 @@ Returns the cluster's current layout, including: - Currently configured cluste ### Example +* Bearer Authentication (bearerAuth): ```python import time @@ -103,9 +114,18 @@ configuration = openapi_client.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 = openapi_client.Configuration( + access_token = 'YOUR_BEARER_TOKEN' +) # Enter a context with an instance of the API client -with openapi_client.ApiClient() as api_client: +with openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = layout_api.LayoutApi(api_client) @@ -128,7 +148,7 @@ This endpoint does not need any parameter. ### Authorization -No authorization required +[bearerAuth](../README.md#bearerAuth) ### HTTP request headers @@ -154,6 +174,7 @@ Send modifications to the cluster layout. These modifications will be included i ### Example +* Bearer Authentication (bearerAuth): ```python import time @@ -167,9 +188,18 @@ configuration = openapi_client.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 = openapi_client.Configuration( + access_token = 'YOUR_BEARER_TOKEN' +) # Enter a context with an instance of the API client -with openapi_client.ApiClient() as api_client: +with openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = layout_api.LayoutApi(api_client) request_body = { @@ -198,7 +228,7 @@ void (empty response body) ### Authorization -No authorization required +[bearerAuth](../README.md#bearerAuth) ### HTTP request headers @@ -225,6 +255,7 @@ Clears all of the staged layout changes. ### Example +* Bearer Authentication (bearerAuth): ```python import time @@ -238,9 +269,18 @@ configuration = openapi_client.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 = openapi_client.Configuration( + access_token = 'YOUR_BEARER_TOKEN' +) # Enter a context with an instance of the API client -with openapi_client.ApiClient() as api_client: +with openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = layout_api.LayoutApi(api_client) layout_version = LayoutVersion( @@ -269,7 +309,7 @@ void (empty response body) ### Authorization -No authorization required +[bearerAuth](../README.md#bearerAuth) ### HTTP request headers diff --git a/python/docs/MembershipApi.md b/python/docs/MembershipApi.md index 62fe455..4a41e10 100644 --- a/python/docs/MembershipApi.md +++ b/python/docs/MembershipApi.md @@ -17,6 +17,7 @@ Instructs this Garage node to connect to other Garage nodes at specified `