From 0e76d0eb8c43fc958bac9d7159321d99368bda37 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Wed, 22 Nov 2023 20:48:12 +0100 Subject: [PATCH] api-v1, 2nd iteration --- .openapi-generator/FILES | 4 - README.md | 22 ++- docs/BucketApi.md | 117 +++------------- docs/KeyApi.md | 120 ++--------------- garage_admin_sdk/__init__.py | 2 +- garage_admin_sdk/api/bucket_api.py | 210 ++++++----------------------- garage_admin_sdk/api/key_api.py | 178 +++--------------------- garage_admin_sdk/api_client.py | 2 +- garage_admin_sdk/configuration.py | 2 +- setup.py | 2 +- 10 files changed, 103 insertions(+), 556 deletions(-) diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 88627a1..21f1d20 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -94,8 +94,4 @@ setup.cfg setup.py test-requirements.txt test/__init__.py -test/test_apply_layout200_response.py -test/test_node_role_change.py -test/test_node_role_remove.py -test/test_node_role_update.py tox.ini diff --git a/README.md b/README.md index 277b25b..7c32fbc 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Administrate your Garage cluster programatically, including status, layout, keys This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: v0.9.0 -- Package version: 0.8.0 +- Package version: 0.9.0 - Build package: org.openapitools.codegen.languages.PythonClientCodegen ## Requirements. @@ -105,23 +105,21 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *BucketApi* | [**allow_bucket_key**](docs/BucketApi.md#allow_bucket_key) | **POST** /bucket/allow | Allow key *BucketApi* | [**create_bucket**](docs/BucketApi.md#create_bucket) | **POST** /bucket | Create a bucket -*BucketApi* | [**delete_bucket**](docs/BucketApi.md#delete_bucket) | **DELETE** /bucket?id={bucket_id} | Delete a bucket +*BucketApi* | [**delete_bucket**](docs/BucketApi.md#delete_bucket) | **DELETE** /bucket | Delete a bucket *BucketApi* | [**delete_bucket_global_alias**](docs/BucketApi.md#delete_bucket_global_alias) | **DELETE** /bucket/alias/global | Delete a global alias *BucketApi* | [**delete_bucket_local_alias**](docs/BucketApi.md#delete_bucket_local_alias) | **DELETE** /bucket/alias/local | Delete a local alias *BucketApi* | [**deny_bucket_key**](docs/BucketApi.md#deny_bucket_key) | **POST** /bucket/deny | Deny key -*BucketApi* | [**find_bucket_info**](docs/BucketApi.md#find_bucket_info) | **GET** /bucket?globalAlias={alias} | Find a bucket -*BucketApi* | [**get_bucket_info**](docs/BucketApi.md#get_bucket_info) | **GET** /bucket?id={bucket_id} | Get a bucket -*BucketApi* | [**list_buckets**](docs/BucketApi.md#list_buckets) | **GET** /bucket | List all buckets +*BucketApi* | [**get_bucket_info**](docs/BucketApi.md#get_bucket_info) | **GET** /bucket | Get a bucket +*BucketApi* | [**list_buckets**](docs/BucketApi.md#list_buckets) | **GET** /bucket?list | List all buckets *BucketApi* | [**put_bucket_global_alias**](docs/BucketApi.md#put_bucket_global_alias) | **PUT** /bucket/alias/global | Add a global alias *BucketApi* | [**put_bucket_local_alias**](docs/BucketApi.md#put_bucket_local_alias) | **PUT** /bucket/alias/local | Add a local alias -*BucketApi* | [**update_bucket**](docs/BucketApi.md#update_bucket) | **PUT** /bucket?id={bucket_id} | Update a bucket -*KeyApi* | [**add_key**](docs/KeyApi.md#add_key) | **POST** /key | Create a new API key -*KeyApi* | [**delete_key**](docs/KeyApi.md#delete_key) | **DELETE** /key?id={access_key} | Delete a key -*KeyApi* | [**get_key**](docs/KeyApi.md#get_key) | **GET** /key?id={access_key} | Get key information +*BucketApi* | [**update_bucket**](docs/BucketApi.md#update_bucket) | **PUT** /bucket | Update a bucket +*KeyApi* | [**add_key**](docs/KeyApi.md#add_key) | **POST** /key?list | Create a new API key +*KeyApi* | [**delete_key**](docs/KeyApi.md#delete_key) | **DELETE** /key | Delete a key +*KeyApi* | [**get_key**](docs/KeyApi.md#get_key) | **GET** /key | Get key information *KeyApi* | [**import_key**](docs/KeyApi.md#import_key) | **POST** /key/import | Import an existing key -*KeyApi* | [**list_keys**](docs/KeyApi.md#list_keys) | **GET** /key | List all keys -*KeyApi* | [**search_key**](docs/KeyApi.md#search_key) | **GET** /key?search={pattern} | Select key by pattern -*KeyApi* | [**update_key**](docs/KeyApi.md#update_key) | **POST** /key?id={access_key} | Update a key +*KeyApi* | [**list_keys**](docs/KeyApi.md#list_keys) | **GET** /key?list | List all keys +*KeyApi* | [**update_key**](docs/KeyApi.md#update_key) | **POST** /key | Update a key *LayoutApi* | [**add_layout**](docs/LayoutApi.md#add_layout) | **POST** /layout | Send modifications to the cluster layout *LayoutApi* | [**apply_layout**](docs/LayoutApi.md#apply_layout) | **POST** /layout/apply | Apply staged layout *LayoutApi* | [**get_layout**](docs/LayoutApi.md#get_layout) | **GET** /layout | Details on the current and staged layout diff --git a/docs/BucketApi.md b/docs/BucketApi.md index ae47cde..492bfad 100644 --- a/docs/BucketApi.md +++ b/docs/BucketApi.md @@ -6,16 +6,15 @@ Method | HTTP request | Description ------------- | ------------- | ------------- [**allow_bucket_key**](BucketApi.md#allow_bucket_key) | **POST** /bucket/allow | Allow key [**create_bucket**](BucketApi.md#create_bucket) | **POST** /bucket | Create a bucket -[**delete_bucket**](BucketApi.md#delete_bucket) | **DELETE** /bucket?id={bucket_id} | Delete a bucket +[**delete_bucket**](BucketApi.md#delete_bucket) | **DELETE** /bucket | Delete a bucket [**delete_bucket_global_alias**](BucketApi.md#delete_bucket_global_alias) | **DELETE** /bucket/alias/global | Delete a global alias [**delete_bucket_local_alias**](BucketApi.md#delete_bucket_local_alias) | **DELETE** /bucket/alias/local | Delete a local alias [**deny_bucket_key**](BucketApi.md#deny_bucket_key) | **POST** /bucket/deny | Deny key -[**find_bucket_info**](BucketApi.md#find_bucket_info) | **GET** /bucket?globalAlias={alias} | Find a bucket -[**get_bucket_info**](BucketApi.md#get_bucket_info) | **GET** /bucket?id={bucket_id} | Get a bucket -[**list_buckets**](BucketApi.md#list_buckets) | **GET** /bucket | List all buckets +[**get_bucket_info**](BucketApi.md#get_bucket_info) | **GET** /bucket | Get a bucket +[**list_buckets**](BucketApi.md#list_buckets) | **GET** /bucket?list | List all buckets [**put_bucket_global_alias**](BucketApi.md#put_bucket_global_alias) | **PUT** /bucket/alias/global | Add a global alias [**put_bucket_local_alias**](BucketApi.md#put_bucket_local_alias) | **PUT** /bucket/alias/local | Add a local alias -[**update_bucket**](BucketApi.md#update_bucket) | **PUT** /bucket?id={bucket_id} | Update a bucket +[**update_bucket**](BucketApi.md#update_bucket) | **PUT** /bucket | Update a bucket # **allow_bucket_key** @@ -199,7 +198,7 @@ Name | Type | Description | Notes [[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_bucket** -> delete_bucket(bucket_id) +> delete_bucket(id) Delete a bucket @@ -234,12 +233,12 @@ configuration = garage_admin_sdk.Configuration( with garage_admin_sdk.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = bucket_api.BucketApi(api_client) - bucket_id = "b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87" # str | The exact bucket identifier, a 32 bytes hexadecimal string + id = "b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87" # str | The exact bucket identifier, a 32 bytes hexadecimal string # example passing only required values which don't have defaults set try: # Delete a bucket - api_instance.delete_bucket(bucket_id) + api_instance.delete_bucket(id) except garage_admin_sdk.ApiException as e: print("Exception when calling BucketApi->delete_bucket: %s\n" % e) ``` @@ -249,7 +248,7 @@ with garage_admin_sdk.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **bucket_id** | **str**| The exact bucket identifier, a 32 bytes hexadecimal string | + **id** | **str**| The exact bucket identifier, a 32 bytes hexadecimal string | ### Return type @@ -531,91 +530,12 @@ Name | Type | Description | Notes [[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) -# **find_bucket_info** -> BucketInfo find_bucket_info(alias) - -Find a bucket - -Find a bucket by its global alias - -### Example - -* Bearer Authentication (bearerAuth): - -```python -import time -import garage_admin_sdk -from garage_admin_sdk.api import bucket_api -from garage_admin_sdk.model.bucket_info import BucketInfo -from pprint import pprint -# 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) - alias = "my_documents" # str | The exact global alias of one of the existing buckets - - # example passing only required values which don't have defaults set - try: - # Find a bucket - api_response = api_instance.find_bucket_info(alias) - pprint(api_response) - except garage_admin_sdk.ApiException as e: - print("Exception when calling BucketApi->find_bucket_info: %s\n" % e) -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **alias** | **str**| The exact global alias of one of the existing buckets | - -### Return type - -[**BucketInfo**](BucketInfo.md) - -### Authorization - -[bearerAuth](../README.md#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. | - | -**404** | Bucket not found | - | -**200** | Returns exhaustive information about the bucket | - | - -[[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_bucket_info** -> BucketInfo get_bucket_info(bucket_id) +> BucketInfo get_bucket_info() Get a bucket -Given a bucket identifier, get its information. It includes its aliases, its web configuration, keys that have some permissions on it, some statistics (number of objects, size), number of dangling multipart uploads, and its quotas (if any). +Given a bucket identifier (`id`) or a global alias (`alias`), get its information. It includes its aliases, its web configuration, keys that have some permissions on it, some statistics (number of objects, size), number of dangling multipart uploads, and its quotas (if any). ### Example @@ -647,12 +567,14 @@ configuration = garage_admin_sdk.Configuration( with garage_admin_sdk.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = bucket_api.BucketApi(api_client) - bucket_id = "b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87" # str | The exact bucket identifier, a 32 bytes hexadecimal string + id = "b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87" # str | The exact bucket identifier, a 32 bytes hexadecimal string. Incompatible with `alias`. (optional) + alias = "my_documents" # str | The exact global alias of one of the existing buckets. Incompatible with `id`. (optional) # example passing only required values which don't have defaults set + # and optional values try: # Get a bucket - api_response = api_instance.get_bucket_info(bucket_id) + api_response = api_instance.get_bucket_info(id=id, alias=alias) pprint(api_response) except garage_admin_sdk.ApiException as e: print("Exception when calling BucketApi->get_bucket_info: %s\n" % e) @@ -663,7 +585,8 @@ with garage_admin_sdk.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **bucket_id** | **str**| The exact bucket identifier, a 32 bytes hexadecimal string | + **id** | **str**| The exact bucket identifier, a 32 bytes hexadecimal string. Incompatible with `alias`. | [optional] + **alias** | **str**| The exact global alias of one of the existing buckets. Incompatible with `id`. | [optional] ### Return type @@ -930,7 +853,7 @@ Name | Type | Description | Notes [[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_bucket** -> BucketInfo update_bucket(bucket_id, update_bucket_request) +> BucketInfo update_bucket(id, update_bucket_request) Update a bucket @@ -967,7 +890,7 @@ configuration = garage_admin_sdk.Configuration( with garage_admin_sdk.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = bucket_api.BucketApi(api_client) - bucket_id = "b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87" # str | The exact bucket identifier, a 32 bytes hexadecimal string + id = "b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87" # str | The exact bucket identifier, a 32 bytes hexadecimal string update_bucket_request = UpdateBucketRequest( website_access=UpdateBucketRequestWebsiteAccess( enabled=True, @@ -983,7 +906,7 @@ with garage_admin_sdk.ApiClient(configuration) as api_client: # example passing only required values which don't have defaults set try: # Update a bucket - api_response = api_instance.update_bucket(bucket_id, update_bucket_request) + api_response = api_instance.update_bucket(id, update_bucket_request) pprint(api_response) except garage_admin_sdk.ApiException as e: print("Exception when calling BucketApi->update_bucket: %s\n" % e) @@ -994,7 +917,7 @@ with garage_admin_sdk.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **bucket_id** | **str**| The exact bucket identifier, a 32 bytes hexadecimal string | + **id** | **str**| The exact bucket identifier, a 32 bytes hexadecimal string | **update_bucket_request** | [**UpdateBucketRequest**](UpdateBucketRequest.md)| Requested changes on the bucket. Both root fields are optionals. | ### Return type diff --git a/docs/KeyApi.md b/docs/KeyApi.md index aa64851..29ecaf9 100644 --- a/docs/KeyApi.md +++ b/docs/KeyApi.md @@ -4,13 +4,12 @@ All URIs are relative to *http://localhost:3903/v1* 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 +[**add_key**](KeyApi.md#add_key) | **POST** /key?list | Create a new API key +[**delete_key**](KeyApi.md#delete_key) | **DELETE** /key | Delete a key +[**get_key**](KeyApi.md#get_key) | **GET** /key | Get key information [**import_key**](KeyApi.md#import_key) | **POST** /key/import | Import an existing key -[**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 +[**list_keys**](KeyApi.md#list_keys) | **GET** /key?list | List all keys +[**update_key**](KeyApi.md#update_key) | **POST** /key | Update a key # **add_key** @@ -172,11 +171,11 @@ void (empty response body) [[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) +> KeyInfo get_key() Get key information -Return information about a specific key like its identifiers, its permissions and buckets on which it has permissions. For confidentiality reasons, the secret key is not returned by default: you must pass the `showSecretKey` query parameter to get it. +Return information about a specific key like its identifiers, its permissions and buckets on which it has permissions. You can search by specifying the exact key identifier (`id`) or by specifying a pattern (`search`). For confidentiality reasons, the secret key is not returned by default: you must pass the `showSecretKey` query parameter to get it. ### Example @@ -208,22 +207,15 @@ configuration = garage_admin_sdk.Configuration( 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 + id = "GK31c2f218a2e44f485b94239e" # str | The exact API access key generated by Garage. Incompatible with `search`. (optional) + search = "test-k" # str | A pattern (beginning or full string) corresponding to a key identifier or friendly name. Incompatible with `id`. (optional) show_secret_key = True # bool | Wether or not the secret key should be returned in the response (optional) if omitted the server will use the default value of False - # 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) - # example passing only required values which don't have defaults set # and optional values try: # Get key information - api_response = api_instance.get_key(access_key, show_secret_key=show_secret_key) + api_response = api_instance.get_key(id=id, search=search, show_secret_key=show_secret_key) pprint(api_response) except garage_admin_sdk.ApiException as e: print("Exception when calling KeyApi->get_key: %s\n" % e) @@ -234,7 +226,8 @@ with garage_admin_sdk.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **access_key** | **str**| The exact API access key generated by Garage | + **id** | **str**| The exact API access key generated by Garage. Incompatible with `search`. | [optional] + **search** | **str**| A pattern (beginning or full string) corresponding to a key identifier or friendly name. Incompatible with `id`. | [optional] **show_secret_key** | **bool**| Wether or not the secret key should be returned in the response | [optional] if omitted the server will use the default value of False ### Return type @@ -418,95 +411,6 @@ This endpoint does not need any parameter. [[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) - -Select key by pattern - -Find the first key matching the given pattern based on its identifier or friendly name and return its information. For confidentiality reasons, the secret key is not returned by default: you must pass the `showSecretKey` query parameter to get it. - -### Example - -* Bearer Authentication (bearerAuth): - -```python -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/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 = key_api.KeyApi(api_client) - pattern = "test-k" # str | A pattern (beginning or full string) corresponding to a key identifier or friendly name - show_secret_key = True # bool | Wether or not the secret key should be returned in the response (optional) if omitted the server will use the default value of False - - # 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) - - # example passing only required values which don't have defaults set - # and optional values - try: - # Select key by pattern - api_response = api_instance.search_key(pattern, show_secret_key=show_secret_key) - 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 | - **show_secret_key** | **bool**| Wether or not the secret key should be returned in the response | [optional] if omitted the server will use the default value of False - -### Return type - -[**KeyInfo**](KeyInfo.md) - -### Authorization - -[bearerAuth](../README.md#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]](../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, update_key_request) diff --git a/garage_admin_sdk/__init__.py b/garage_admin_sdk/__init__.py index 340acb2..0ed8949 100644 --- a/garage_admin_sdk/__init__.py +++ b/garage_admin_sdk/__init__.py @@ -10,7 +10,7 @@ """ -__version__ = "0.8.0" +__version__ = "0.9.0" # import ApiClient from garage_admin_sdk.api_client import ApiClient diff --git a/garage_admin_sdk/api/bucket_api.py b/garage_admin_sdk/api/bucket_api.py index bb582f4..240084a 100644 --- a/garage_admin_sdk/api/bucket_api.py +++ b/garage_admin_sdk/api/bucket_api.py @@ -149,17 +149,17 @@ class BucketApi(object): 'auth': [ 'bearerAuth' ], - 'endpoint_path': '/bucket?id={bucket_id}', + 'endpoint_path': '/bucket', 'operation_id': 'delete_bucket', 'http_method': 'DELETE', 'servers': None, }, params_map={ 'all': [ - 'bucket_id', + 'id', ], 'required': [ - 'bucket_id', + 'id', ], 'nullable': [ ], @@ -174,14 +174,14 @@ class BucketApi(object): 'allowed_values': { }, 'openapi_types': { - 'bucket_id': + 'id': (str,), }, 'attribute_map': { - 'bucket_id': 'bucket_id', + 'id': 'id', }, 'location_map': { - 'bucket_id': 'path', + 'id': 'query', }, 'collection_format_map': { } @@ -364,75 +364,23 @@ class BucketApi(object): }, api_client=api_client ) - self.find_bucket_info_endpoint = _Endpoint( - settings={ - 'response_type': (BucketInfo,), - 'auth': [ - 'bearerAuth' - ], - 'endpoint_path': '/bucket?globalAlias={alias}', - 'operation_id': 'find_bucket_info', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'alias', - ], - 'required': [ - 'alias', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'alias': - (str,), - }, - 'attribute_map': { - 'alias': 'alias', - }, - 'location_map': { - 'alias': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) self.get_bucket_info_endpoint = _Endpoint( settings={ 'response_type': (BucketInfo,), 'auth': [ 'bearerAuth' ], - 'endpoint_path': '/bucket?id={bucket_id}', + 'endpoint_path': '/bucket', 'operation_id': 'get_bucket_info', 'http_method': 'GET', 'servers': None, }, params_map={ 'all': [ - 'bucket_id', - ], - 'required': [ - 'bucket_id', + 'id', + 'alias', ], + 'required': [], 'nullable': [ ], 'enum': [ @@ -446,14 +394,18 @@ class BucketApi(object): 'allowed_values': { }, 'openapi_types': { - 'bucket_id': + 'id': + (str,), + 'alias': (str,), }, 'attribute_map': { - 'bucket_id': 'bucket_id', + 'id': 'id', + 'alias': 'alias', }, 'location_map': { - 'bucket_id': 'path', + 'id': 'query', + 'alias': 'query', }, 'collection_format_map': { } @@ -472,7 +424,7 @@ class BucketApi(object): 'auth': [ 'bearerAuth' ], - 'endpoint_path': '/bucket', + 'endpoint_path': '/bucket?list', 'operation_id': 'list_buckets', 'http_method': 'GET', 'servers': None, @@ -636,18 +588,18 @@ class BucketApi(object): 'auth': [ 'bearerAuth' ], - 'endpoint_path': '/bucket?id={bucket_id}', + 'endpoint_path': '/bucket', 'operation_id': 'update_bucket', 'http_method': 'PUT', 'servers': None, }, params_map={ 'all': [ - 'bucket_id', + 'id', 'update_bucket_request', ], 'required': [ - 'bucket_id', + 'id', 'update_bucket_request', ], 'nullable': [ @@ -663,16 +615,16 @@ class BucketApi(object): 'allowed_values': { }, 'openapi_types': { - 'bucket_id': + 'id': (str,), 'update_bucket_request': (UpdateBucketRequest,), }, 'attribute_map': { - 'bucket_id': 'bucket_id', + 'id': 'id', }, 'location_map': { - 'bucket_id': 'path', + 'id': 'query', 'update_bucket_request': 'body', }, 'collection_format_map': { @@ -857,7 +809,7 @@ class BucketApi(object): def delete_bucket( self, - bucket_id, + id, **kwargs ): """Delete a bucket # noqa: E501 @@ -866,11 +818,11 @@ class BucketApi(object): This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_bucket(bucket_id, async_req=True) + >>> thread = api.delete_bucket(id, async_req=True) >>> result = thread.get() Args: - bucket_id (str): The exact bucket identifier, a 32 bytes hexadecimal string + id (str): The exact bucket identifier, a 32 bytes hexadecimal string Keyword Args: _return_http_data_only (bool): response data without head status @@ -934,8 +886,8 @@ class BucketApi(object): '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['_request_auths'] = kwargs.get('_request_auths', None) - kwargs['bucket_id'] = \ - bucket_id + kwargs['id'] = \ + id return self.delete_bucket_endpoint.call_with_http_info(**kwargs) def delete_bucket_global_alias( @@ -1199,107 +1151,23 @@ class BucketApi(object): allow_bucket_key_request return self.deny_bucket_key_endpoint.call_with_http_info(**kwargs) - def find_bucket_info( - self, - alias, - **kwargs - ): - """Find a bucket # noqa: E501 - - Find a bucket by its global alias # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.find_bucket_info(alias, async_req=True) - >>> result = thread.get() - - Args: - alias (str): The exact global alias of one of the existing buckets - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - _request_auths (list): set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - Default is None - async_req (bool): execute request asynchronously - - Returns: - BucketInfo - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['_request_auths'] = kwargs.get('_request_auths', None) - kwargs['alias'] = \ - alias - return self.find_bucket_info_endpoint.call_with_http_info(**kwargs) - def get_bucket_info( self, - bucket_id, **kwargs ): """Get a bucket # noqa: E501 - Given a bucket identifier, get its information. It includes its aliases, its web configuration, keys that have some permissions on it, some statistics (number of objects, size), number of dangling multipart uploads, and its quotas (if any). # noqa: E501 + Given a bucket identifier (`id`) or a global alias (`alias`), get its information. It includes its aliases, its web configuration, keys that have some permissions on it, some statistics (number of objects, size), number of dangling multipart uploads, and its quotas (if any). # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_bucket_info(bucket_id, async_req=True) + >>> thread = api.get_bucket_info(async_req=True) >>> result = thread.get() - Args: - bucket_id (str): The exact bucket identifier, a 32 bytes hexadecimal string Keyword Args: + id (str): The exact bucket identifier, a 32 bytes hexadecimal string. Incompatible with `alias`. . [optional] + alias (str): The exact global alias of one of the existing buckets. Incompatible with `id`. . [optional] _return_http_data_only (bool): response data without head status code and headers. Default is True. _preload_content (bool): if False, the urllib3.HTTPResponse object @@ -1361,8 +1229,6 @@ class BucketApi(object): '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['_request_auths'] = kwargs.get('_request_auths', None) - kwargs['bucket_id'] = \ - bucket_id return self.get_bucket_info_endpoint.call_with_http_info(**kwargs) def list_buckets( @@ -1623,7 +1489,7 @@ class BucketApi(object): def update_bucket( self, - bucket_id, + id, update_bucket_request, **kwargs ): @@ -1633,11 +1499,11 @@ class BucketApi(object): This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_bucket(bucket_id, update_bucket_request, async_req=True) + >>> thread = api.update_bucket(id, update_bucket_request, async_req=True) >>> result = thread.get() Args: - bucket_id (str): The exact bucket identifier, a 32 bytes hexadecimal string + id (str): The exact bucket identifier, a 32 bytes hexadecimal string update_bucket_request (UpdateBucketRequest): Requested changes on the bucket. Both root fields are optionals. Keyword Args: @@ -1702,8 +1568,8 @@ class BucketApi(object): '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['_request_auths'] = kwargs.get('_request_auths', None) - kwargs['bucket_id'] = \ - bucket_id + kwargs['id'] = \ + id kwargs['update_bucket_request'] = \ update_bucket_request return self.update_bucket_endpoint.call_with_http_info(**kwargs) diff --git a/garage_admin_sdk/api/key_api.py b/garage_admin_sdk/api/key_api.py index dcd7769..75fa17e 100644 --- a/garage_admin_sdk/api/key_api.py +++ b/garage_admin_sdk/api/key_api.py @@ -45,7 +45,7 @@ class KeyApi(object): 'auth': [ 'bearerAuth' ], - 'endpoint_path': '/key', + 'endpoint_path': '/key?list', 'operation_id': 'add_key', 'http_method': 'POST', 'servers': None, @@ -97,7 +97,7 @@ class KeyApi(object): 'auth': [ 'bearerAuth' ], - 'endpoint_path': '/key?id={access_key}', + 'endpoint_path': '/key', 'operation_id': 'delete_key', 'http_method': 'DELETE', 'servers': None, @@ -146,19 +146,18 @@ class KeyApi(object): 'auth': [ 'bearerAuth' ], - 'endpoint_path': '/key?id={access_key}', + 'endpoint_path': '/key', 'operation_id': 'get_key', 'http_method': 'GET', 'servers': None, }, params_map={ 'all': [ - 'access_key', + 'id', + 'search', 'show_secret_key', ], - 'required': [ - 'access_key', - ], + 'required': [], 'nullable': [ ], 'enum': [ @@ -172,17 +171,21 @@ class KeyApi(object): 'allowed_values': { }, 'openapi_types': { - 'access_key': + 'id': + (str,), + 'search': (str,), 'show_secret_key': (bool,), }, 'attribute_map': { - 'access_key': 'access_key', + 'id': 'id', + 'search': 'search', 'show_secret_key': 'showSecretKey', }, 'location_map': { - 'access_key': 'path', + 'id': 'query', + 'search': 'query', 'show_secret_key': 'query', }, 'collection_format_map': { @@ -254,7 +257,7 @@ class KeyApi(object): 'auth': [ 'bearerAuth' ], - 'endpoint_path': '/key', + 'endpoint_path': '/key?list', 'operation_id': 'list_keys', 'http_method': 'GET', 'servers': None, @@ -292,69 +295,13 @@ class KeyApi(object): }, api_client=api_client ) - self.search_key_endpoint = _Endpoint( - settings={ - 'response_type': (KeyInfo,), - 'auth': [ - 'bearerAuth' - ], - 'endpoint_path': '/key?search={pattern}', - 'operation_id': 'search_key', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'pattern', - 'show_secret_key', - ], - 'required': [ - 'pattern', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'pattern': - (str,), - 'show_secret_key': - (bool,), - }, - 'attribute_map': { - 'pattern': 'pattern', - 'show_secret_key': 'showSecretKey', - }, - 'location_map': { - 'pattern': 'path', - 'show_secret_key': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) self.update_key_endpoint = _Endpoint( settings={ 'response_type': (KeyInfo,), 'auth': [ 'bearerAuth' ], - 'endpoint_path': '/key?id={access_key}', + 'endpoint_path': '/key', 'operation_id': 'update_key', 'http_method': 'POST', 'servers': None, @@ -575,22 +522,21 @@ class KeyApi(object): def get_key( self, - access_key, **kwargs ): """Get key information # noqa: E501 - Return information about a specific key like its identifiers, its permissions and buckets on which it has permissions. For confidentiality reasons, the secret key is not returned by default: you must pass the `showSecretKey` query parameter to get it. # noqa: E501 + Return information about a specific key like its identifiers, its permissions and buckets on which it has permissions. You can search by specifying the exact key identifier (`id`) or by specifying a pattern (`search`). For confidentiality reasons, the secret key is not returned by default: you must pass the `showSecretKey` query parameter to get it. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_key(access_key, async_req=True) + >>> thread = api.get_key(async_req=True) >>> result = thread.get() - Args: - access_key (str): The exact API access key generated by Garage Keyword Args: + id (str): The exact API access key generated by Garage. Incompatible with `search`. . [optional] + search (str): A pattern (beginning or full string) corresponding to a key identifier or friendly name. Incompatible with `id`. . [optional] show_secret_key (bool): Wether or not the secret key should be returned in the response. [optional] if omitted the server will use the default value of False _return_http_data_only (bool): response data without head status code and headers. Default is True. @@ -653,8 +599,6 @@ class KeyApi(object): '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['_request_auths'] = kwargs.get('_request_auths', None) - kwargs['access_key'] = \ - access_key return self.get_key_endpoint.call_with_http_info(**kwargs) def import_key( @@ -818,90 +762,6 @@ class KeyApi(object): kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.list_keys_endpoint.call_with_http_info(**kwargs) - def search_key( - self, - pattern, - **kwargs - ): - """Select key by pattern # noqa: E501 - - Find the first key matching the given pattern based on its identifier or friendly name and return its information. For confidentiality reasons, the secret key is not returned by default: you must pass the `showSecretKey` query parameter to get it. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.search_key(pattern, async_req=True) - >>> result = thread.get() - - Args: - pattern (str): A pattern (beginning or full string) corresponding to a key identifier or friendly name - - Keyword Args: - show_secret_key (bool): Wether or not the secret key should be returned in the response. [optional] if omitted the server will use the default value of False - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - _request_auths (list): set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - Default is None - async_req (bool): execute request asynchronously - - Returns: - KeyInfo - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['_request_auths'] = kwargs.get('_request_auths', None) - kwargs['pattern'] = \ - pattern - return self.search_key_endpoint.call_with_http_info(**kwargs) - def update_key( self, access_key, diff --git a/garage_admin_sdk/api_client.py b/garage_admin_sdk/api_client.py index eb2ccd3..6ac5c7f 100644 --- a/garage_admin_sdk/api_client.py +++ b/garage_admin_sdk/api_client.py @@ -76,7 +76,7 @@ class ApiClient(object): self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/0.8.0/python' + self.user_agent = 'OpenAPI-Generator/0.9.0/python' def __enter__(self): return self diff --git a/garage_admin_sdk/configuration.py b/garage_admin_sdk/configuration.py index 7066f51..d2201e4 100644 --- a/garage_admin_sdk/configuration.py +++ b/garage_admin_sdk/configuration.py @@ -388,7 +388,7 @@ class Configuration(object): "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: v0.9.0\n"\ - "SDK Package Version: 0.8.0".\ + "SDK Package Version: 0.9.0".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/setup.py b/setup.py index a95cb36..e69f3da 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "garage-admin-sdk-python" -VERSION = "0.8.0" +VERSION = "0.9.0" # To install the library, run the following # # python setup.py install