diff --git a/pkgs/clan-cli/emulate_entity.sh b/pkgs/clan-cli/emulate_entity.sh deleted file mode 100755 index 047880a..0000000 --- a/pkgs/clan-cli/emulate_entity.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -while true ; do printf 'HTTP/1.1 200 OK\r\n\r\ncool, thanks' | nc -l -N 127.0.0.1 7002; done diff --git a/pkgs/clan-cli/tests/openapi_client/__init__.py b/pkgs/clan-cli/tests/openapi_client/__init__.py index b3656f9..bf8d04e 100644 --- a/pkgs/clan-cli/tests/openapi_client/__init__.py +++ b/pkgs/clan-cli/tests/openapi_client/__init__.py @@ -20,7 +20,6 @@ __version__ = "1.0.0" from openapi_client.api.default_api import DefaultApi from openapi_client.api.entities_api import EntitiesApi from openapi_client.api.eventmessages_api import EventmessagesApi -from openapi_client.api.repositories_api import RepositoriesApi from openapi_client.api.resolution_api import ResolutionApi from openapi_client.api.services_api import ServicesApi @@ -43,7 +42,7 @@ from openapi_client.models.eventmessage_create import EventmessageCreate from openapi_client.models.http_validation_error import HTTPValidationError from openapi_client.models.machine import Machine from openapi_client.models.resolution import Resolution -from openapi_client.models.roles import Roles +from openapi_client.models.role import Role from openapi_client.models.service import Service from openapi_client.models.service_create import ServiceCreate from openapi_client.models.status import Status diff --git a/pkgs/clan-cli/tests/openapi_client/api/__init__.py b/pkgs/clan-cli/tests/openapi_client/api/__init__.py index 87b34f9..88a80e5 100644 --- a/pkgs/clan-cli/tests/openapi_client/api/__init__.py +++ b/pkgs/clan-cli/tests/openapi_client/api/__init__.py @@ -4,7 +4,6 @@ from openapi_client.api.default_api import DefaultApi from openapi_client.api.entities_api import EntitiesApi from openapi_client.api.eventmessages_api import EventmessagesApi -from openapi_client.api.repositories_api import RepositoriesApi from openapi_client.api.resolution_api import ResolutionApi from openapi_client.api.services_api import ServicesApi diff --git a/pkgs/clan-cli/tests/openapi_client/api/entities_api.py b/pkgs/clan-cli/tests/openapi_client/api/entities_api.py index 82431a5..041bafe 100644 --- a/pkgs/clan-cli/tests/openapi_client/api/entities_api.py +++ b/pkgs/clan-cli/tests/openapi_client/api/entities_api.py @@ -18,12 +18,13 @@ import warnings from pydantic import validate_arguments, ValidationError -from pydantic import StrictInt, StrictStr +from pydantic import StrictInt, StrictStr, conlist from typing import Any, List, Optional, Dict from openapi_client.models.entity import Entity from openapi_client.models.entity_create import EntityCreate +from openapi_client.models.role import Role from openapi_client.api_client import ApiClient from openapi_client.api_response import ApiResponse @@ -184,7 +185,7 @@ class EntitiesApi: } return self.api_client.call_api( - '/api/v1/attach', 'POST', + '/api/v1/attach', 'PUT', _path_params, _query_params, _header_params, @@ -624,7 +625,7 @@ class EntitiesApi: } return self.api_client.call_api( - '/api/v1/detach', 'POST', + '/api/v1/detach', 'PUT', _path_params, _query_params, _header_params, @@ -1074,17 +1075,17 @@ class EntitiesApi: _request_auth=_params.get('_request_auth')) @validate_arguments - def get_entity_by_name(self, entity_name : StrictStr, **kwargs) -> Entity: # noqa: E501 - """Get Entity By Name # noqa: E501 + def get_entity_by_name_or_did(self, entity_name_or_did : Optional[StrictStr] = None, **kwargs) -> Entity: # noqa: E501 + """Get Entity By Name Or Did # 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_entity_by_name(entity_name, async_req=True) + >>> thread = api.get_entity_by_name_or_did(entity_name_or_did, async_req=True) >>> result = thread.get() - :param entity_name: (required) - :type entity_name: str + :param entity_name_or_did: + :type entity_name_or_did: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _request_timeout: timeout setting for this request. @@ -1098,22 +1099,22 @@ class EntitiesApi: """ kwargs['_return_http_data_only'] = True if '_preload_content' in kwargs: - message = "Error! Please call the get_entity_by_name_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + message = "Error! Please call the get_entity_by_name_or_did_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 raise ValueError(message) - return self.get_entity_by_name_with_http_info(entity_name, **kwargs) # noqa: E501 + return self.get_entity_by_name_or_did_with_http_info(entity_name_or_did, **kwargs) # noqa: E501 @validate_arguments - def get_entity_by_name_with_http_info(self, entity_name : StrictStr, **kwargs) -> ApiResponse: # noqa: E501 - """Get Entity By Name # noqa: E501 + def get_entity_by_name_or_did_with_http_info(self, entity_name_or_did : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Get Entity By Name Or Did # 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_entity_by_name_with_http_info(entity_name, async_req=True) + >>> thread = api.get_entity_by_name_or_did_with_http_info(entity_name_or_did, async_req=True) >>> result = thread.get() - :param entity_name: (required) - :type entity_name: str + :param entity_name_or_did: + :type entity_name_or_did: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _preload_content: if False, the ApiResponse.data will @@ -1142,7 +1143,7 @@ class EntitiesApi: _params = locals() _all_params = [ - 'entity_name' + 'entity_name_or_did' ] _all_params.extend( [ @@ -1161,7 +1162,7 @@ class EntitiesApi: if _key not in _all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_entity_by_name" % _key + " to method get_entity_by_name_or_did" % _key ) _params[_key] = _val del _params['kwargs'] @@ -1173,8 +1174,8 @@ class EntitiesApi: # process the query parameters _query_params = [] - if _params.get('entity_name') is not None: # noqa: E501 - _query_params.append(('entity_name', _params['entity_name'])) + if _params.get('entity_name_or_did') is not None: # noqa: E501 + _query_params.append(('entity_name_or_did', _params['entity_name_or_did'])) # process the header parameters _header_params = dict(_params.get('_headers', {})) @@ -1196,7 +1197,147 @@ class EntitiesApi: } return self.api_client.call_api( - '/api/v1/entity_by_name', 'GET', + '/api/v1/entity_by_name_or_did', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def get_entity_by_roles(self, roles : conlist(Role), **kwargs) -> List[Entity]: # noqa: E501 + """Get Entity By Roles # 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_entity_by_roles(roles, async_req=True) + >>> result = thread.get() + + :param roles: (required) + :type roles: List[Role] + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: 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. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: List[Entity] + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the get_entity_by_roles_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.get_entity_by_roles_with_http_info(roles, **kwargs) # noqa: E501 + + @validate_arguments + def get_entity_by_roles_with_http_info(self, roles : conlist(Role), **kwargs) -> ApiResponse: # noqa: E501 + """Get Entity By Roles # 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_entity_by_roles_with_http_info(roles, async_req=True) + >>> result = thread.get() + + :param roles: (required) + :type roles: List[Role] + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: 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. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(List[Entity], status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'roles' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_by_roles" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('roles') is not None: # noqa: E501 + _query_params.append(('roles', _params['roles'])) + _collection_formats['roles'] = 'multi' + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "List[Entity]", + '422': "HTTPValidationError", + } + + return self.api_client.call_api( + '/api/v1/entity_by_roles', 'GET', _path_params, _query_params, _header_params, diff --git a/pkgs/clan-cli/tests/openapi_client/api/eventmessages_api.py b/pkgs/clan-cli/tests/openapi_client/api/eventmessages_api.py index 092ef36..b509802 100644 --- a/pkgs/clan-cli/tests/openapi_client/api/eventmessages_api.py +++ b/pkgs/clan-cli/tests/openapi_client/api/eventmessages_api.py @@ -175,7 +175,7 @@ class EventmessagesApi: } return self.api_client.call_api( - '/api/v1/send_msg', 'POST', + '/api/v1/event_message', 'POST', _path_params, _query_params, _header_params, diff --git a/pkgs/clan-cli/tests/openapi_client/api/repositories_api.py b/pkgs/clan-cli/tests/openapi_client/api/repositories_api.py deleted file mode 100644 index bedb1e3..0000000 --- a/pkgs/clan-cli/tests/openapi_client/api/repositories_api.py +++ /dev/null @@ -1,192 +0,0 @@ -# coding: utf-8 - -""" - FastAPI - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: 0.1.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import re # noqa: F401 -import io -import warnings - -from pydantic import validate_arguments, ValidationError - -from pydantic import StrictInt - -from typing import List, Optional - -from openapi_client.models.service import Service - -from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse -from openapi_client.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) - - -class RepositoriesApi: - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None) -> None: - if api_client is None: - api_client = ApiClient.get_default() - self.api_client = api_client - - @validate_arguments - def get_all_repositories(self, skip : Optional[StrictInt] = None, limit : Optional[StrictInt] = None, **kwargs) -> List[Service]: # noqa: E501 - """Get All Repositories # 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_all_repositories(skip, limit, async_req=True) - >>> result = thread.get() - - :param skip: - :type skip: int - :param limit: - :type limit: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: 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. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: List[Service] - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the get_all_repositories_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_all_repositories_with_http_info(skip, limit, **kwargs) # noqa: E501 - - @validate_arguments - def get_all_repositories_with_http_info(self, skip : Optional[StrictInt] = None, limit : Optional[StrictInt] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Get All Repositories # 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_all_repositories_with_http_info(skip, limit, async_req=True) - >>> result = thread.get() - - :param skip: - :type skip: int - :param limit: - :type limit: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: 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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(List[Service], status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'skip', - 'limit' - ] - _all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_all_repositories" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - if _params.get('skip') is not None: # noqa: E501 - _query_params.append(('skip', _params['skip'])) - - if _params.get('limit') is not None: # noqa: E501 - _query_params.append(('limit', _params['limit'])) - - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - '200': "List[Service]", - '422': "HTTPValidationError", - } - - return self.api_client.call_api( - '/api/v1/repositories', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get('async_req'), - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) diff --git a/pkgs/clan-cli/tests/openapi_client/docs/EntitiesApi.md b/pkgs/clan-cli/tests/openapi_client/docs/EntitiesApi.md index dc621f8..4cc9b38 100644 --- a/pkgs/clan-cli/tests/openapi_client/docs/EntitiesApi.md +++ b/pkgs/clan-cli/tests/openapi_client/docs/EntitiesApi.md @@ -2,17 +2,18 @@ All URIs are relative to _http://localhost_ -| Method | HTTP request | Description | -| ----------------------------------------------------------------- | --------------------------------- | --------------------- | -| [**attach_entity**](EntitiesApi.md#attach_entity) | **POST** /api/v1/attach | Attach Entity | -| [**create_entity**](EntitiesApi.md#create_entity) | **POST** /api/v1/entity | Create Entity | -| [**delete_entity**](EntitiesApi.md#delete_entity) | **DELETE** /api/v1/entity | Delete Entity | -| [**detach_entity**](EntitiesApi.md#detach_entity) | **POST** /api/v1/detach | Detach Entity | -| [**get_all_entities**](EntitiesApi.md#get_all_entities) | **GET** /api/v1/entities | Get All Entities | -| [**get_attached_entities**](EntitiesApi.md#get_attached_entities) | **GET** /api/v1/attached_entities | Get Attached Entities | -| [**get_entity_by_did**](EntitiesApi.md#get_entity_by_did) | **GET** /api/v1/entity | Get Entity By Did | -| [**get_entity_by_name**](EntitiesApi.md#get_entity_by_name) | **GET** /api/v1/entity_by_name | Get Entity By Name | -| [**is_attached**](EntitiesApi.md#is_attached) | **GET** /api/v1/is_attached | Is Attached | +| Method | HTTP request | Description | +| ------------------------------------------------------------------------- | ------------------------------------- | ------------------------- | +| [**attach_entity**](EntitiesApi.md#attach_entity) | **PUT** /api/v1/attach | Attach Entity | +| [**create_entity**](EntitiesApi.md#create_entity) | **POST** /api/v1/entity | Create Entity | +| [**delete_entity**](EntitiesApi.md#delete_entity) | **DELETE** /api/v1/entity | Delete Entity | +| [**detach_entity**](EntitiesApi.md#detach_entity) | **PUT** /api/v1/detach | Detach Entity | +| [**get_all_entities**](EntitiesApi.md#get_all_entities) | **GET** /api/v1/entities | Get All Entities | +| [**get_attached_entities**](EntitiesApi.md#get_attached_entities) | **GET** /api/v1/attached_entities | Get Attached Entities | +| [**get_entity_by_did**](EntitiesApi.md#get_entity_by_did) | **GET** /api/v1/entity | Get Entity By Did | +| [**get_entity_by_name_or_did**](EntitiesApi.md#get_entity_by_name_or_did) | **GET** /api/v1/entity_by_name_or_did | Get Entity By Name Or Did | +| [**get_entity_by_roles**](EntitiesApi.md#get_entity_by_roles) | **GET** /api/v1/entity_by_roles | Get Entity By Roles | +| [**is_attached**](EntitiesApi.md#is_attached) | **GET** /api/v1/is_attached | Is Attached | # **attach_entity** @@ -486,11 +487,11 @@ No authorization required [[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_entity_by_name** +# **get_entity_by_name_or_did** -> Entity get_entity_by_name(entity_name) +> Entity get_entity_by_name_or_did(entity_name_or_did=entity_name_or_did) -Get Entity By Name +Get Entity By Name Or Did ### Example @@ -513,22 +514,22 @@ configuration = openapi_client.Configuration( with openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = openapi_client.EntitiesApi(api_client) - entity_name = 'entity_name_example' # str | + entity_name_or_did = 'C1' # str | (optional) (default to 'C1') try: - # Get Entity By Name - api_response = api_instance.get_entity_by_name(entity_name) - print("The response of EntitiesApi->get_entity_by_name:\n") + # Get Entity By Name Or Did + api_response = api_instance.get_entity_by_name_or_did(entity_name_or_did=entity_name_or_did) + print("The response of EntitiesApi->get_entity_by_name_or_did:\n") pprint(api_response) except Exception as e: - print("Exception when calling EntitiesApi->get_entity_by_name: %s\n" % e) + print("Exception when calling EntitiesApi->get_entity_by_name_or_did: %s\n" % e) ``` ### Parameters -| Name | Type | Description | Notes | -| --------------- | ------- | ----------- | ----- | -| **entity_name** | **str** | | +| Name | Type | Description | Notes | +| ---------------------- | ------- | ----------- | ------------------------------------ | +| **entity_name_or_did** | **str** | | [optional] [default to 'C1'] | ### Return type @@ -552,6 +553,73 @@ No authorization required [[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_entity_by_roles** + +> List[Entity] get_entity_by_roles(roles) + +Get Entity By Roles + +### Example + +```python +import time +import os +import openapi_client +from openapi_client.models.entity import Entity +from openapi_client.models.role import Role +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.EntitiesApi(api_client) + roles = [openapi_client.Role()] # List[Role] | + + try: + # Get Entity By Roles + api_response = api_instance.get_entity_by_roles(roles) + print("The response of EntitiesApi->get_entity_by_roles:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EntitiesApi->get_entity_by_roles: %s\n" % e) +``` + +### Parameters + +| Name | Type | Description | Notes | +| --------- | ------------------------- | ----------- | ----- | +| **roles** | [**List[Role]**](Role.md) | | + +### Return type + +[**List[Entity]**](Entity.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +| ----------- | ------------------- | ---------------- | +| **200** | Successful Response | - | +| **422** | Validation Error | - | + +[[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) + # **is_attached** > Dict[str, str] is_attached(entity_did=entity_did) diff --git a/pkgs/clan-cli/tests/openapi_client/docs/Entity.md b/pkgs/clan-cli/tests/openapi_client/docs/Entity.md index 807f6a6..83b3b80 100644 --- a/pkgs/clan-cli/tests/openapi_client/docs/Entity.md +++ b/pkgs/clan-cli/tests/openapi_client/docs/Entity.md @@ -2,17 +2,17 @@ ## Properties -| Name | Type | Description | Notes | -| -------------------- | --------------------- | ----------- | ----- | -| **did** | **str** | | -| **name** | **str** | | -| **ip** | **str** | | -| **network** | **str** | | -| **role** | [**Roles**](Roles.md) | | -| **visible** | **bool** | | -| **other** | **object** | | -| **attached** | **bool** | | -| **stop_health_task** | **bool** | | +| Name | Type | Description | Notes | +| -------------------- | ------------------------- | ----------- | ----- | +| **did** | **str** | | +| **name** | **str** | | +| **ip** | **str** | | +| **network** | **str** | | +| **visible** | **bool** | | +| **other** | **object** | | +| **attached** | **bool** | | +| **stop_health_task** | **bool** | | +| **roles** | [**List[Role]**](Role.md) | | ## Example diff --git a/pkgs/clan-cli/tests/openapi_client/docs/EntityCreate.md b/pkgs/clan-cli/tests/openapi_client/docs/EntityCreate.md index ea30366..2b06e83 100644 --- a/pkgs/clan-cli/tests/openapi_client/docs/EntityCreate.md +++ b/pkgs/clan-cli/tests/openapi_client/docs/EntityCreate.md @@ -2,15 +2,15 @@ ## Properties -| Name | Type | Description | Notes | -| ----------- | --------------------- | ----------- | ----- | -| **did** | **str** | | -| **name** | **str** | | -| **ip** | **str** | | -| **network** | **str** | | -| **role** | [**Roles**](Roles.md) | | -| **visible** | **bool** | | -| **other** | **object** | | +| Name | Type | Description | Notes | +| ----------- | ------------------------- | ----------- | ----- | +| **did** | **str** | | +| **name** | **str** | | +| **ip** | **str** | | +| **network** | **str** | | +| **visible** | **bool** | | +| **other** | **object** | | +| **roles** | [**List[Role]**](Role.md) | | ## Example diff --git a/pkgs/clan-cli/tests/openapi_client/docs/Eventmessage.md b/pkgs/clan-cli/tests/openapi_client/docs/Eventmessage.md index cbe65cb..96427cd 100644 --- a/pkgs/clan-cli/tests/openapi_client/docs/Eventmessage.md +++ b/pkgs/clan-cli/tests/openapi_client/docs/Eventmessage.md @@ -4,7 +4,6 @@ | Name | Type | Description | Notes | | ------------- | ---------- | ----------- | ----- | -| **id** | **int** | | | **timestamp** | **int** | | | **group** | **int** | | | **group_id** | **int** | | @@ -12,6 +11,7 @@ | **src_did** | **str** | | | **des_did** | **str** | | | **msg** | **object** | | +| **id** | **int** | | ## Example diff --git a/pkgs/clan-cli/tests/openapi_client/docs/EventmessageCreate.md b/pkgs/clan-cli/tests/openapi_client/docs/EventmessageCreate.md index eb6f16d..4ed2b69 100644 --- a/pkgs/clan-cli/tests/openapi_client/docs/EventmessageCreate.md +++ b/pkgs/clan-cli/tests/openapi_client/docs/EventmessageCreate.md @@ -4,7 +4,6 @@ | Name | Type | Description | Notes | | ------------- | ---------- | ----------- | ----- | -| **id** | **int** | | | **timestamp** | **int** | | | **group** | **int** | | | **group_id** | **int** | | diff --git a/pkgs/clan-cli/tests/openapi_client/docs/EventmessagesApi.md b/pkgs/clan-cli/tests/openapi_client/docs/EventmessagesApi.md index d6affb9..c8f26b1 100644 --- a/pkgs/clan-cli/tests/openapi_client/docs/EventmessagesApi.md +++ b/pkgs/clan-cli/tests/openapi_client/docs/EventmessagesApi.md @@ -4,7 +4,7 @@ All URIs are relative to _http://localhost_ | Method | HTTP request | Description | | ---------------------------------------------------------------------- | ------------------------------ | --------------------- | -| [**create_eventmessage**](EventmessagesApi.md#create_eventmessage) | **POST** /api/v1/send_msg | Create Eventmessage | +| [**create_eventmessage**](EventmessagesApi.md#create_eventmessage) | **POST** /api/v1/event_message | Create Eventmessage | | [**get_all_eventmessages**](EventmessagesApi.md#get_all_eventmessages) | **GET** /api/v1/event_messages | Get All Eventmessages | # **create_eventmessage** diff --git a/pkgs/clan-cli/tests/openapi_client/docs/RepositoriesApi.md b/pkgs/clan-cli/tests/openapi_client/docs/RepositoriesApi.md deleted file mode 100644 index ff735f0..0000000 --- a/pkgs/clan-cli/tests/openapi_client/docs/RepositoriesApi.md +++ /dev/null @@ -1,75 +0,0 @@ -# openapi_client.RepositoriesApi - -All URIs are relative to _http://localhost_ - -| Method | HTTP request | Description | -| ------------------------------------------------------------------- | ---------------------------- | -------------------- | -| [**get_all_repositories**](RepositoriesApi.md#get_all_repositories) | **GET** /api/v1/repositories | Get All Repositories | - -# **get_all_repositories** - -> List[Service] get_all_repositories(skip=skip, limit=limit) - -Get All Repositories - -### Example - -```python -import time -import os -import openapi_client -from openapi_client.models.service import Service -from openapi_client.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = openapi_client.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -with openapi_client.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = openapi_client.RepositoriesApi(api_client) - skip = 0 # int | (optional) (default to 0) - limit = 100 # int | (optional) (default to 100) - - try: - # Get All Repositories - api_response = api_instance.get_all_repositories(skip=skip, limit=limit) - print("The response of RepositoriesApi->get_all_repositories:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling RepositoriesApi->get_all_repositories: %s\n" % e) -``` - -### Parameters - -| Name | Type | Description | Notes | -| --------- | ------- | ----------- | --------------------------- | -| **skip** | **int** | | [optional] [default to 0] | -| **limit** | **int** | | [optional] [default to 100] | - -### Return type - -[**List[Service]**](Service.md) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -| ----------- | ------------------- | ---------------- | -| **200** | Successful Response | - | -| **422** | Validation Error | - | - -[[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) diff --git a/pkgs/clan-cli/tests/openapi_client/docs/Roles.md b/pkgs/clan-cli/tests/openapi_client/docs/Role.md similarity index 97% rename from pkgs/clan-cli/tests/openapi_client/docs/Roles.md rename to pkgs/clan-cli/tests/openapi_client/docs/Role.md index 994fa4c..a60cc52 100644 --- a/pkgs/clan-cli/tests/openapi_client/docs/Roles.md +++ b/pkgs/clan-cli/tests/openapi_client/docs/Role.md @@ -1,4 +1,4 @@ -# Roles +# Role An enumeration. diff --git a/pkgs/clan-cli/tests/openapi_client/models/__init__.py b/pkgs/clan-cli/tests/openapi_client/models/__init__.py index f28cdd8..b211606 100644 --- a/pkgs/clan-cli/tests/openapi_client/models/__init__.py +++ b/pkgs/clan-cli/tests/openapi_client/models/__init__.py @@ -21,7 +21,7 @@ from openapi_client.models.eventmessage_create import EventmessageCreate from openapi_client.models.http_validation_error import HTTPValidationError from openapi_client.models.machine import Machine from openapi_client.models.resolution import Resolution -from openapi_client.models.roles import Roles +from openapi_client.models.role import Role from openapi_client.models.service import Service from openapi_client.models.service_create import ServiceCreate from openapi_client.models.status import Status diff --git a/pkgs/clan-cli/tests/openapi_client/models/entity.py b/pkgs/clan-cli/tests/openapi_client/models/entity.py index a78e778..b60806c 100644 --- a/pkgs/clan-cli/tests/openapi_client/models/entity.py +++ b/pkgs/clan-cli/tests/openapi_client/models/entity.py @@ -18,9 +18,9 @@ import re # noqa: F401 import json -from typing import Any, Dict -from pydantic import BaseModel, Field, StrictBool, StrictStr -from openapi_client.models.roles import Roles +from typing import Any, Dict, List +from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist +from openapi_client.models.role import Role class Entity(BaseModel): """ @@ -30,12 +30,12 @@ class Entity(BaseModel): name: StrictStr = Field(...) ip: StrictStr = Field(...) network: StrictStr = Field(...) - role: Roles = Field(...) visible: StrictBool = Field(...) other: Dict[str, Any] = Field(...) attached: StrictBool = Field(...) stop_health_task: StrictBool = Field(...) - __properties = ["did", "name", "ip", "network", "role", "visible", "other", "attached", "stop_health_task"] + roles: conlist(Role) = Field(...) + __properties = ["did", "name", "ip", "network", "visible", "other", "attached", "stop_health_task", "roles"] class Config: """Pydantic configuration""" @@ -77,11 +77,11 @@ class Entity(BaseModel): "name": obj.get("name"), "ip": obj.get("ip"), "network": obj.get("network"), - "role": obj.get("role"), "visible": obj.get("visible"), "other": obj.get("other"), "attached": obj.get("attached"), - "stop_health_task": obj.get("stop_health_task") + "stop_health_task": obj.get("stop_health_task"), + "roles": obj.get("roles") }) return _obj diff --git a/pkgs/clan-cli/tests/openapi_client/models/entity_create.py b/pkgs/clan-cli/tests/openapi_client/models/entity_create.py index d7385e1..1775ccb 100644 --- a/pkgs/clan-cli/tests/openapi_client/models/entity_create.py +++ b/pkgs/clan-cli/tests/openapi_client/models/entity_create.py @@ -18,9 +18,9 @@ import re # noqa: F401 import json -from typing import Any, Dict -from pydantic import BaseModel, Field, StrictBool, StrictStr -from openapi_client.models.roles import Roles +from typing import Any, Dict, List +from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist +from openapi_client.models.role import Role class EntityCreate(BaseModel): """ @@ -30,10 +30,10 @@ class EntityCreate(BaseModel): name: StrictStr = Field(...) ip: StrictStr = Field(...) network: StrictStr = Field(...) - role: Roles = Field(...) visible: StrictBool = Field(...) other: Dict[str, Any] = Field(...) - __properties = ["did", "name", "ip", "network", "role", "visible", "other"] + roles: conlist(Role) = Field(...) + __properties = ["did", "name", "ip", "network", "visible", "other", "roles"] class Config: """Pydantic configuration""" @@ -75,9 +75,9 @@ class EntityCreate(BaseModel): "name": obj.get("name"), "ip": obj.get("ip"), "network": obj.get("network"), - "role": obj.get("role"), "visible": obj.get("visible"), - "other": obj.get("other") + "other": obj.get("other"), + "roles": obj.get("roles") }) return _obj diff --git a/pkgs/clan-cli/tests/openapi_client/models/eventmessage.py b/pkgs/clan-cli/tests/openapi_client/models/eventmessage.py index ece8617..4f0eb94 100644 --- a/pkgs/clan-cli/tests/openapi_client/models/eventmessage.py +++ b/pkgs/clan-cli/tests/openapi_client/models/eventmessage.py @@ -25,7 +25,6 @@ class Eventmessage(BaseModel): """ Eventmessage """ - id: StrictInt = Field(...) timestamp: StrictInt = Field(...) group: StrictInt = Field(...) group_id: StrictInt = Field(...) @@ -33,7 +32,8 @@ class Eventmessage(BaseModel): src_did: StrictStr = Field(...) des_did: StrictStr = Field(...) msg: Dict[str, Any] = Field(...) - __properties = ["id", "timestamp", "group", "group_id", "msg_type", "src_did", "des_did", "msg"] + id: StrictInt = Field(...) + __properties = ["timestamp", "group", "group_id", "msg_type", "src_did", "des_did", "msg", "id"] class Config: """Pydantic configuration""" @@ -71,14 +71,14 @@ class Eventmessage(BaseModel): return Eventmessage.parse_obj(obj) _obj = Eventmessage.parse_obj({ - "id": obj.get("id"), "timestamp": obj.get("timestamp"), "group": obj.get("group"), "group_id": obj.get("group_id"), "msg_type": obj.get("msg_type"), "src_did": obj.get("src_did"), "des_did": obj.get("des_did"), - "msg": obj.get("msg") + "msg": obj.get("msg"), + "id": obj.get("id") }) return _obj diff --git a/pkgs/clan-cli/tests/openapi_client/models/eventmessage_create.py b/pkgs/clan-cli/tests/openapi_client/models/eventmessage_create.py index 34915bb..cb1a740 100644 --- a/pkgs/clan-cli/tests/openapi_client/models/eventmessage_create.py +++ b/pkgs/clan-cli/tests/openapi_client/models/eventmessage_create.py @@ -25,7 +25,6 @@ class EventmessageCreate(BaseModel): """ EventmessageCreate """ - id: StrictInt = Field(...) timestamp: StrictInt = Field(...) group: StrictInt = Field(...) group_id: StrictInt = Field(...) @@ -33,7 +32,7 @@ class EventmessageCreate(BaseModel): src_did: StrictStr = Field(...) des_did: StrictStr = Field(...) msg: Dict[str, Any] = Field(...) - __properties = ["id", "timestamp", "group", "group_id", "msg_type", "src_did", "des_did", "msg"] + __properties = ["timestamp", "group", "group_id", "msg_type", "src_did", "des_did", "msg"] class Config: """Pydantic configuration""" @@ -71,7 +70,6 @@ class EventmessageCreate(BaseModel): return EventmessageCreate.parse_obj(obj) _obj = EventmessageCreate.parse_obj({ - "id": obj.get("id"), "timestamp": obj.get("timestamp"), "group": obj.get("group"), "group_id": obj.get("group_id"), diff --git a/pkgs/clan-cli/tests/openapi_client/models/roles.py b/pkgs/clan-cli/tests/openapi_client/models/role.py similarity index 76% rename from pkgs/clan-cli/tests/openapi_client/models/roles.py rename to pkgs/clan-cli/tests/openapi_client/models/role.py index 189cbd3..1af9d78 100644 --- a/pkgs/clan-cli/tests/openapi_client/models/roles.py +++ b/pkgs/clan-cli/tests/openapi_client/models/role.py @@ -21,7 +21,7 @@ from aenum import Enum, no_arg -class Roles(str, Enum): +class Role(str, Enum): """ An enumeration. """ @@ -34,8 +34,8 @@ class Roles(str, Enum): DLG = 'DLG' @classmethod - def from_json(cls, json_str: str) -> Roles: - """Create an instance of Roles from a JSON string""" - return Roles(json.loads(json_str)) + def from_json(cls, json_str: str) -> Role: + """Create an instance of Role from a JSON string""" + return Role(json.loads(json_str)) diff --git a/pkgs/clan-cli/tests/test_db_api.py b/pkgs/clan-cli/tests/test_db_api.py index 3238d40..8f04751 100644 --- a/pkgs/clan-cli/tests/test_db_api.py +++ b/pkgs/clan-cli/tests/test_db_api.py @@ -13,7 +13,7 @@ from openapi_client.models import ( Eventmessage, EventmessageCreate, Machine, - Roles, + Role, ServiceCreate, Status, ) @@ -46,7 +46,7 @@ def create_entities(num: int = 10, role: str = "entity") -> list[EntityCreate]: name=f"C{i}", ip=f"{host}:{port_client_base+i}", network="255.255.0.0", - role=Roles("service_prosumer"), + roles=[Role("service_prosumer")], visible=True, other={}, ) @@ -56,7 +56,7 @@ def create_entities(num: int = 10, role: str = "entity") -> list[EntityCreate]: name="DLG", ip=f"{host}:{port_dlg}/health", network="255.255.0.0", - role=Roles("DLG"), + roles=[Role("DLG")], visible=True, other={}, ) @@ -66,7 +66,7 @@ def create_entities(num: int = 10, role: str = "entity") -> list[EntityCreate]: name="AP", ip=f"{host}:{port_ap}/health", network="255.255.0.0", - role=Roles("AP"), + roles=[Role("AP")], visible=True, other={}, ) @@ -116,7 +116,6 @@ def create_eventmessages(num: int = 2) -> list[EventmessageCreate]: for i in range(num): group_id = i % 5 + random.getrandbits(6) em_req_send = EventmessageCreate( - id=random.getrandbits(18), timestamp=starttime + i * 10, group=i % 5, group_id=group_id, @@ -127,7 +126,6 @@ def create_eventmessages(num: int = 2) -> list[EventmessageCreate]: ) res.append(em_req_send) em_req_rec = EventmessageCreate( - id=random.getrandbits(18), timestamp=starttime + (i * 10) + 2, group=i % 5, group_id=group_id, @@ -139,7 +137,6 @@ def create_eventmessages(num: int = 2) -> list[EventmessageCreate]: res.append(em_req_rec) group_id = i % 5 + random.getrandbits(6) em_res_send = EventmessageCreate( - id=random.getrandbits(18), timestamp=starttime + i * 10 + 4, group=i % 5, group_id=group_id, @@ -150,7 +147,6 @@ def create_eventmessages(num: int = 2) -> list[EventmessageCreate]: ) res.append(em_res_send) em_res_rec = EventmessageCreate( - id=random.getrandbits(6), timestamp=starttime + (i * 10) + 8, group=i % 5, group_id=group_id, @@ -166,8 +162,10 @@ def create_eventmessages(num: int = 2) -> list[EventmessageCreate]: def test_create_eventmessages(api_client: ApiClient) -> None: api = EventmessagesApi(api_client=api_client) assert [] == api.get_all_eventmessages() - for own_eventmsg in create_eventmessages(): + for idx, own_eventmsg in enumerate(create_eventmessages()): res: Eventmessage = api.create_eventmessage(own_eventmsg) - # breakpoint() - assert res.id == own_eventmsg.id + + assert res.msg == own_eventmsg.msg + assert res.src_did == own_eventmsg.src_did + assert res.des_did == own_eventmsg.des_did assert [] != api.get_all_eventmessages()