From 70aca45e8a850f378870437576cb7ba79a34482a Mon Sep 17 00:00:00 2001 From: Pelayo Torres Date: Mon, 22 Jul 2024 10:31:28 +0200 Subject: [PATCH] REL18 Auditing Service --- .../.openapi-generator/FILES | 11 +- .../.openapi-generator/VERSION | 2 +- services/TS29222_CAPIF_Auditing_API/README.md | 2 +- .../TS29222_CAPIF_Auditing_API/git_push.sh | 6 +- .../logs/controllers/default_controller.py | 32 +- ..._controller_.py => security_controller.py} | 0 .../logs/encoder.py | 5 +- .../logs/models/__init__.py | 8 +- .../models/{base_model_.py => base_model.py} | 9 +- .../logs/models/interface_description.py | 99 ++++- .../logs/models/invalid_param.py | 13 +- .../logs/models/invocation_log.py | 29 +- .../logs/models/invocation_logs.py | 99 +++++ .../models/invocation_logs_retrieve_res.py | 195 +++++++++ .../logs/models/log.py | 85 ++-- .../logs/models/operation.py | 13 +- .../logs/models/operation_any_of.py | 45 -- .../logs/models/problem_details.py | 53 ++- .../logs/models/protocol.py | 10 +- .../logs/models/protocol_any_of.py | 42 -- .../logs/models/security_method.py | 12 +- .../logs/models/security_method_any_of.py | 43 -- .../logs/openapi/openapi.yaml | 388 ++++++++++-------- .../logs/test/__init__.py | 16 + .../logs/test/test_default_controller.py | 48 +++ .../logs/typing_utils.py | 2 - .../TS29222_CAPIF_Auditing_API/logs/util.py | 14 +- services/TS29222_CAPIF_Auditing_API/setup.py | 4 +- .../test-requirements.txt | 6 +- services/TS29222_CAPIF_Auditing_API/tox.ini | 2 +- 30 files changed, 807 insertions(+), 486 deletions(-) rename services/TS29222_CAPIF_Auditing_API/logs/controllers/{security_controller_.py => security_controller.py} (100%) rename services/TS29222_CAPIF_Auditing_API/logs/models/{base_model_.py => base_model.py} (92%) create mode 100644 services/TS29222_CAPIF_Auditing_API/logs/models/invocation_logs.py create mode 100644 services/TS29222_CAPIF_Auditing_API/logs/models/invocation_logs_retrieve_res.py delete mode 100644 services/TS29222_CAPIF_Auditing_API/logs/models/operation_any_of.py delete mode 100644 services/TS29222_CAPIF_Auditing_API/logs/models/protocol_any_of.py delete mode 100644 services/TS29222_CAPIF_Auditing_API/logs/models/security_method_any_of.py create mode 100644 services/TS29222_CAPIF_Auditing_API/logs/test/__init__.py create mode 100644 services/TS29222_CAPIF_Auditing_API/logs/test/test_default_controller.py diff --git a/services/TS29222_CAPIF_Auditing_API/.openapi-generator/FILES b/services/TS29222_CAPIF_Auditing_API/.openapi-generator/FILES index f5bc02f..684a73b 100644 --- a/services/TS29222_CAPIF_Auditing_API/.openapi-generator/FILES +++ b/services/TS29222_CAPIF_Auditing_API/.openapi-generator/FILES @@ -1,5 +1,6 @@ .dockerignore .gitignore +.openapi-generator-ignore .travis.yml Dockerfile README.md @@ -8,23 +9,23 @@ logs/__init__.py logs/__main__.py logs/controllers/__init__.py logs/controllers/default_controller.py -logs/controllers/security_controller_.py +logs/controllers/security_controller.py logs/encoder.py logs/models/__init__.py -logs/models/base_model_.py +logs/models/base_model.py logs/models/interface_description.py logs/models/invalid_param.py logs/models/invocation_log.py +logs/models/invocation_logs.py +logs/models/invocation_logs_retrieve_res.py logs/models/log.py logs/models/operation.py -logs/models/operation_any_of.py logs/models/problem_details.py logs/models/protocol.py -logs/models/protocol_any_of.py logs/models/security_method.py -logs/models/security_method_any_of.py logs/openapi/openapi.yaml logs/test/__init__.py +logs/test/test_default_controller.py logs/typing_utils.py logs/util.py requirements.txt diff --git a/services/TS29222_CAPIF_Auditing_API/.openapi-generator/VERSION b/services/TS29222_CAPIF_Auditing_API/.openapi-generator/VERSION index 4b448de..18bb418 100644 --- a/services/TS29222_CAPIF_Auditing_API/.openapi-generator/VERSION +++ b/services/TS29222_CAPIF_Auditing_API/.openapi-generator/VERSION @@ -1 +1 @@ -5.3.0-SNAPSHOT \ No newline at end of file +7.5.0 diff --git a/services/TS29222_CAPIF_Auditing_API/README.md b/services/TS29222_CAPIF_Auditing_API/README.md index 17eb857..7f120ad 100644 --- a/services/TS29222_CAPIF_Auditing_API/README.md +++ b/services/TS29222_CAPIF_Auditing_API/README.md @@ -15,7 +15,7 @@ To run the server, please execute the following from the root directory: ``` pip3 install -r requirements.txt -python3 -m logs +python3 -m openapi_server ``` and open your browser to here: diff --git a/services/TS29222_CAPIF_Auditing_API/git_push.sh b/services/TS29222_CAPIF_Auditing_API/git_push.sh index 9405f72..f53a75d 100644 --- a/services/TS29222_CAPIF_Auditing_API/git_push.sh +++ b/services/TS29222_CAPIF_Auditing_API/git_push.sh @@ -1,7 +1,7 @@ #!/bin/sh # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ # -# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" git_user_id=$1 git_repo_id=$2 @@ -38,14 +38,14 @@ git add . git commit -m "$release_note" # Sets the new remote -git_remote=`git remote` +git_remote=$(git remote) if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git fi fi diff --git a/services/TS29222_CAPIF_Auditing_API/logs/controllers/default_controller.py b/services/TS29222_CAPIF_Auditing_API/logs/controllers/default_controller.py index ead9ec5..8a278a9 100644 --- a/services/TS29222_CAPIF_Auditing_API/logs/controllers/default_controller.py +++ b/services/TS29222_CAPIF_Auditing_API/logs/controllers/default_controller.py @@ -1,3 +1,14 @@ +import connexion +from typing import Dict +from typing import Tuple +from typing import Union + +from logs.models.interface_description import InterfaceDescription # noqa: E501 +from logs.models.invocation_logs_retrieve_res import InvocationLogsRetrieveRes # noqa: E501 +from logs.models.operation import Operation # noqa: E501 +from logs.models.problem_details import ProblemDetails # noqa: E501 +from logs.models.protocol import Protocol # noqa: E501 +from logs import util from ..util import deserialize_datetime from ..core.auditoperations import AuditOperations @@ -23,7 +34,7 @@ def api_invocation_logs_get(aef_id=None, api_invoker_id=None, time_range_start=N :type time_range_end: str :param api_id: String identifying the API invoked. :type api_id: str - :param api_name: API name, it is set as {apiName} part of the URI structure as defined in subclause 4.4 of 3GPP TS 29.501. + :param api_name: API name, it is set as {apiName} part of the URI structure as defined in clause 5.2.4 of 3GPP TS 29.122. :type api_name: str :param api_version: Version of the API which was invoked. :type api_version: str @@ -36,13 +47,13 @@ def api_invocation_logs_get(aef_id=None, api_invoker_id=None, time_range_start=N :param resource_name: Name of the specific resource invoked. :type resource_name: str :param src_interface: Interface description of the API invoker. - :type src_interface: str + :type src_interface: dict | bytes :param dest_interface: Interface description of the API invoked. - :type dest_interface: str + :type dest_interface: dict | bytes :param supported_features: To filter irrelevant responses related to unsupported features :type supported_features: str - :rtype: InvocationLog + :rtype: Union[InvocationLogsRetrieveRes, Tuple[InvocationLogsRetrieveRes, int], Tuple[InvocationLogsRetrieveRes, int, Dict[str, str]] """ current_app.logger.info("Audit logs") @@ -52,8 +63,17 @@ def api_invocation_logs_get(aef_id=None, api_invoker_id=None, time_range_start=N cause="Mandatory parameters missing", invalid_params=[ {"param": "aef_id or api_invoker_id", "reason": "missing"}]) - time_range_start = deserialize_datetime(time_range_start) - time_range_end = deserialize_datetime(time_range_end) + + time_range_start = util.deserialize_datetime(time_range_start) + time_range_end = util.deserialize_datetime(time_range_end) + if connexion.request.is_json: + protocol = Protocol.from_dict(connexion.request.get_json()) # noqa: E501 + if connexion.request.is_json: + operation = Operation.from_dict(connexion.request.get_json()) # noqa: E501 + if connexion.request.is_json: + src_interface = InterfaceDescription.from_dict(connexion.request.get_json()) # noqa: E501 + if connexion.request.is_json: + dest_interface = InterfaceDescription.from_dict(connexion.request.get_json()) # noqa: E501 query_params = {"aef_id": aef_id, "api_invoker_id": api_invoker_id, diff --git a/services/TS29222_CAPIF_Auditing_API/logs/controllers/security_controller_.py b/services/TS29222_CAPIF_Auditing_API/logs/controllers/security_controller.py similarity index 100% rename from services/TS29222_CAPIF_Auditing_API/logs/controllers/security_controller_.py rename to services/TS29222_CAPIF_Auditing_API/logs/controllers/security_controller.py diff --git a/services/TS29222_CAPIF_Auditing_API/logs/encoder.py b/services/TS29222_CAPIF_Auditing_API/logs/encoder.py index 80bad8f..9b3763c 100644 --- a/services/TS29222_CAPIF_Auditing_API/logs/encoder.py +++ b/services/TS29222_CAPIF_Auditing_API/logs/encoder.py @@ -1,7 +1,6 @@ from connexion.apps.flask_app import FlaskJSONEncoder -import six -from models.base_model_ import Model +from logs.models.base_model import Model class JSONEncoder(FlaskJSONEncoder): @@ -10,7 +9,7 @@ class JSONEncoder(FlaskJSONEncoder): def default(self, o): if isinstance(o, Model): dikt = {} - for attr, _ in six.iteritems(o.openapi_types): + for attr in o.openapi_types: value = getattr(o, attr) if value is None and not self.include_nulls: continue diff --git a/services/TS29222_CAPIF_Auditing_API/logs/models/__init__.py b/services/TS29222_CAPIF_Auditing_API/logs/models/__init__.py index d8b2550..7669fe9 100644 --- a/services/TS29222_CAPIF_Auditing_API/logs/models/__init__.py +++ b/services/TS29222_CAPIF_Auditing_API/logs/models/__init__.py @@ -1,16 +1,12 @@ -# coding: utf-8 - # flake8: noqa -from __future__ import absolute_import # import models into model package from logs.models.interface_description import InterfaceDescription from logs.models.invalid_param import InvalidParam from logs.models.invocation_log import InvocationLog +from logs.models.invocation_logs import InvocationLogs +from logs.models.invocation_logs_retrieve_res import InvocationLogsRetrieveRes from logs.models.log import Log from logs.models.operation import Operation -from logs.models.operation_any_of import OperationAnyOf from logs.models.problem_details import ProblemDetails from logs.models.protocol import Protocol -from logs.models.protocol_any_of import ProtocolAnyOf from logs.models.security_method import SecurityMethod -from logs.models.security_method_any_of import SecurityMethodAnyOf diff --git a/services/TS29222_CAPIF_Auditing_API/logs/models/base_model_.py b/services/TS29222_CAPIF_Auditing_API/logs/models/base_model.py similarity index 92% rename from services/TS29222_CAPIF_Auditing_API/logs/models/base_model_.py rename to services/TS29222_CAPIF_Auditing_API/logs/models/base_model.py index 160eaa0..56493bb 100644 --- a/services/TS29222_CAPIF_Auditing_API/logs/models/base_model_.py +++ b/services/TS29222_CAPIF_Auditing_API/logs/models/base_model.py @@ -1,6 +1,5 @@ import pprint -import six import typing from logs import util @@ -8,14 +7,14 @@ from logs import util T = typing.TypeVar('T') -class Model(object): +class Model: # openapiTypes: The key is attribute name and the # value is attribute type. - openapi_types = {} + openapi_types: typing.Dict[str, type] = {} # attributeMap: The key is attribute name and the # value is json key in definition. - attribute_map = {} + attribute_map: typing.Dict[str, str] = {} @classmethod def from_dict(cls: typing.Type[T], dikt) -> T: @@ -29,7 +28,7 @@ class Model(object): """ result = {} - for attr, _ in six.iteritems(self.openapi_types): + for attr in self.openapi_types: value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( diff --git a/services/TS29222_CAPIF_Auditing_API/logs/models/interface_description.py b/services/TS29222_CAPIF_Auditing_API/logs/models/interface_description.py index 7a8878e..952fa9d 100644 --- a/services/TS29222_CAPIF_Auditing_API/logs/models/interface_description.py +++ b/services/TS29222_CAPIF_Auditing_API/logs/models/interface_description.py @@ -1,15 +1,14 @@ -# coding: utf-8 - -from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 -from logs.models.base_model_ import Model +from logs.models.base_model import Model from logs.models.security_method import SecurityMethod +import re from logs import util from logs.models.security_method import SecurityMethod # noqa: E501 +import re # noqa: E501 class InterfaceDescription(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -17,35 +16,45 @@ class InterfaceDescription(Model): Do not edit the class manually. """ - def __init__(self, ipv4_addr=None, ipv6_addr=None, port=None, security_methods=None): # noqa: E501 + def __init__(self, ipv4_addr=None, ipv6_addr=None, fqdn=None, port=None, api_prefix=None, security_methods=None): # noqa: E501 """InterfaceDescription - a model defined in OpenAPI :param ipv4_addr: The ipv4_addr of this InterfaceDescription. # noqa: E501 :type ipv4_addr: str :param ipv6_addr: The ipv6_addr of this InterfaceDescription. # noqa: E501 :type ipv6_addr: str + :param fqdn: The fqdn of this InterfaceDescription. # noqa: E501 + :type fqdn: str :param port: The port of this InterfaceDescription. # noqa: E501 :type port: int + :param api_prefix: The api_prefix of this InterfaceDescription. # noqa: E501 + :type api_prefix: str :param security_methods: The security_methods of this InterfaceDescription. # noqa: E501 :type security_methods: List[SecurityMethod] """ self.openapi_types = { 'ipv4_addr': str, 'ipv6_addr': str, + 'fqdn': str, 'port': int, + 'api_prefix': str, 'security_methods': List[SecurityMethod] } self.attribute_map = { 'ipv4_addr': 'ipv4Addr', 'ipv6_addr': 'ipv6Addr', + 'fqdn': 'fqdn', 'port': 'port', + 'api_prefix': 'apiPrefix', 'security_methods': 'securityMethods' } self._ipv4_addr = ipv4_addr self._ipv6_addr = ipv6_addr + self._fqdn = fqdn self._port = port + self._api_prefix = api_prefix self._security_methods = security_methods @classmethod @@ -60,10 +69,10 @@ class InterfaceDescription(Model): return util.deserialize_model(dikt, cls) @property - def ipv4_addr(self): + def ipv4_addr(self) -> str: """Gets the ipv4_addr of this InterfaceDescription. - string identifying a Ipv4 address formatted in the \"dotted decimal\" notation as defined in IETF RFC 1166. # noqa: E501 + string identifying a Ipv4 address formatted in the \"dotted decimal\" notation as defined in IETF RFC 1166. # noqa: E501 :return: The ipv4_addr of this InterfaceDescription. :rtype: str @@ -71,10 +80,10 @@ class InterfaceDescription(Model): return self._ipv4_addr @ipv4_addr.setter - def ipv4_addr(self, ipv4_addr): + def ipv4_addr(self, ipv4_addr: str): """Sets the ipv4_addr of this InterfaceDescription. - string identifying a Ipv4 address formatted in the \"dotted decimal\" notation as defined in IETF RFC 1166. # noqa: E501 + string identifying a Ipv4 address formatted in the \"dotted decimal\" notation as defined in IETF RFC 1166. # noqa: E501 :param ipv4_addr: The ipv4_addr of this InterfaceDescription. :type ipv4_addr: str @@ -83,10 +92,10 @@ class InterfaceDescription(Model): self._ipv4_addr = ipv4_addr @property - def ipv6_addr(self): + def ipv6_addr(self) -> str: """Gets the ipv6_addr of this InterfaceDescription. - string identifying a Ipv6 address formatted according to clause 4 in IETF RFC 5952. The mixed Ipv4 Ipv6 notation according to clause 5 of IETF RFC 5952 shall not be used. # noqa: E501 + string identifying a Ipv6 address formatted according to clause 4 in IETF RFC 5952. The mixed Ipv4 Ipv6 notation according to clause 5 of IETF RFC 5952 shall not be used. # noqa: E501 :return: The ipv6_addr of this InterfaceDescription. :rtype: str @@ -94,10 +103,10 @@ class InterfaceDescription(Model): return self._ipv6_addr @ipv6_addr.setter - def ipv6_addr(self, ipv6_addr): + def ipv6_addr(self, ipv6_addr: str): """Sets the ipv6_addr of this InterfaceDescription. - string identifying a Ipv6 address formatted according to clause 4 in IETF RFC 5952. The mixed Ipv4 Ipv6 notation according to clause 5 of IETF RFC 5952 shall not be used. # noqa: E501 + string identifying a Ipv6 address formatted according to clause 4 in IETF RFC 5952. The mixed Ipv4 Ipv6 notation according to clause 5 of IETF RFC 5952 shall not be used. # noqa: E501 :param ipv6_addr: The ipv6_addr of this InterfaceDescription. :type ipv6_addr: str @@ -106,7 +115,36 @@ class InterfaceDescription(Model): self._ipv6_addr = ipv6_addr @property - def port(self): + def fqdn(self) -> str: + """Gets the fqdn of this InterfaceDescription. + + Fully Qualified Domain Name # noqa: E501 + + :return: The fqdn of this InterfaceDescription. + :rtype: str + """ + return self._fqdn + + @fqdn.setter + def fqdn(self, fqdn: str): + """Sets the fqdn of this InterfaceDescription. + + Fully Qualified Domain Name # noqa: E501 + + :param fqdn: The fqdn of this InterfaceDescription. + :type fqdn: str + """ + if fqdn is not None and len(fqdn) > 253: + raise ValueError("Invalid value for `fqdn`, length must be less than or equal to `253`") # noqa: E501 + if fqdn is not None and len(fqdn) < 4: + raise ValueError("Invalid value for `fqdn`, length must be greater than or equal to `4`") # noqa: E501 + if fqdn is not None and not re.search(r'^([0-9A-Za-z]([-0-9A-Za-z]{0,61}[0-9A-Za-z])?\.)+[A-Za-z]{2,63}\.?$', fqdn): # noqa: E501 + raise ValueError("Invalid value for `fqdn`, must be a follow pattern or equal to `/^([0-9A-Za-z]([-0-9A-Za-z]{0,61}[0-9A-Za-z])?\.)+[A-Za-z]{2,63}\.?$/`") # noqa: E501 + + self._fqdn = fqdn + + @property + def port(self) -> int: """Gets the port of this InterfaceDescription. Unsigned integer with valid values between 0 and 65535. # noqa: E501 @@ -117,7 +155,7 @@ class InterfaceDescription(Model): return self._port @port.setter - def port(self, port): + def port(self, port: int): """Sets the port of this InterfaceDescription. Unsigned integer with valid values between 0 and 65535. # noqa: E501 @@ -133,10 +171,33 @@ class InterfaceDescription(Model): self._port = port @property - def security_methods(self): + def api_prefix(self) -> str: + """Gets the api_prefix of this InterfaceDescription. + + A string representing a sequence of path segments that starts with the slash character. # noqa: E501 + + :return: The api_prefix of this InterfaceDescription. + :rtype: str + """ + return self._api_prefix + + @api_prefix.setter + def api_prefix(self, api_prefix: str): + """Sets the api_prefix of this InterfaceDescription. + + A string representing a sequence of path segments that starts with the slash character. # noqa: E501 + + :param api_prefix: The api_prefix of this InterfaceDescription. + :type api_prefix: str + """ + + self._api_prefix = api_prefix + + @property + def security_methods(self) -> List[SecurityMethod]: """Gets the security_methods of this InterfaceDescription. - Security methods supported by the interface, it take precedence over the security methods provided in AefProfile, for this specific interface. # noqa: E501 + Security methods supported by the interface, it take precedence over the security methods provided in AefProfile, for this specific interface. # noqa: E501 :return: The security_methods of this InterfaceDescription. :rtype: List[SecurityMethod] @@ -144,10 +205,10 @@ class InterfaceDescription(Model): return self._security_methods @security_methods.setter - def security_methods(self, security_methods): + def security_methods(self, security_methods: List[SecurityMethod]): """Sets the security_methods of this InterfaceDescription. - Security methods supported by the interface, it take precedence over the security methods provided in AefProfile, for this specific interface. # noqa: E501 + Security methods supported by the interface, it take precedence over the security methods provided in AefProfile, for this specific interface. # noqa: E501 :param security_methods: The security_methods of this InterfaceDescription. :type security_methods: List[SecurityMethod] diff --git a/services/TS29222_CAPIF_Auditing_API/logs/models/invalid_param.py b/services/TS29222_CAPIF_Auditing_API/logs/models/invalid_param.py index 17b30eb..7da75a5 100644 --- a/services/TS29222_CAPIF_Auditing_API/logs/models/invalid_param.py +++ b/services/TS29222_CAPIF_Auditing_API/logs/models/invalid_param.py @@ -1,11 +1,8 @@ -# coding: utf-8 - -from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 -from logs.models.base_model_ import Model +from logs.models.base_model import Model from logs import util @@ -48,7 +45,7 @@ class InvalidParam(Model): return util.deserialize_model(dikt, cls) @property - def param(self): + def param(self) -> str: """Gets the param of this InvalidParam. Attribute's name encoded as a JSON Pointer, or header's name. # noqa: E501 @@ -59,7 +56,7 @@ class InvalidParam(Model): return self._param @param.setter - def param(self, param): + def param(self, param: str): """Sets the param of this InvalidParam. Attribute's name encoded as a JSON Pointer, or header's name. # noqa: E501 @@ -73,7 +70,7 @@ class InvalidParam(Model): self._param = param @property - def reason(self): + def reason(self) -> str: """Gets the reason of this InvalidParam. A human-readable reason, e.g. \"must be a positive integer\". # noqa: E501 @@ -84,7 +81,7 @@ class InvalidParam(Model): return self._reason @reason.setter - def reason(self, reason): + def reason(self, reason: str): """Sets the reason of this InvalidParam. A human-readable reason, e.g. \"must be a positive integer\". # noqa: E501 diff --git a/services/TS29222_CAPIF_Auditing_API/logs/models/invocation_log.py b/services/TS29222_CAPIF_Auditing_API/logs/models/invocation_log.py index 4a0bc01..1140577 100644 --- a/services/TS29222_CAPIF_Auditing_API/logs/models/invocation_log.py +++ b/services/TS29222_CAPIF_Auditing_API/logs/models/invocation_log.py @@ -1,11 +1,8 @@ -# coding: utf-8 - -from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 -from logs.models.base_model_ import Model +from logs.models.base_model import Model from logs.models.log import Log import re from logs import util @@ -62,10 +59,10 @@ class InvocationLog(Model): return util.deserialize_model(dikt, cls) @property - def aef_id(self): + def aef_id(self) -> str: """Gets the aef_id of this InvocationLog. - Identity information of the API exposing function requesting logging of service API invocations # noqa: E501 + Identity information of the API exposing function requesting logging of service API invocations # noqa: E501 :return: The aef_id of this InvocationLog. :rtype: str @@ -73,10 +70,10 @@ class InvocationLog(Model): return self._aef_id @aef_id.setter - def aef_id(self, aef_id): + def aef_id(self, aef_id: str): """Sets the aef_id of this InvocationLog. - Identity information of the API exposing function requesting logging of service API invocations # noqa: E501 + Identity information of the API exposing function requesting logging of service API invocations # noqa: E501 :param aef_id: The aef_id of this InvocationLog. :type aef_id: str @@ -87,7 +84,7 @@ class InvocationLog(Model): self._aef_id = aef_id @property - def api_invoker_id(self): + def api_invoker_id(self) -> str: """Gets the api_invoker_id of this InvocationLog. Identity of the API invoker which invoked the service API # noqa: E501 @@ -98,7 +95,7 @@ class InvocationLog(Model): return self._api_invoker_id @api_invoker_id.setter - def api_invoker_id(self, api_invoker_id): + def api_invoker_id(self, api_invoker_id: str): """Sets the api_invoker_id of this InvocationLog. Identity of the API invoker which invoked the service API # noqa: E501 @@ -112,7 +109,7 @@ class InvocationLog(Model): self._api_invoker_id = api_invoker_id @property - def logs(self): + def logs(self) -> List[Log]: """Gets the logs of this InvocationLog. Service API invocation log # noqa: E501 @@ -123,7 +120,7 @@ class InvocationLog(Model): return self._logs @logs.setter - def logs(self, logs): + def logs(self, logs: List[Log]): """Sets the logs of this InvocationLog. Service API invocation log # noqa: E501 @@ -139,10 +136,10 @@ class InvocationLog(Model): self._logs = logs @property - def supported_features(self): + def supported_features(self) -> str: """Gets the supported_features of this InvocationLog. - A string used to indicate the features supported by an API that is used as defined in clause 6.6 in 3GPP TS 29.500. The string shall contain a bitmask indicating supported features in hexadecimal representation Each character in the string shall take a value of \"0\" to \"9\", \"a\" to \"f\" or \"A\" to \"F\" and shall represent the support of 4 features as described in table 5.2.2-3. The most significant character representing the highest-numbered features shall appear first in the string, and the character representing features 1 to 4 shall appear last in the string. The list of features and their numbering (starting with 1) are defined separately for each API. If the string contains a lower number of characters than there are defined features for an API, all features that would be represented by characters that are not present in the string are not supported # noqa: E501 + A string used to indicate the features supported by an API that is used as defined in clause 6.6 in 3GPP TS 29.500. The string shall contain a bitmask indicating supported features in hexadecimal representation Each character in the string shall take a value of \"0\" to \"9\", \"a\" to \"f\" or \"A\" to \"F\" and shall represent the support of 4 features as described in table 5.2.2-3. The most significant character representing the highest-numbered features shall appear first in the string, and the character representing features 1 to 4 shall appear last in the string. The list of features and their numbering (starting with 1) are defined separately for each API. If the string contains a lower number of characters than there are defined features for an API, all features that would be represented by characters that are not present in the string are not supported. # noqa: E501 :return: The supported_features of this InvocationLog. :rtype: str @@ -150,10 +147,10 @@ class InvocationLog(Model): return self._supported_features @supported_features.setter - def supported_features(self, supported_features): + def supported_features(self, supported_features: str): """Sets the supported_features of this InvocationLog. - A string used to indicate the features supported by an API that is used as defined in clause 6.6 in 3GPP TS 29.500. The string shall contain a bitmask indicating supported features in hexadecimal representation Each character in the string shall take a value of \"0\" to \"9\", \"a\" to \"f\" or \"A\" to \"F\" and shall represent the support of 4 features as described in table 5.2.2-3. The most significant character representing the highest-numbered features shall appear first in the string, and the character representing features 1 to 4 shall appear last in the string. The list of features and their numbering (starting with 1) are defined separately for each API. If the string contains a lower number of characters than there are defined features for an API, all features that would be represented by characters that are not present in the string are not supported # noqa: E501 + A string used to indicate the features supported by an API that is used as defined in clause 6.6 in 3GPP TS 29.500. The string shall contain a bitmask indicating supported features in hexadecimal representation Each character in the string shall take a value of \"0\" to \"9\", \"a\" to \"f\" or \"A\" to \"F\" and shall represent the support of 4 features as described in table 5.2.2-3. The most significant character representing the highest-numbered features shall appear first in the string, and the character representing features 1 to 4 shall appear last in the string. The list of features and their numbering (starting with 1) are defined separately for each API. If the string contains a lower number of characters than there are defined features for an API, all features that would be represented by characters that are not present in the string are not supported. # noqa: E501 :param supported_features: The supported_features of this InvocationLog. :type supported_features: str diff --git a/services/TS29222_CAPIF_Auditing_API/logs/models/invocation_logs.py b/services/TS29222_CAPIF_Auditing_API/logs/models/invocation_logs.py new file mode 100644 index 0000000..e56e9c1 --- /dev/null +++ b/services/TS29222_CAPIF_Auditing_API/logs/models/invocation_logs.py @@ -0,0 +1,99 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from logs.models.base_model import Model +from logs.models.invocation_log import InvocationLog +import re +from logs import util + +from logs.models.invocation_log import InvocationLog # noqa: E501 +import re # noqa: E501 + +class InvocationLogs(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, multiple_invocation_logs=None, supported_features=None): # noqa: E501 + """InvocationLogs - a model defined in OpenAPI + + :param multiple_invocation_logs: The multiple_invocation_logs of this InvocationLogs. # noqa: E501 + :type multiple_invocation_logs: List[InvocationLog] + :param supported_features: The supported_features of this InvocationLogs. # noqa: E501 + :type supported_features: str + """ + self.openapi_types = { + 'multiple_invocation_logs': List[InvocationLog], + 'supported_features': str + } + + self.attribute_map = { + 'multiple_invocation_logs': 'multipleInvocationLogs', + 'supported_features': 'supportedFeatures' + } + + self._multiple_invocation_logs = multiple_invocation_logs + self._supported_features = supported_features + + @classmethod + def from_dict(cls, dikt) -> 'InvocationLogs': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The InvocationLogs of this InvocationLogs. # noqa: E501 + :rtype: InvocationLogs + """ + return util.deserialize_model(dikt, cls) + + @property + def multiple_invocation_logs(self) -> List[InvocationLog]: + """Gets the multiple_invocation_logs of this InvocationLogs. + + + :return: The multiple_invocation_logs of this InvocationLogs. + :rtype: List[InvocationLog] + """ + return self._multiple_invocation_logs + + @multiple_invocation_logs.setter + def multiple_invocation_logs(self, multiple_invocation_logs: List[InvocationLog]): + """Sets the multiple_invocation_logs of this InvocationLogs. + + + :param multiple_invocation_logs: The multiple_invocation_logs of this InvocationLogs. + :type multiple_invocation_logs: List[InvocationLog] + """ + if multiple_invocation_logs is None: + raise ValueError("Invalid value for `multiple_invocation_logs`, must not be `None`") # noqa: E501 + if multiple_invocation_logs is not None and len(multiple_invocation_logs) < 1: + raise ValueError("Invalid value for `multiple_invocation_logs`, number of items must be greater than or equal to `1`") # noqa: E501 + + self._multiple_invocation_logs = multiple_invocation_logs + + @property + def supported_features(self) -> str: + """Gets the supported_features of this InvocationLogs. + + A string used to indicate the features supported by an API that is used as defined in clause 6.6 in 3GPP TS 29.500. The string shall contain a bitmask indicating supported features in hexadecimal representation Each character in the string shall take a value of \"0\" to \"9\", \"a\" to \"f\" or \"A\" to \"F\" and shall represent the support of 4 features as described in table 5.2.2-3. The most significant character representing the highest-numbered features shall appear first in the string, and the character representing features 1 to 4 shall appear last in the string. The list of features and their numbering (starting with 1) are defined separately for each API. If the string contains a lower number of characters than there are defined features for an API, all features that would be represented by characters that are not present in the string are not supported. # noqa: E501 + + :return: The supported_features of this InvocationLogs. + :rtype: str + """ + return self._supported_features + + @supported_features.setter + def supported_features(self, supported_features: str): + """Sets the supported_features of this InvocationLogs. + + A string used to indicate the features supported by an API that is used as defined in clause 6.6 in 3GPP TS 29.500. The string shall contain a bitmask indicating supported features in hexadecimal representation Each character in the string shall take a value of \"0\" to \"9\", \"a\" to \"f\" or \"A\" to \"F\" and shall represent the support of 4 features as described in table 5.2.2-3. The most significant character representing the highest-numbered features shall appear first in the string, and the character representing features 1 to 4 shall appear last in the string. The list of features and their numbering (starting with 1) are defined separately for each API. If the string contains a lower number of characters than there are defined features for an API, all features that would be represented by characters that are not present in the string are not supported. # noqa: E501 + + :param supported_features: The supported_features of this InvocationLogs. + :type supported_features: str + """ + if supported_features is not None and not re.search(r'^[A-Fa-f0-9]*$', supported_features): # noqa: E501 + raise ValueError("Invalid value for `supported_features`, must be a follow pattern or equal to `/^[A-Fa-f0-9]*$/`") # noqa: E501 + + self._supported_features = supported_features diff --git a/services/TS29222_CAPIF_Auditing_API/logs/models/invocation_logs_retrieve_res.py b/services/TS29222_CAPIF_Auditing_API/logs/models/invocation_logs_retrieve_res.py new file mode 100644 index 0000000..f25c77c --- /dev/null +++ b/services/TS29222_CAPIF_Auditing_API/logs/models/invocation_logs_retrieve_res.py @@ -0,0 +1,195 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from logs.models.base_model import Model +from logs.models.invocation_log import InvocationLog +from logs.models.invocation_logs import InvocationLogs +from logs.models.log import Log +import re +from logs import util + +from logs.models.invocation_log import InvocationLog # noqa: E501 +from logs.models.invocation_logs import InvocationLogs # noqa: E501 +from logs.models.log import Log # noqa: E501 +import re # noqa: E501 + +class InvocationLogsRetrieveRes(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, aef_id=None, api_invoker_id=None, logs=None, supported_features=None, multiple_invocation_logs=None): # noqa: E501 + """InvocationLogsRetrieveRes - a model defined in OpenAPI + + :param aef_id: The aef_id of this InvocationLogsRetrieveRes. # noqa: E501 + :type aef_id: str + :param api_invoker_id: The api_invoker_id of this InvocationLogsRetrieveRes. # noqa: E501 + :type api_invoker_id: str + :param logs: The logs of this InvocationLogsRetrieveRes. # noqa: E501 + :type logs: List[Log] + :param supported_features: The supported_features of this InvocationLogsRetrieveRes. # noqa: E501 + :type supported_features: str + :param multiple_invocation_logs: The multiple_invocation_logs of this InvocationLogsRetrieveRes. # noqa: E501 + :type multiple_invocation_logs: List[InvocationLog] + """ + self.openapi_types = { + 'aef_id': str, + 'api_invoker_id': str, + 'logs': List[Log], + 'supported_features': str, + 'multiple_invocation_logs': List[InvocationLog] + } + + self.attribute_map = { + 'aef_id': 'aefId', + 'api_invoker_id': 'apiInvokerId', + 'logs': 'logs', + 'supported_features': 'supportedFeatures', + 'multiple_invocation_logs': 'multipleInvocationLogs' + } + + self._aef_id = aef_id + self._api_invoker_id = api_invoker_id + self._logs = logs + self._supported_features = supported_features + self._multiple_invocation_logs = multiple_invocation_logs + + @classmethod + def from_dict(cls, dikt) -> 'InvocationLogsRetrieveRes': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The InvocationLogsRetrieveRes of this InvocationLogsRetrieveRes. # noqa: E501 + :rtype: InvocationLogsRetrieveRes + """ + return util.deserialize_model(dikt, cls) + + @property + def aef_id(self) -> str: + """Gets the aef_id of this InvocationLogsRetrieveRes. + + Identity information of the API exposing function requesting logging of service API invocations # noqa: E501 + + :return: The aef_id of this InvocationLogsRetrieveRes. + :rtype: str + """ + return self._aef_id + + @aef_id.setter + def aef_id(self, aef_id: str): + """Sets the aef_id of this InvocationLogsRetrieveRes. + + Identity information of the API exposing function requesting logging of service API invocations # noqa: E501 + + :param aef_id: The aef_id of this InvocationLogsRetrieveRes. + :type aef_id: str + """ + if aef_id is None: + raise ValueError("Invalid value for `aef_id`, must not be `None`") # noqa: E501 + + self._aef_id = aef_id + + @property + def api_invoker_id(self) -> str: + """Gets the api_invoker_id of this InvocationLogsRetrieveRes. + + Identity of the API invoker which invoked the service API # noqa: E501 + + :return: The api_invoker_id of this InvocationLogsRetrieveRes. + :rtype: str + """ + return self._api_invoker_id + + @api_invoker_id.setter + def api_invoker_id(self, api_invoker_id: str): + """Sets the api_invoker_id of this InvocationLogsRetrieveRes. + + Identity of the API invoker which invoked the service API # noqa: E501 + + :param api_invoker_id: The api_invoker_id of this InvocationLogsRetrieveRes. + :type api_invoker_id: str + """ + if api_invoker_id is None: + raise ValueError("Invalid value for `api_invoker_id`, must not be `None`") # noqa: E501 + + self._api_invoker_id = api_invoker_id + + @property + def logs(self) -> List[Log]: + """Gets the logs of this InvocationLogsRetrieveRes. + + Service API invocation log # noqa: E501 + + :return: The logs of this InvocationLogsRetrieveRes. + :rtype: List[Log] + """ + return self._logs + + @logs.setter + def logs(self, logs: List[Log]): + """Sets the logs of this InvocationLogsRetrieveRes. + + Service API invocation log # noqa: E501 + + :param logs: The logs of this InvocationLogsRetrieveRes. + :type logs: List[Log] + """ + if logs is None: + raise ValueError("Invalid value for `logs`, must not be `None`") # noqa: E501 + if logs is not None and len(logs) < 1: + raise ValueError("Invalid value for `logs`, number of items must be greater than or equal to `1`") # noqa: E501 + + self._logs = logs + + @property + def supported_features(self) -> str: + """Gets the supported_features of this InvocationLogsRetrieveRes. + + A string used to indicate the features supported by an API that is used as defined in clause 6.6 in 3GPP TS 29.500. The string shall contain a bitmask indicating supported features in hexadecimal representation Each character in the string shall take a value of \"0\" to \"9\", \"a\" to \"f\" or \"A\" to \"F\" and shall represent the support of 4 features as described in table 5.2.2-3. The most significant character representing the highest-numbered features shall appear first in the string, and the character representing features 1 to 4 shall appear last in the string. The list of features and their numbering (starting with 1) are defined separately for each API. If the string contains a lower number of characters than there are defined features for an API, all features that would be represented by characters that are not present in the string are not supported. # noqa: E501 + + :return: The supported_features of this InvocationLogsRetrieveRes. + :rtype: str + """ + return self._supported_features + + @supported_features.setter + def supported_features(self, supported_features: str): + """Sets the supported_features of this InvocationLogsRetrieveRes. + + A string used to indicate the features supported by an API that is used as defined in clause 6.6 in 3GPP TS 29.500. The string shall contain a bitmask indicating supported features in hexadecimal representation Each character in the string shall take a value of \"0\" to \"9\", \"a\" to \"f\" or \"A\" to \"F\" and shall represent the support of 4 features as described in table 5.2.2-3. The most significant character representing the highest-numbered features shall appear first in the string, and the character representing features 1 to 4 shall appear last in the string. The list of features and their numbering (starting with 1) are defined separately for each API. If the string contains a lower number of characters than there are defined features for an API, all features that would be represented by characters that are not present in the string are not supported. # noqa: E501 + + :param supported_features: The supported_features of this InvocationLogsRetrieveRes. + :type supported_features: str + """ + if supported_features is not None and not re.search(r'^[A-Fa-f0-9]*$', supported_features): # noqa: E501 + raise ValueError("Invalid value for `supported_features`, must be a follow pattern or equal to `/^[A-Fa-f0-9]*$/`") # noqa: E501 + + self._supported_features = supported_features + + @property + def multiple_invocation_logs(self) -> List[InvocationLog]: + """Gets the multiple_invocation_logs of this InvocationLogsRetrieveRes. + + + :return: The multiple_invocation_logs of this InvocationLogsRetrieveRes. + :rtype: List[InvocationLog] + """ + return self._multiple_invocation_logs + + @multiple_invocation_logs.setter + def multiple_invocation_logs(self, multiple_invocation_logs: List[InvocationLog]): + """Sets the multiple_invocation_logs of this InvocationLogsRetrieveRes. + + + :param multiple_invocation_logs: The multiple_invocation_logs of this InvocationLogsRetrieveRes. + :type multiple_invocation_logs: List[InvocationLog] + """ + if multiple_invocation_logs is None: + raise ValueError("Invalid value for `multiple_invocation_logs`, must not be `None`") # noqa: E501 + if multiple_invocation_logs is not None and len(multiple_invocation_logs) < 1: + raise ValueError("Invalid value for `multiple_invocation_logs`, number of items must be greater than or equal to `1`") # noqa: E501 + + self._multiple_invocation_logs = multiple_invocation_logs diff --git a/services/TS29222_CAPIF_Auditing_API/logs/models/log.py b/services/TS29222_CAPIF_Auditing_API/logs/models/log.py index 44c50ef..ef5604a 100644 --- a/services/TS29222_CAPIF_Auditing_API/logs/models/log.py +++ b/services/TS29222_CAPIF_Auditing_API/logs/models/log.py @@ -1,11 +1,8 @@ -# coding: utf-8 - -from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 -from logs.models.base_model_ import Model +from logs.models.base_model import Model from logs.models.interface_description import InterfaceDescription from logs.models.operation import Operation from logs.models.protocol import Protocol @@ -119,7 +116,7 @@ class Log(Model): return util.deserialize_model(dikt, cls) @property - def api_id(self): + def api_id(self) -> str: """Gets the api_id of this Log. String identifying the API invoked. # noqa: E501 @@ -130,7 +127,7 @@ class Log(Model): return self._api_id @api_id.setter - def api_id(self, api_id): + def api_id(self, api_id: str): """Sets the api_id of this Log. String identifying the API invoked. # noqa: E501 @@ -144,10 +141,10 @@ class Log(Model): self._api_id = api_id @property - def api_name(self): + def api_name(self) -> str: """Gets the api_name of this Log. - Name of the API which was invoked, it is set as {apiName} part of the URI structure as defined in subclause 4.4 of 3GPP TS 29.501. # noqa: E501 + Name of the API which was invoked, it is set as {apiName} part of the URI structure as defined in clause 5.2.4 of 3GPP TS 29.122. # noqa: E501 :return: The api_name of this Log. :rtype: str @@ -155,10 +152,10 @@ class Log(Model): return self._api_name @api_name.setter - def api_name(self, api_name): + def api_name(self, api_name: str): """Sets the api_name of this Log. - Name of the API which was invoked, it is set as {apiName} part of the URI structure as defined in subclause 4.4 of 3GPP TS 29.501. # noqa: E501 + Name of the API which was invoked, it is set as {apiName} part of the URI structure as defined in clause 5.2.4 of 3GPP TS 29.122. # noqa: E501 :param api_name: The api_name of this Log. :type api_name: str @@ -169,7 +166,7 @@ class Log(Model): self._api_name = api_name @property - def api_version(self): + def api_version(self) -> str: """Gets the api_version of this Log. Version of the API which was invoked # noqa: E501 @@ -180,7 +177,7 @@ class Log(Model): return self._api_version @api_version.setter - def api_version(self, api_version): + def api_version(self, api_version: str): """Sets the api_version of this Log. Version of the API which was invoked # noqa: E501 @@ -194,7 +191,7 @@ class Log(Model): self._api_version = api_version @property - def resource_name(self): + def resource_name(self) -> str: """Gets the resource_name of this Log. Name of the specific resource invoked # noqa: E501 @@ -205,7 +202,7 @@ class Log(Model): return self._resource_name @resource_name.setter - def resource_name(self, resource_name): + def resource_name(self, resource_name: str): """Sets the resource_name of this Log. Name of the specific resource invoked # noqa: E501 @@ -219,7 +216,7 @@ class Log(Model): self._resource_name = resource_name @property - def uri(self): + def uri(self) -> str: """Gets the uri of this Log. string providing an URI formatted according to IETF RFC 3986. # noqa: E501 @@ -230,7 +227,7 @@ class Log(Model): return self._uri @uri.setter - def uri(self, uri): + def uri(self, uri: str): """Sets the uri of this Log. string providing an URI formatted according to IETF RFC 3986. # noqa: E501 @@ -242,7 +239,7 @@ class Log(Model): self._uri = uri @property - def protocol(self): + def protocol(self) -> Protocol: """Gets the protocol of this Log. @@ -252,7 +249,7 @@ class Log(Model): return self._protocol @protocol.setter - def protocol(self, protocol): + def protocol(self, protocol: Protocol): """Sets the protocol of this Log. @@ -265,7 +262,7 @@ class Log(Model): self._protocol = protocol @property - def operation(self): + def operation(self) -> Operation: """Gets the operation of this Log. @@ -275,7 +272,7 @@ class Log(Model): return self._operation @operation.setter - def operation(self, operation): + def operation(self, operation: Operation): """Sets the operation of this Log. @@ -286,7 +283,7 @@ class Log(Model): self._operation = operation @property - def result(self): + def result(self) -> str: """Gets the result of this Log. For HTTP protocol, it contains HTTP status code of the invocation # noqa: E501 @@ -297,7 +294,7 @@ class Log(Model): return self._result @result.setter - def result(self, result): + def result(self, result: str): """Sets the result of this Log. For HTTP protocol, it contains HTTP status code of the invocation # noqa: E501 @@ -311,7 +308,7 @@ class Log(Model): self._result = result @property - def invocation_time(self): + def invocation_time(self) -> datetime: """Gets the invocation_time of this Log. string with format \"date-time\" as defined in OpenAPI. # noqa: E501 @@ -322,7 +319,7 @@ class Log(Model): return self._invocation_time @invocation_time.setter - def invocation_time(self, invocation_time): + def invocation_time(self, invocation_time: datetime): """Sets the invocation_time of this Log. string with format \"date-time\" as defined in OpenAPI. # noqa: E501 @@ -334,10 +331,10 @@ class Log(Model): self._invocation_time = invocation_time @property - def invocation_latency(self): + def invocation_latency(self) -> int: """Gets the invocation_latency of this Log. - Unsigned integer identifying a period of time in units of milliseconds. # noqa: E501 + Represents a period of time in units of milliseconds. # noqa: E501 :return: The invocation_latency of this Log. :rtype: int @@ -345,10 +342,10 @@ class Log(Model): return self._invocation_latency @invocation_latency.setter - def invocation_latency(self, invocation_latency): + def invocation_latency(self, invocation_latency: int): """Sets the invocation_latency of this Log. - Unsigned integer identifying a period of time in units of milliseconds. # noqa: E501 + Represents a period of time in units of milliseconds. # noqa: E501 :param invocation_latency: The invocation_latency of this Log. :type invocation_latency: int @@ -359,10 +356,10 @@ class Log(Model): self._invocation_latency = invocation_latency @property - def input_parameters(self): + def input_parameters(self) -> object: """Gets the input_parameters of this Log. - List of input parameters. Can be any value - string, number, boolean, array or object. # noqa: E501 + List of input parameters. Can be any value - string, number, boolean, array or object. # noqa: E501 :return: The input_parameters of this Log. :rtype: object @@ -370,10 +367,10 @@ class Log(Model): return self._input_parameters @input_parameters.setter - def input_parameters(self, input_parameters): + def input_parameters(self, input_parameters: object): """Sets the input_parameters of this Log. - List of input parameters. Can be any value - string, number, boolean, array or object. # noqa: E501 + List of input parameters. Can be any value - string, number, boolean, array or object. # noqa: E501 :param input_parameters: The input_parameters of this Log. :type input_parameters: object @@ -382,10 +379,10 @@ class Log(Model): self._input_parameters = input_parameters @property - def output_parameters(self): + def output_parameters(self) -> object: """Gets the output_parameters of this Log. - List of output parameters. Can be any value - string, number, boolean, array or object. # noqa: E501 + List of output parameters. Can be any value - string, number, boolean, array or object. # noqa: E501 :return: The output_parameters of this Log. :rtype: object @@ -393,10 +390,10 @@ class Log(Model): return self._output_parameters @output_parameters.setter - def output_parameters(self, output_parameters): + def output_parameters(self, output_parameters: object): """Sets the output_parameters of this Log. - List of output parameters. Can be any value - string, number, boolean, array or object. # noqa: E501 + List of output parameters. Can be any value - string, number, boolean, array or object. # noqa: E501 :param output_parameters: The output_parameters of this Log. :type output_parameters: object @@ -405,7 +402,7 @@ class Log(Model): self._output_parameters = output_parameters @property - def src_interface(self): + def src_interface(self) -> InterfaceDescription: """Gets the src_interface of this Log. @@ -415,7 +412,7 @@ class Log(Model): return self._src_interface @src_interface.setter - def src_interface(self, src_interface): + def src_interface(self, src_interface: InterfaceDescription): """Sets the src_interface of this Log. @@ -426,7 +423,7 @@ class Log(Model): self._src_interface = src_interface @property - def dest_interface(self): + def dest_interface(self) -> InterfaceDescription: """Gets the dest_interface of this Log. @@ -436,7 +433,7 @@ class Log(Model): return self._dest_interface @dest_interface.setter - def dest_interface(self, dest_interface): + def dest_interface(self, dest_interface: InterfaceDescription): """Sets the dest_interface of this Log. @@ -447,10 +444,10 @@ class Log(Model): self._dest_interface = dest_interface @property - def fwd_interface(self): + def fwd_interface(self) -> str: """Gets the fwd_interface of this Log. - It includes the node identifier (as defined in IETF RFC 7239 of all forwarding entities between the API invoker and the AEF, concatenated with comma and space, e.g. 192.0.2.43:80, unknown:_OBFport, 203.0.113.60 # noqa: E501 + It includes the node identifier (as defined in IETF RFC 7239 of all forwarding entities between the API invoker and the AEF, concatenated with comma and space, e.g. 192.0.2.43:80, unknown:_OBFport, 203.0.113.60 # noqa: E501 :return: The fwd_interface of this Log. :rtype: str @@ -458,10 +455,10 @@ class Log(Model): return self._fwd_interface @fwd_interface.setter - def fwd_interface(self, fwd_interface): + def fwd_interface(self, fwd_interface: str): """Sets the fwd_interface of this Log. - It includes the node identifier (as defined in IETF RFC 7239 of all forwarding entities between the API invoker and the AEF, concatenated with comma and space, e.g. 192.0.2.43:80, unknown:_OBFport, 203.0.113.60 # noqa: E501 + It includes the node identifier (as defined in IETF RFC 7239 of all forwarding entities between the API invoker and the AEF, concatenated with comma and space, e.g. 192.0.2.43:80, unknown:_OBFport, 203.0.113.60 # noqa: E501 :param fwd_interface: The fwd_interface of this Log. :type fwd_interface: str diff --git a/services/TS29222_CAPIF_Auditing_API/logs/models/operation.py b/services/TS29222_CAPIF_Auditing_API/logs/models/operation.py index 6e9c939..a8efafd 100644 --- a/services/TS29222_CAPIF_Auditing_API/logs/models/operation.py +++ b/services/TS29222_CAPIF_Auditing_API/logs/models/operation.py @@ -1,11 +1,8 @@ -# coding: utf-8 - -from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 -from logs.models.base_model_ import Model +from logs.models.base_model import Model from logs import util @@ -15,14 +12,6 @@ class Operation(Model): Do not edit the class manually. """ - """ - allowed enum values - """ - GET = "GET" - POST = "POST" - PUT = "PUT" - PATCH = "PATCH" - DELETE = "DELETE" def __init__(self): # noqa: E501 """Operation - a model defined in OpenAPI diff --git a/services/TS29222_CAPIF_Auditing_API/logs/models/operation_any_of.py b/services/TS29222_CAPIF_Auditing_API/logs/models/operation_any_of.py deleted file mode 100644 index 7d6eb40..0000000 --- a/services/TS29222_CAPIF_Auditing_API/logs/models/operation_any_of.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding: utf-8 - -from __future__ import absolute_import -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from logs.models.base_model_ import Model -from logs import util - - -class OperationAnyOf(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - """ - allowed enum values - """ - GET = "GET" - POST = "POST" - PUT = "PUT" - PATCH = "PATCH" - DELETE = "DELETE" - def __init__(self): # noqa: E501 - """OperationAnyOf - a model defined in OpenAPI - - """ - self.openapi_types = { - } - - self.attribute_map = { - } - - @classmethod - def from_dict(cls, dikt) -> 'OperationAnyOf': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The Operation_anyOf of this OperationAnyOf. # noqa: E501 - :rtype: OperationAnyOf - """ - return util.deserialize_model(dikt, cls) diff --git a/services/TS29222_CAPIF_Auditing_API/logs/models/problem_details.py b/services/TS29222_CAPIF_Auditing_API/logs/models/problem_details.py index 28d4510..cae1546 100644 --- a/services/TS29222_CAPIF_Auditing_API/logs/models/problem_details.py +++ b/services/TS29222_CAPIF_Auditing_API/logs/models/problem_details.py @@ -1,11 +1,8 @@ -# coding: utf-8 - -from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 -from logs.models.base_model_ import Model +from logs.models.base_model import Model from logs.models.invalid_param import InvalidParam import re from logs import util @@ -82,7 +79,7 @@ class ProblemDetails(Model): return util.deserialize_model(dikt, cls) @property - def type(self): + def type(self) -> str: """Gets the type of this ProblemDetails. string providing an URI formatted according to IETF RFC 3986. # noqa: E501 @@ -93,7 +90,7 @@ class ProblemDetails(Model): return self._type @type.setter - def type(self, type): + def type(self, type: str): """Sets the type of this ProblemDetails. string providing an URI formatted according to IETF RFC 3986. # noqa: E501 @@ -105,10 +102,10 @@ class ProblemDetails(Model): self._type = type @property - def title(self): + def title(self) -> str: """Gets the title of this ProblemDetails. - A short, human-readable summary of the problem type. It should not change from occurrence to occurrence of the problem. # noqa: E501 + A short, human-readable summary of the problem type. It should not change from occurrence to occurrence of the problem. # noqa: E501 :return: The title of this ProblemDetails. :rtype: str @@ -116,10 +113,10 @@ class ProblemDetails(Model): return self._title @title.setter - def title(self, title): + def title(self, title: str): """Sets the title of this ProblemDetails. - A short, human-readable summary of the problem type. It should not change from occurrence to occurrence of the problem. # noqa: E501 + A short, human-readable summary of the problem type. It should not change from occurrence to occurrence of the problem. # noqa: E501 :param title: The title of this ProblemDetails. :type title: str @@ -128,7 +125,7 @@ class ProblemDetails(Model): self._title = title @property - def status(self): + def status(self) -> int: """Gets the status of this ProblemDetails. The HTTP status code for this occurrence of the problem. # noqa: E501 @@ -139,7 +136,7 @@ class ProblemDetails(Model): return self._status @status.setter - def status(self, status): + def status(self, status: int): """Sets the status of this ProblemDetails. The HTTP status code for this occurrence of the problem. # noqa: E501 @@ -151,7 +148,7 @@ class ProblemDetails(Model): self._status = status @property - def detail(self): + def detail(self) -> str: """Gets the detail of this ProblemDetails. A human-readable explanation specific to this occurrence of the problem. # noqa: E501 @@ -162,7 +159,7 @@ class ProblemDetails(Model): return self._detail @detail.setter - def detail(self, detail): + def detail(self, detail: str): """Sets the detail of this ProblemDetails. A human-readable explanation specific to this occurrence of the problem. # noqa: E501 @@ -174,7 +171,7 @@ class ProblemDetails(Model): self._detail = detail @property - def instance(self): + def instance(self) -> str: """Gets the instance of this ProblemDetails. string providing an URI formatted according to IETF RFC 3986. # noqa: E501 @@ -185,7 +182,7 @@ class ProblemDetails(Model): return self._instance @instance.setter - def instance(self, instance): + def instance(self, instance: str): """Sets the instance of this ProblemDetails. string providing an URI formatted according to IETF RFC 3986. # noqa: E501 @@ -197,10 +194,10 @@ class ProblemDetails(Model): self._instance = instance @property - def cause(self): + def cause(self) -> str: """Gets the cause of this ProblemDetails. - A machine-readable application error cause specific to this occurrence of the problem. This IE should be present and provide application-related error information, if available. # noqa: E501 + A machine-readable application error cause specific to this occurrence of the problem. This IE should be present and provide application-related error information, if available. # noqa: E501 :return: The cause of this ProblemDetails. :rtype: str @@ -208,10 +205,10 @@ class ProblemDetails(Model): return self._cause @cause.setter - def cause(self, cause): + def cause(self, cause: str): """Sets the cause of this ProblemDetails. - A machine-readable application error cause specific to this occurrence of the problem. This IE should be present and provide application-related error information, if available. # noqa: E501 + A machine-readable application error cause specific to this occurrence of the problem. This IE should be present and provide application-related error information, if available. # noqa: E501 :param cause: The cause of this ProblemDetails. :type cause: str @@ -220,10 +217,10 @@ class ProblemDetails(Model): self._cause = cause @property - def invalid_params(self): + def invalid_params(self) -> List[InvalidParam]: """Gets the invalid_params of this ProblemDetails. - Description of invalid parameters, for a request rejected due to invalid parameters. # noqa: E501 + Description of invalid parameters, for a request rejected due to invalid parameters. # noqa: E501 :return: The invalid_params of this ProblemDetails. :rtype: List[InvalidParam] @@ -231,10 +228,10 @@ class ProblemDetails(Model): return self._invalid_params @invalid_params.setter - def invalid_params(self, invalid_params): + def invalid_params(self, invalid_params: List[InvalidParam]): """Sets the invalid_params of this ProblemDetails. - Description of invalid parameters, for a request rejected due to invalid parameters. # noqa: E501 + Description of invalid parameters, for a request rejected due to invalid parameters. # noqa: E501 :param invalid_params: The invalid_params of this ProblemDetails. :type invalid_params: List[InvalidParam] @@ -245,10 +242,10 @@ class ProblemDetails(Model): self._invalid_params = invalid_params @property - def supported_features(self): + def supported_features(self) -> str: """Gets the supported_features of this ProblemDetails. - A string used to indicate the features supported by an API that is used as defined in clause 6.6 in 3GPP TS 29.500. The string shall contain a bitmask indicating supported features in hexadecimal representation Each character in the string shall take a value of \"0\" to \"9\", \"a\" to \"f\" or \"A\" to \"F\" and shall represent the support of 4 features as described in table 5.2.2-3. The most significant character representing the highest-numbered features shall appear first in the string, and the character representing features 1 to 4 shall appear last in the string. The list of features and their numbering (starting with 1) are defined separately for each API. If the string contains a lower number of characters than there are defined features for an API, all features that would be represented by characters that are not present in the string are not supported # noqa: E501 + A string used to indicate the features supported by an API that is used as defined in clause 6.6 in 3GPP TS 29.500. The string shall contain a bitmask indicating supported features in hexadecimal representation Each character in the string shall take a value of \"0\" to \"9\", \"a\" to \"f\" or \"A\" to \"F\" and shall represent the support of 4 features as described in table 5.2.2-3. The most significant character representing the highest-numbered features shall appear first in the string, and the character representing features 1 to 4 shall appear last in the string. The list of features and their numbering (starting with 1) are defined separately for each API. If the string contains a lower number of characters than there are defined features for an API, all features that would be represented by characters that are not present in the string are not supported. # noqa: E501 :return: The supported_features of this ProblemDetails. :rtype: str @@ -256,10 +253,10 @@ class ProblemDetails(Model): return self._supported_features @supported_features.setter - def supported_features(self, supported_features): + def supported_features(self, supported_features: str): """Sets the supported_features of this ProblemDetails. - A string used to indicate the features supported by an API that is used as defined in clause 6.6 in 3GPP TS 29.500. The string shall contain a bitmask indicating supported features in hexadecimal representation Each character in the string shall take a value of \"0\" to \"9\", \"a\" to \"f\" or \"A\" to \"F\" and shall represent the support of 4 features as described in table 5.2.2-3. The most significant character representing the highest-numbered features shall appear first in the string, and the character representing features 1 to 4 shall appear last in the string. The list of features and their numbering (starting with 1) are defined separately for each API. If the string contains a lower number of characters than there are defined features for an API, all features that would be represented by characters that are not present in the string are not supported # noqa: E501 + A string used to indicate the features supported by an API that is used as defined in clause 6.6 in 3GPP TS 29.500. The string shall contain a bitmask indicating supported features in hexadecimal representation Each character in the string shall take a value of \"0\" to \"9\", \"a\" to \"f\" or \"A\" to \"F\" and shall represent the support of 4 features as described in table 5.2.2-3. The most significant character representing the highest-numbered features shall appear first in the string, and the character representing features 1 to 4 shall appear last in the string. The list of features and their numbering (starting with 1) are defined separately for each API. If the string contains a lower number of characters than there are defined features for an API, all features that would be represented by characters that are not present in the string are not supported. # noqa: E501 :param supported_features: The supported_features of this ProblemDetails. :type supported_features: str diff --git a/services/TS29222_CAPIF_Auditing_API/logs/models/protocol.py b/services/TS29222_CAPIF_Auditing_API/logs/models/protocol.py index 8016cba..989d9e4 100644 --- a/services/TS29222_CAPIF_Auditing_API/logs/models/protocol.py +++ b/services/TS29222_CAPIF_Auditing_API/logs/models/protocol.py @@ -1,11 +1,8 @@ -# coding: utf-8 - -from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 -from logs.models.base_model_ import Model +from logs.models.base_model import Model from logs import util @@ -15,11 +12,6 @@ class Protocol(Model): Do not edit the class manually. """ - """ - allowed enum values - """ - _1_1 = "HTTP_1_1" - _2 = "HTTP_2" def __init__(self): # noqa: E501 """Protocol - a model defined in OpenAPI diff --git a/services/TS29222_CAPIF_Auditing_API/logs/models/protocol_any_of.py b/services/TS29222_CAPIF_Auditing_API/logs/models/protocol_any_of.py deleted file mode 100644 index c6de47f..0000000 --- a/services/TS29222_CAPIF_Auditing_API/logs/models/protocol_any_of.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding: utf-8 - -from __future__ import absolute_import -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from logs.models.base_model_ import Model -from logs import util - - -class ProtocolAnyOf(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - """ - allowed enum values - """ - _1_1 = "HTTP_1_1" - _2 = "HTTP_2" - def __init__(self): # noqa: E501 - """ProtocolAnyOf - a model defined in OpenAPI - - """ - self.openapi_types = { - } - - self.attribute_map = { - } - - @classmethod - def from_dict(cls, dikt) -> 'ProtocolAnyOf': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The Protocol_anyOf of this ProtocolAnyOf. # noqa: E501 - :rtype: ProtocolAnyOf - """ - return util.deserialize_model(dikt, cls) diff --git a/services/TS29222_CAPIF_Auditing_API/logs/models/security_method.py b/services/TS29222_CAPIF_Auditing_API/logs/models/security_method.py index ef1ce82..b32bbf5 100644 --- a/services/TS29222_CAPIF_Auditing_API/logs/models/security_method.py +++ b/services/TS29222_CAPIF_Auditing_API/logs/models/security_method.py @@ -1,25 +1,17 @@ -# coding: utf-8 - -from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 -from logs.models.base_model_ import Model +from logs.models.base_model import Model from logs import util + class SecurityMethod(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ - """ - allowed enum values - """ - PSK = "PSK" - PKI = "PKI" - OAUTH = "OAUTH" def __init__(self): # noqa: E501 """SecurityMethod - a model defined in OpenAPI diff --git a/services/TS29222_CAPIF_Auditing_API/logs/models/security_method_any_of.py b/services/TS29222_CAPIF_Auditing_API/logs/models/security_method_any_of.py deleted file mode 100644 index cebc877..0000000 --- a/services/TS29222_CAPIF_Auditing_API/logs/models/security_method_any_of.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding: utf-8 - -from __future__ import absolute_import -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from logs.models.base_model_ import Model -from logs import util - - -class SecurityMethodAnyOf(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - """ - allowed enum values - """ - PSK = "PSK" - PKI = "PKI" - OAUTH = "OAUTH" - def __init__(self): # noqa: E501 - """SecurityMethodAnyOf - a model defined in OpenAPI - - """ - self.openapi_types = { - } - - self.attribute_map = { - } - - @classmethod - def from_dict(cls, dikt) -> 'SecurityMethodAnyOf': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The SecurityMethod_anyOf of this SecurityMethodAnyOf. # noqa: E501 - :rtype: SecurityMethodAnyOf - """ - return util.deserialize_model(dikt, cls) diff --git a/services/TS29222_CAPIF_Auditing_API/logs/openapi/openapi.yaml b/services/TS29222_CAPIF_Auditing_API/logs/openapi/openapi.yaml index e619908..7a2cfcd 100644 --- a/services/TS29222_CAPIF_Auditing_API/logs/openapi/openapi.yaml +++ b/services/TS29222_CAPIF_Auditing_API/logs/openapi/openapi.yaml @@ -1,11 +1,11 @@ openapi: 3.0.0 info: - description: "API for auditing. \n© 2022, 3GPP Organizational Partners (ARIB, ATIS,\ + description: "API for auditing. \n© 2023, 3GPP Organizational Partners (ARIB, ATIS,\ \ CCSA, ETSI, TSDSI, TTA, TTC). \nAll rights reserved.\n" title: CAPIF_Auditing_API - version: 1.2.1 + version: 1.3.0-alpha.2 externalDocs: - description: 3GPP TS 29.222 V17.6.0 Common API Framework for 3GPP Northbound APIs + description: 3GPP TS 29.222 V18.1.0 Common API Framework for 3GPP Northbound APIs url: https://www.3gpp.org/ftp/Specs/archive/29_series/29.222/ servers: - url: "{apiRoot}/logs/v1" @@ -110,26 +110,22 @@ paths: schema: type: string style: form - - description: Interface description of the API invoker. - example: "{\"ipv4Addr\": \"192.168.1.7\",\"port\": 8888,\"securityMethods\"\ - : [\"OAuth\"]}" - explode: true + - content: + application/json: + schema: + $ref: '#/components/schemas/InterfaceDescription' + description: Interface description of the API invoker. in: query name: src-interface required: false - schema: - type: string - style: form - - description: Interface description of the API invoked. - example: "{\"ipv4Addr\": \"192.168.1.7\",\"port\": 8888,\"securityMethods\"\ - : [\"OAuth\"]}" - explode: true + - content: + application/json: + schema: + $ref: '#/components/schemas/InterfaceDescription' + description: Interface description of the API invoked. in: query name: dest-interface required: false - schema: - type: string - style: form - description: To filter irrelevant responses related to unsupported features explode: true in: query @@ -143,7 +139,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/InvocationLog' + $ref: '#/components/schemas/InvocationLogsRetrieveRes' description: | Result of the query operation along with fetched service API invocation log data. "307": @@ -294,69 +290,114 @@ components: default: description: Generic Error schemas: + InvocationLogs: + description: | + Represents several (more than one) invocation logs. + properties: + multipleInvocationLogs: + items: + $ref: '#/components/schemas/InvocationLog' + minItems: 1 + title: multipleInvocationLogs + type: array + supportedFeatures: + description: | + A string used to indicate the features supported by an API that is used as defined in clause 6.6 in 3GPP TS 29.500. The string shall contain a bitmask indicating supported features in hexadecimal representation Each character in the string shall take a value of "0" to "9", "a" to "f" or "A" to "F" and shall represent the support of 4 features as described in table 5.2.2-3. The most significant character representing the highest-numbered features shall appear first in the string, and the character representing features 1 to 4 shall appear last in the string. The list of features and their numbering (starting with 1) are defined separately for each API. If the string contains a lower number of characters than there are defined features for an API, all features that would be represented by characters that are not present in the string are not supported. + pattern: "^[A-Fa-f0-9]*$" + title: SupportedFeatures + type: string + required: + - multipleInvocationLogs + title: InvocationLogs + type: object + InvocationLogsRetrieveRes: + description: | + Represents the result of an invocation logs retrieval request. + oneOf: + - $ref: '#/components/schemas/InvocationLog' + - $ref: '#/components/schemas/InvocationLogs' + title: InvocationLogsRetrieveRes DateTime: description: string with format "date-time" as defined in OpenAPI. format: date-time title: DateTime type: string Protocol: - description: | - Possible values are: - - HTTP_1_1: HTTP version 1.1 - - HTTP_2: HTTP version 2 - enum: - - HTTP_1_1 - - HTTP_2 + anyOf: + - enum: + - HTTP_1_1 + - HTTP_2 + - MQTT + - WEBSOCKET + type: string + - description: | + This string provides forward-compatibility with future extensions to the enumeration but is not used to encode content defined in the present version of this API. + type: string + description: "Indicates a protocol and protocol version used by the API. \n\ + Possible values are:\n- HTTP_1_1: Indicates that the protocol is HTTP version\ + \ 1.1.\n- HTTP_2: Indicates that the protocol is HTTP version 2.\n- MQTT:\ + \ Indicates that the protocol is Message Queuing Telemetry Transport.\n- WEBSOCKET:\ + \ Indicates that the protocol is Websocket.\n" title: Protocol - type: string Operation: - description: | - Possible values are: - - GET: HTTP GET method - - POST: HTTP POST method - - PUT: HTTP PUT method - - PATCH: HTTP PATCH method - - DELETE: HTTP DELETE method - enum: - - GET - - POST - - PUT - - PATCH - - DELETE + anyOf: + - enum: + - GET + - POST + - PUT + - PATCH + - DELETE + type: string + - description: | + This string provides forward-compatibility with future extensions to the enumeration but is not used to encode content defined in the present version of this API. + type: string + description: "Indicates an HTTP method. \nPossible values are:\n- GET: HTTP\ + \ GET method.\n- POST: HTTP POST method.\n- PUT: HTTP PUT method.\n- PATCH:\ + \ HTTP PATCH method.\n- DELETE: HTTP DELETE method.\n" title: Operation - type: string InterfaceDescription: description: Represents the description of an API's interface. example: ipv6Addr: ipv6Addr securityMethods: - - null - - null + - PSK + - PSK + fqdn: fqdn port: 39500 + apiPrefix: apiPrefix ipv4Addr: ipv4Addr - oneOf: - - required: - - ipv4Addr - - required: - - ipv6Addr + nullable: true + oneOf: [] properties: ipv4Addr: - description: string identifying a Ipv4 address formatted in the "dotted - decimal" notation as defined in IETF RFC 1166. - title: ipv4Addr + description: | + string identifying a Ipv4 address formatted in the "dotted decimal" notation as defined in IETF RFC 1166. + title: Ipv4Addr type: string ipv6Addr: - description: string identifying a Ipv6 address formatted according to clause - 4 in IETF RFC 5952. The mixed Ipv4 Ipv6 notation according to clause 5 - of IETF RFC 5952 shall not be used. - title: ipv6Addr + description: | + string identifying a Ipv6 address formatted according to clause 4 in IETF RFC 5952. The mixed Ipv4 Ipv6 notation according to clause 5 of IETF RFC 5952 shall not be used. + title: Ipv6Addr + type: string + fqdn: + description: Fully Qualified Domain Name + maxLength: 253 + minLength: 4 + pattern: "^([0-9A-Za-z]([-0-9A-Za-z]{0,61}[0-9A-Za-z])?\\.)+[A-Za-z]{2,63}\\\ + .?$" + title: Fqdn type: string port: description: Unsigned integer with valid values between 0 and 65535. maximum: 65535 minimum: 0 - title: port + title: Port type: integer + apiPrefix: + description: | + A string representing a sequence of path segments that starts with the slash character. + title: apiPrefix + type: string securityMethods: description: | Security methods supported by the interface, it take precedence over the security methods provided in AefProfile, for this specific interface. @@ -368,23 +409,93 @@ components: title: InterfaceDescription type: object SecurityMethod: - description: | - Possible values are: - - PSK: Security method 1 (Using TLS-PSK) as described in 3GPP TS 33.122 - - PKI: Security method 2 (Using PKI) as described in 3GPP TS 33.122 - - OAUTH: Security method 3 (TLS with OAuth token) as described in 3GPP TS 33.122 - enum: - - PSK - - PKI - - OAUTH + anyOf: + - enum: + - PSK + - PKI + - OAUTH + type: string + - description: | + This string provides forward-compatibility with future extensions to the enumeration but is not used to encode content defined in the present version of this API. + type: string + description: "Indicates the security method. \nPossible values are:\n- PSK:\ + \ Security method 1 (Using TLS-PSK) as described in 3GPP TS 33.122.\n- PKI:\ + \ Security method 2 (Using PKI) as described in 3GPP TS 33.122.\n- OAUTH:\ + \ Security method 3 (TLS with OAuth token) as described in 3GPP TS 33.122.\n" title: SecurityMethod - type: string SupportedFeatures: description: | A string used to indicate the features supported by an API that is used as defined in clause 6.6 in 3GPP TS 29.500. The string shall contain a bitmask indicating supported features in hexadecimal representation Each character in the string shall take a value of "0" to "9", "a" to "f" or "A" to "F" and shall represent the support of 4 features as described in table 5.2.2-3. The most significant character representing the highest-numbered features shall appear first in the string, and the character representing features 1 to 4 shall appear last in the string. The list of features and their numbering (starting with 1) are defined separately for each API. If the string contains a lower number of characters than there are defined features for an API, all features that would be represented by characters that are not present in the string are not supported. pattern: "^[A-Fa-f0-9]*$" - title: supportedFeatures + title: SupportedFeatures type: string + ProblemDetails: + description: Represents additional information and details on an error response. + properties: + type: + description: string providing an URI formatted according to IETF RFC 3986. + title: Uri + type: string + title: + description: "A short, human-readable summary of the problem type. It should\ + \ not change from occurrence to occurrence of the problem. \n" + title: title + type: string + status: + description: The HTTP status code for this occurrence of the problem. + title: status + type: integer + detail: + description: A human-readable explanation specific to this occurrence of + the problem. + title: detail + type: string + instance: + description: string providing an URI formatted according to IETF RFC 3986. + title: Uri + type: string + cause: + description: | + A machine-readable application error cause specific to this occurrence of the problem. This IE should be present and provide application-related error information, if available. + title: cause + type: string + invalidParams: + description: | + Description of invalid parameters, for a request rejected due to invalid parameters. + items: + $ref: '#/components/schemas/InvalidParam' + minItems: 1 + title: invalidParams + type: array + supportedFeatures: + description: | + A string used to indicate the features supported by an API that is used as defined in clause 6.6 in 3GPP TS 29.500. The string shall contain a bitmask indicating supported features in hexadecimal representation Each character in the string shall take a value of "0" to "9", "a" to "f" or "A" to "F" and shall represent the support of 4 features as described in table 5.2.2-3. The most significant character representing the highest-numbered features shall appear first in the string, and the character representing features 1 to 4 shall appear last in the string. The list of features and their numbering (starting with 1) are defined separately for each API. If the string contains a lower number of characters than there are defined features for an API, all features that would be represented by characters that are not present in the string are not supported. + pattern: "^[A-Fa-f0-9]*$" + title: SupportedFeatures + type: string + title: ProblemDetails + type: object + Uri: + description: string providing an URI formatted according to IETF RFC 3986. + title: Uri + type: string + InvalidParam: + description: | + Represents the description of invalid parameters, for a request rejected due to invalid parameters. + properties: + param: + description: "Attribute's name encoded as a JSON Pointer, or header's name." + title: param + type: string + reason: + description: "A human-readable reason, e.g. \"must be a positive integer\"\ + ." + title: reason + type: string + required: + - param + title: InvalidParam + type: object InvocationLog: description: | Represents a set of Service API invocation logs to be stored in a CAPIF core function. @@ -398,9 +509,11 @@ components: srcInterface: ipv6Addr: ipv6Addr securityMethods: - - null - - null + - PSK + - PSK + fqdn: fqdn port: 39500 + apiPrefix: apiPrefix ipv4Addr: ipv4Addr fwdInterface: fwdInterface resourceName: resourceName @@ -408,16 +521,18 @@ components: inputParameters: "" invocationLatency: 0 result: result - protocol: null + protocol: HTTP_1_1 apiVersion: apiVersion destInterface: ipv6Addr: ipv6Addr securityMethods: - - null - - null + - PSK + - PSK + fqdn: fqdn port: 39500 + apiPrefix: apiPrefix ipv4Addr: ipv4Addr - operation: null + operation: GET apiId: apiId outputParameters: "" - apiName: apiName @@ -425,9 +540,11 @@ components: srcInterface: ipv6Addr: ipv6Addr securityMethods: - - null - - null + - PSK + - PSK + fqdn: fqdn port: 39500 + apiPrefix: apiPrefix ipv4Addr: ipv4Addr fwdInterface: fwdInterface resourceName: resourceName @@ -435,16 +552,18 @@ components: inputParameters: "" invocationLatency: 0 result: result - protocol: null + protocol: HTTP_1_1 apiVersion: apiVersion destInterface: ipv6Addr: ipv6Addr securityMethods: - - null - - null + - PSK + - PSK + fqdn: fqdn port: 39500 + apiPrefix: apiPrefix ipv4Addr: ipv4Addr - operation: null + operation: GET apiId: apiId outputParameters: "" properties: @@ -468,7 +587,7 @@ components: description: | A string used to indicate the features supported by an API that is used as defined in clause 6.6 in 3GPP TS 29.500. The string shall contain a bitmask indicating supported features in hexadecimal representation Each character in the string shall take a value of "0" to "9", "a" to "f" or "A" to "F" and shall represent the support of 4 features as described in table 5.2.2-3. The most significant character representing the highest-numbered features shall appear first in the string, and the character representing features 1 to 4 shall appear last in the string. The list of features and their numbering (starting with 1) are defined separately for each API. If the string contains a lower number of characters than there are defined features for an API, all features that would be represented by characters that are not present in the string are not supported. pattern: "^[A-Fa-f0-9]*$" - title: supportedFeatures + title: SupportedFeatures type: string required: - aefId @@ -484,9 +603,11 @@ components: srcInterface: ipv6Addr: ipv6Addr securityMethods: - - null - - null + - PSK + - PSK + fqdn: fqdn port: 39500 + apiPrefix: apiPrefix ipv4Addr: ipv4Addr fwdInterface: fwdInterface resourceName: resourceName @@ -494,16 +615,18 @@ components: inputParameters: "" invocationLatency: 0 result: result - protocol: null + protocol: HTTP_1_1 apiVersion: apiVersion destInterface: ipv6Addr: ipv6Addr securityMethods: - - null - - null + - PSK + - PSK + fqdn: fqdn port: 39500 + apiPrefix: apiPrefix ipv4Addr: ipv4Addr - operation: null + operation: GET apiId: apiId outputParameters: "" properties: @@ -542,7 +665,7 @@ components: title: DateTime type: string invocationLatency: - description: Unsigned integer identifying a period of time in units of milliseconds. + description: Represents a period of time in units of milliseconds. minimum: 0 title: DurationMs type: integer @@ -573,92 +696,31 @@ components: title: Log type: object DurationMs: - description: Unsigned integer identifying a period of time in units of milliseconds. + description: Represents a period of time in units of milliseconds. minimum: 0 title: DurationMs type: integer - ProblemDetails: - description: Represents additional information and details on an error response. - properties: - type: - description: string providing an URI formatted according to IETF RFC 3986. - title: Uri - type: string - title: - description: "A short, human-readable summary of the problem type. It should\ - \ not change from occurrence to occurrence of the problem." - title: title - type: string - status: - description: The HTTP status code for this occurrence of the problem. - title: status - type: integer - detail: - description: A human-readable explanation specific to this occurrence of - the problem. - title: detail - type: string - instance: - description: string providing an URI formatted according to IETF RFC 3986. - title: Uri - type: string - cause: - description: "A machine-readable application error cause specific to this\ - \ occurrence of the problem. This IE should be present and provide application-related\ - \ error information, if available." - title: cause - type: string - invalidParams: - description: "Description of invalid parameters, for a request rejected\ - \ due to invalid parameters." - items: - $ref: '#/components/schemas/InvalidParam' - minItems: 1 - title: invalidParams - type: array - supportedFeatures: - description: | - A string used to indicate the features supported by an API that is used as defined in clause 6.6 in 3GPP TS 29.500. The string shall contain a bitmask indicating supported features in hexadecimal representation Each character in the string shall take a value of "0" to "9", "a" to "f" or "A" to "F" and shall represent the support of 4 features as described in table 5.2.2-3. The most significant character representing the highest-numbered features shall appear first in the string, and the character representing features 1 to 4 shall appear last in the string. The list of features and their numbering (starting with 1) are defined separately for each API. If the string contains a lower number of characters than there are defined features for an API, all features that would be represented by characters that are not present in the string are not supported. - pattern: "^[A-Fa-f0-9]*$" - title: supportedFeatures - type: string - title: ProblemDetails - type: object - Uri: - description: string providing an URI formatted according to IETF RFC 3986. - title: Uri - type: string - InvalidParam: - description: "Represents the description of invalid parameters, for a request\ - \ rejected due to invalid parameters." - properties: - param: - description: "Attribute's name encoded as a JSON Pointer, or header's name." - title: param - type: string - reason: - description: "A human-readable reason, e.g. \"must be a positive integer\"\ - ." - title: reason - type: string - required: - - param - title: InvalidParam - type: object Ipv4Addr: - description: string identifying a Ipv4 address formatted in the "dotted decimal" - notation as defined in IETF RFC 1166. - title: ipv4Addr + description: | + string identifying a Ipv4 address formatted in the "dotted decimal" notation as defined in IETF RFC 1166. + title: Ipv4Addr type: string Ipv6Addr: - description: string identifying a Ipv6 address formatted according to clause - 4 in IETF RFC 5952. The mixed Ipv4 Ipv6 notation according to clause 5 of - IETF RFC 5952 shall not be used. - title: ipv6Addr + description: | + string identifying a Ipv6 address formatted according to clause 4 in IETF RFC 5952. The mixed Ipv4 Ipv6 notation according to clause 5 of IETF RFC 5952 shall not be used. + title: Ipv6Addr + type: string + Fqdn: + description: Fully Qualified Domain Name + maxLength: 253 + minLength: 4 + pattern: "^([0-9A-Za-z]([-0-9A-Za-z]{0,61}[0-9A-Za-z])?\\.)+[A-Za-z]{2,63}\\\ + .?$" + title: Fqdn type: string Port: description: Unsigned integer with valid values between 0 and 65535. maximum: 65535 minimum: 0 - title: port + title: Port type: integer diff --git a/services/TS29222_CAPIF_Auditing_API/logs/test/__init__.py b/services/TS29222_CAPIF_Auditing_API/logs/test/__init__.py new file mode 100644 index 0000000..a3e8ced --- /dev/null +++ b/services/TS29222_CAPIF_Auditing_API/logs/test/__init__.py @@ -0,0 +1,16 @@ +import logging + +import connexion +from flask_testing import TestCase + +from logs.encoder import JSONEncoder + + +class BaseTestCase(TestCase): + + def create_app(self): + logging.getLogger('connexion.operation').setLevel('ERROR') + app = connexion.App(__name__, specification_dir='../openapi/') + app.app.json_encoder = JSONEncoder + app.add_api('openapi.yaml', pythonic_params=True) + return app.app diff --git a/services/TS29222_CAPIF_Auditing_API/logs/test/test_default_controller.py b/services/TS29222_CAPIF_Auditing_API/logs/test/test_default_controller.py new file mode 100644 index 0000000..edeb621 --- /dev/null +++ b/services/TS29222_CAPIF_Auditing_API/logs/test/test_default_controller.py @@ -0,0 +1,48 @@ +import unittest + +from flask import json + +from logs.models.interface_description import InterfaceDescription # noqa: E501 +from logs.models.invocation_logs_retrieve_res import InvocationLogsRetrieveRes # noqa: E501 +from logs.models.operation import Operation # noqa: E501 +from logs.models.problem_details import ProblemDetails # noqa: E501 +from logs.models.protocol import Protocol # noqa: E501 +from logs.test import BaseTestCase + + +class TestDefaultController(BaseTestCase): + """DefaultController integration test stubs""" + + def test_api_invocation_logs_get(self): + """Test case for api_invocation_logs_get + + + """ + query_string = [('aef-id', 'aef_id_example'), + ('api-invoker-id', 'api_invoker_id_example'), + ('time-range-start', '2013-10-20T19:20:30+01:00'), + ('time-range-end', '2013-10-20T19:20:30+01:00'), + ('api-id', 'api_id_example'), + ('api-name', 'api_name_example'), + ('api-version', 'api_version_example'), + ('protocol', openapi_server.Protocol()), + ('operation', openapi_server.Operation()), + ('result', 'result_example'), + ('resource-name', 'resource_name_example'), + ('src-interface', openapi_server.InterfaceDescription()), + ('dest-interface', openapi_server.InterfaceDescription()), + ('supported-features', 'supported_features_example')] + headers = { + 'Accept': 'application/json', + } + response = self.client.open( + '/logs/v1/apiInvocationLogs', + method='GET', + headers=headers, + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + +if __name__ == '__main__': + unittest.main() diff --git a/services/TS29222_CAPIF_Auditing_API/logs/typing_utils.py b/services/TS29222_CAPIF_Auditing_API/logs/typing_utils.py index 0563f81..74e3c91 100644 --- a/services/TS29222_CAPIF_Auditing_API/logs/typing_utils.py +++ b/services/TS29222_CAPIF_Auditing_API/logs/typing_utils.py @@ -1,5 +1,3 @@ -# coding: utf-8 - import sys if sys.version_info < (3, 7): diff --git a/services/TS29222_CAPIF_Auditing_API/logs/util.py b/services/TS29222_CAPIF_Auditing_API/logs/util.py index d5deea1..16287a2 100644 --- a/services/TS29222_CAPIF_Auditing_API/logs/util.py +++ b/services/TS29222_CAPIF_Auditing_API/logs/util.py @@ -1,8 +1,7 @@ import datetime -import six -import typing_utils - +import typing +from logs import typing_utils def serialize_clean_camel_case(obj): res = obj.to_dict() @@ -54,7 +53,6 @@ def dict_to_camel_case(my_dict): return result - def _deserialize(data, klass): """Deserializes dict, list, str into an object. @@ -66,7 +64,7 @@ def _deserialize(data, klass): if data is None: return None - if klass in six.integer_types or klass in (float, str, bool, bytearray): + if klass in (int, float, str, bool, bytearray): return _deserialize_primitive(data, klass) elif klass == object: return _deserialize_object(data) @@ -95,7 +93,7 @@ def _deserialize_primitive(data, klass): try: value = klass(data) except UnicodeEncodeError: - value = six.u(data) + value = data except TypeError: value = data return value @@ -160,7 +158,7 @@ def deserialize_model(data, klass): if not instance.openapi_types: return data - for attr, attr_type in six.iteritems(instance.openapi_types): + for attr, attr_type in instance.openapi_types.items(): if data is not None \ and instance.attribute_map[attr] in data \ and isinstance(data, (list, dict)): @@ -195,4 +193,4 @@ def _deserialize_dict(data, boxed_type): :rtype: dict """ return {k: _deserialize(v, boxed_type) - for k, v in six.iteritems(data)} + for k, v in data.items() } diff --git a/services/TS29222_CAPIF_Auditing_API/setup.py b/services/TS29222_CAPIF_Auditing_API/setup.py index 6577878..fe867a5 100644 --- a/services/TS29222_CAPIF_Auditing_API/setup.py +++ b/services/TS29222_CAPIF_Auditing_API/setup.py @@ -1,5 +1,3 @@ -# coding: utf-8 - import sys from setuptools import setup, find_packages @@ -33,7 +31,7 @@ setup( entry_points={ 'console_scripts': ['logs=logs.__main__:main']}, long_description="""\ - API for auditing. © 2021, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. + API for auditing. © 2023, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. """ ) diff --git a/services/TS29222_CAPIF_Auditing_API/test-requirements.txt b/services/TS29222_CAPIF_Auditing_API/test-requirements.txt index 202a684..58f51d6 100644 --- a/services/TS29222_CAPIF_Auditing_API/test-requirements.txt +++ b/services/TS29222_CAPIF_Auditing_API/test-requirements.txt @@ -1,4 +1,4 @@ -pytest~=4.6.7 # needed for python 2.7+3.4 +pytest~=7.1.0 pytest-cov>=2.8.1 -pytest-randomly == 1.2.3 # needed for python 2.7+3.4 -Flask-Testing == 0.8.0 +pytest-randomly>=1.2.3 +Flask-Testing==0.8.1 diff --git a/services/TS29222_CAPIF_Auditing_API/tox.ini b/services/TS29222_CAPIF_Auditing_API/tox.ini index 865c849..1afa603 100644 --- a/services/TS29222_CAPIF_Auditing_API/tox.ini +++ b/services/TS29222_CAPIF_Auditing_API/tox.ini @@ -5,7 +5,7 @@ skipsdist=True [testenv] deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt - {toxinidir} + {toxinidir} commands= pytest --cov=logs -- GitLab