From 83231d302692179681195614b8710d5bc144cdd4 Mon Sep 17 00:00:00 2001 From: Pelayo Torres Date: Mon, 22 Jul 2024 09:47:37 +0200 Subject: [PATCH] REL18 ACL service --- .../.openapi-generator/FILES | 37 +++++++------- .../.openapi-generator/VERSION | 2 +- .../README.md | 4 +- .../controllers/default_controller.py | 10 +++- ..._controller_.py => security_controller.py} | 0 .../capif_acl/encoder.py | 5 +- .../capif_acl/models/__init__.py | 3 -- .../models/access_control_policy_list.py | 9 ++-- .../capif_acl/models/api_invoker_policy.py | 21 ++++---- .../models/{base_model_.py => base_model.py} | 5 +- .../capif_acl/models/invalid_param.py | 13 ++--- .../capif_acl/models/problem_details.py | 49 +++++++++---------- .../capif_acl/models/time_range_list.py | 13 ++--- .../capif_acl/openapi/openapi.yaml | 15 +++--- .../capif_acl/test/test_default_controller.py | 9 ++-- .../capif_acl/typing_utils.py | 2 - .../capif_acl/util.py | 14 +++--- .../setup.py | 6 +-- .../test-requirements.txt | 2 +- .../tox.ini | 4 +- 20 files changed, 103 insertions(+), 120 deletions(-) rename services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/controllers/{security_controller_.py => security_controller.py} (100%) rename services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/{base_model_.py => base_model.py} (95%) diff --git a/services/TS29222_CAPIF_Access_Control_Policy_API/.openapi-generator/FILES b/services/TS29222_CAPIF_Access_Control_Policy_API/.openapi-generator/FILES index 9024036..eeda92f 100644 --- a/services/TS29222_CAPIF_Access_Control_Policy_API/.openapi-generator/FILES +++ b/services/TS29222_CAPIF_Access_Control_Policy_API/.openapi-generator/FILES @@ -1,27 +1,28 @@ .dockerignore .gitignore +.openapi-generator-ignore .travis.yml Dockerfile README.md git_push.sh -openapi_server/__init__.py -openapi_server/__main__.py -openapi_server/controllers/__init__.py -openapi_server/controllers/default_controller.py -openapi_server/controllers/security_controller_.py -openapi_server/encoder.py -openapi_server/models/__init__.py -openapi_server/models/access_control_policy_list.py -openapi_server/models/api_invoker_policy.py -openapi_server/models/base_model_.py -openapi_server/models/invalid_param.py -openapi_server/models/problem_details.py -openapi_server/models/time_range_list.py -openapi_server/openapi/openapi.yaml -openapi_server/test/__init__.py -openapi_server/test/test_default_controller.py -openapi_server/typing_utils.py -openapi_server/util.py +capif_acl/__init__.py +capif_acl/__main__.py +capif_acl/controllers/__init__.py +capif_acl/controllers/default_controller.py +capif_acl/controllers/security_controller.py +capif_acl/encoder.py +capif_acl/models/__init__.py +capif_acl/models/access_control_policy_list.py +capif_acl/models/api_invoker_policy.py +capif_acl/models/base_model.py +capif_acl/models/invalid_param.py +capif_acl/models/problem_details.py +capif_acl/models/time_range_list.py +capif_acl/openapi/openapi.yaml +capif_acl/test/__init__.py +capif_acl/test/test_default_controller.py +capif_acl/typing_utils.py +capif_acl/util.py requirements.txt setup.py test-requirements.txt diff --git a/services/TS29222_CAPIF_Access_Control_Policy_API/.openapi-generator/VERSION b/services/TS29222_CAPIF_Access_Control_Policy_API/.openapi-generator/VERSION index 4be2c72..18bb418 100644 --- a/services/TS29222_CAPIF_Access_Control_Policy_API/.openapi-generator/VERSION +++ b/services/TS29222_CAPIF_Access_Control_Policy_API/.openapi-generator/VERSION @@ -1 +1 @@ -6.5.0 \ No newline at end of file +7.5.0 diff --git a/services/TS29222_CAPIF_Access_Control_Policy_API/README.md b/services/TS29222_CAPIF_Access_Control_Policy_API/README.md index 40feae4..1222b0a 100644 --- a/services/TS29222_CAPIF_Access_Control_Policy_API/README.md +++ b/services/TS29222_CAPIF_Access_Control_Policy_API/README.md @@ -42,8 +42,8 @@ To run the server on a Docker container, please execute the following from the r ```bash # building the image -docker build -t openapi_server . +docker build -t capif_acl . # starting up a container -docker run -p 8080:8080 openapi_server +docker run -p 8080:8080 capif_acl ``` \ No newline at end of file diff --git a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/controllers/default_controller.py b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/controllers/default_controller.py index 52174b1..bb5a8ee 100644 --- a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/controllers/default_controller.py +++ b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/controllers/default_controller.py @@ -1,3 +1,11 @@ +import connexion +from typing import Dict +from typing import Tuple +from typing import Union + +from capif_acl.models.access_control_policy_list import AccessControlPolicyList # noqa: E501 +from capif_acl.models.problem_details import ProblemDetails # noqa: E501 +from capif_acl import util from functools import wraps from flask import request, current_app @@ -6,7 +14,6 @@ from cryptography.hazmat.backends import default_backend from ..core.accesscontrolpolicyapi import accessControlPolicyApi - def cert_validation(): def _cert_validation(f): @wraps(f) @@ -24,7 +31,6 @@ def cert_validation(): return __cert_validation return _cert_validation - @cert_validation() def access_control_policy_list_service_api_id_get(service_api_id, aef_id, api_invoker_id=None, supported_features=None): # noqa: E501 """access_control_policy_list_service_api_id_get diff --git a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/controllers/security_controller_.py b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/controllers/security_controller.py similarity index 100% rename from services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/controllers/security_controller_.py rename to services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/controllers/security_controller.py diff --git a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/encoder.py b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/encoder.py index 80bad8f..c0b0f8e 100644 --- a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/encoder.py +++ b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/encoder.py @@ -1,7 +1,6 @@ from connexion.apps.flask_app import FlaskJSONEncoder -import six -from models.base_model_ import Model +from capif_acl.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_Access_Control_Policy_API/capif_acl/models/__init__.py b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/__init__.py index 4c4e60f..43aa015 100644 --- a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/__init__.py +++ b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/__init__.py @@ -1,7 +1,4 @@ -# coding: utf-8 - # flake8: noqa -from __future__ import absolute_import # import models into model package from capif_acl.models.access_control_policy_list import AccessControlPolicyList from capif_acl.models.api_invoker_policy import ApiInvokerPolicy diff --git a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/access_control_policy_list.py b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/access_control_policy_list.py index b3cacd4..a851ac3 100644 --- a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/access_control_policy_list.py +++ b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/access_control_policy_list.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 capif_acl.models.base_model_ import Model +from capif_acl.models.base_model import Model from capif_acl.models.api_invoker_policy import ApiInvokerPolicy from capif_acl import util @@ -45,7 +42,7 @@ class AccessControlPolicyList(Model): return util.deserialize_model(dikt, cls) @property - def api_invoker_policies(self): + def api_invoker_policies(self) -> List[ApiInvokerPolicy]: """Gets the api_invoker_policies of this AccessControlPolicyList. Policy of each API invoker. # noqa: E501 @@ -56,7 +53,7 @@ class AccessControlPolicyList(Model): return self._api_invoker_policies @api_invoker_policies.setter - def api_invoker_policies(self, api_invoker_policies): + def api_invoker_policies(self, api_invoker_policies: List[ApiInvokerPolicy]): """Sets the api_invoker_policies of this AccessControlPolicyList. Policy of each API invoker. # noqa: E501 diff --git a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/api_invoker_policy.py b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/api_invoker_policy.py index 86ffec0..a22e84c 100644 --- a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/api_invoker_policy.py +++ b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/api_invoker_policy.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 capif_acl.models.base_model_ import Model +from capif_acl.models.base_model import Model from capif_acl.models.time_range_list import TimeRangeList from capif_acl import util @@ -60,7 +57,7 @@ class ApiInvokerPolicy(Model): return util.deserialize_model(dikt, cls) @property - def api_invoker_id(self): + def api_invoker_id(self) -> str: """Gets the api_invoker_id of this ApiInvokerPolicy. API invoker ID assigned by the CAPIF core function # noqa: E501 @@ -71,7 +68,7 @@ class ApiInvokerPolicy(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 ApiInvokerPolicy. API invoker ID assigned by the CAPIF core function # noqa: E501 @@ -85,7 +82,7 @@ class ApiInvokerPolicy(Model): self._api_invoker_id = api_invoker_id @property - def allowed_total_invocations(self): + def allowed_total_invocations(self) -> int: """Gets the allowed_total_invocations of this ApiInvokerPolicy. Total number of invocations allowed on the service API by the API invoker. # noqa: E501 @@ -96,7 +93,7 @@ class ApiInvokerPolicy(Model): return self._allowed_total_invocations @allowed_total_invocations.setter - def allowed_total_invocations(self, allowed_total_invocations): + def allowed_total_invocations(self, allowed_total_invocations: int): """Sets the allowed_total_invocations of this ApiInvokerPolicy. Total number of invocations allowed on the service API by the API invoker. # noqa: E501 @@ -108,7 +105,7 @@ class ApiInvokerPolicy(Model): self._allowed_total_invocations = allowed_total_invocations @property - def allowed_invocations_per_second(self): + def allowed_invocations_per_second(self) -> int: """Gets the allowed_invocations_per_second of this ApiInvokerPolicy. Invocations per second allowed on the service API by the API invoker. # noqa: E501 @@ -119,7 +116,7 @@ class ApiInvokerPolicy(Model): return self._allowed_invocations_per_second @allowed_invocations_per_second.setter - def allowed_invocations_per_second(self, allowed_invocations_per_second): + def allowed_invocations_per_second(self, allowed_invocations_per_second: int): """Sets the allowed_invocations_per_second of this ApiInvokerPolicy. Invocations per second allowed on the service API by the API invoker. # noqa: E501 @@ -131,7 +128,7 @@ class ApiInvokerPolicy(Model): self._allowed_invocations_per_second = allowed_invocations_per_second @property - def allowed_invocation_time_range_list(self): + def allowed_invocation_time_range_list(self) -> List[TimeRangeList]: """Gets the allowed_invocation_time_range_list of this ApiInvokerPolicy. The time ranges during which the invocations are allowed on the service API by the API invoker. # noqa: E501 @@ -142,7 +139,7 @@ class ApiInvokerPolicy(Model): return self._allowed_invocation_time_range_list @allowed_invocation_time_range_list.setter - def allowed_invocation_time_range_list(self, allowed_invocation_time_range_list): + def allowed_invocation_time_range_list(self, allowed_invocation_time_range_list: List[TimeRangeList]): """Sets the allowed_invocation_time_range_list of this ApiInvokerPolicy. The time ranges during which the invocations are allowed on the service API by the API invoker. # noqa: E501 diff --git a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/base_model_.py b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/base_model.py similarity index 95% rename from services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/base_model_.py rename to services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/base_model.py index cce5379..fed13c9 100644 --- a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/base_model_.py +++ b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/base_model.py @@ -1,6 +1,5 @@ import pprint -import six import typing from capif_acl import util @@ -8,7 +7,7 @@ from capif_acl 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: typing.Dict[str, type] = {} @@ -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_Access_Control_Policy_API/capif_acl/models/invalid_param.py b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/invalid_param.py index 88606c4..a6789dc 100644 --- a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/invalid_param.py +++ b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/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 capif_acl.models.base_model_ import Model +from capif_acl.models.base_model import Model from capif_acl 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_Access_Control_Policy_API/capif_acl/models/problem_details.py b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/problem_details.py index 25caab4..ec494ca 100644 --- a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/problem_details.py +++ b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/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 capif_acl.models.base_model_ import Model +from capif_acl.models.base_model import Model from capif_acl.models.invalid_param import InvalidParam import re from capif_acl 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,7 +242,7 @@ 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 @@ -256,7 +253,7 @@ 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 diff --git a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/time_range_list.py b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/time_range_list.py index eaacad6..b9c4724 100644 --- a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/time_range_list.py +++ b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/models/time_range_list.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 capif_acl.models.base_model_ import Model +from capif_acl.models.base_model import Model from capif_acl import util @@ -48,7 +45,7 @@ class TimeRangeList(Model): return util.deserialize_model(dikt, cls) @property - def start_time(self): + def start_time(self) -> datetime: """Gets the start_time of this TimeRangeList. string with format \"date-time\" as defined in OpenAPI. # noqa: E501 @@ -59,7 +56,7 @@ class TimeRangeList(Model): return self._start_time @start_time.setter - def start_time(self, start_time): + def start_time(self, start_time: datetime): """Sets the start_time of this TimeRangeList. string with format \"date-time\" as defined in OpenAPI. # noqa: E501 @@ -71,7 +68,7 @@ class TimeRangeList(Model): self._start_time = start_time @property - def stop_time(self): + def stop_time(self) -> datetime: """Gets the stop_time of this TimeRangeList. string with format \"date-time\" as defined in OpenAPI. # noqa: E501 @@ -82,7 +79,7 @@ class TimeRangeList(Model): return self._stop_time @stop_time.setter - def stop_time(self, stop_time): + def stop_time(self, stop_time: datetime): """Sets the stop_time of this TimeRangeList. string with format \"date-time\" as defined in OpenAPI. # noqa: E501 diff --git a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/openapi/openapi.yaml b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/openapi/openapi.yaml index 1621baa..1646931 100644 --- a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/openapi/openapi.yaml +++ b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/openapi/openapi.yaml @@ -309,7 +309,7 @@ components: type: string title: description: "A short, human-readable summary of the problem type. It should\ - \ not change from occurrence to occurrence of the problem." + \ not change from occurrence to occurrence of the problem. \n" title: title type: string status: @@ -326,14 +326,13 @@ components: title: type 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." + 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." + description: | + Description of invalid parameters, for a request rejected due to invalid parameters. items: $ref: '#/components/schemas/InvalidParam' minItems: 1 @@ -352,8 +351,8 @@ components: title: type type: string InvalidParam: - description: "Represents the description of invalid parameters, for a request\ - \ rejected due to invalid parameters." + 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." diff --git a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/test/test_default_controller.py b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/test/test_default_controller.py index 44ed0be..d2f9a54 100644 --- a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/test/test_default_controller.py +++ b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/test/test_default_controller.py @@ -1,9 +1,10 @@ -# coding: utf-8 - -from __future__ import absolute_import import unittest -from test import BaseTestCase +from flask import json + +from capif_acl.models.access_control_policy_list import AccessControlPolicyList # noqa: E501 +from capif_acl.models.problem_details import ProblemDetails # noqa: E501 +from capif_acl.test import BaseTestCase class TestDefaultController(BaseTestCase): diff --git a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/typing_utils.py b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/typing_utils.py index 0563f81..74e3c91 100644 --- a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/typing_utils.py +++ b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/typing_utils.py @@ -1,5 +1,3 @@ -# coding: utf-8 - import sys if sys.version_info < (3, 7): diff --git a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/util.py b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/util.py index 72d18d9..110348b 100644 --- a/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/util.py +++ b/services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/util.py @@ -1,8 +1,7 @@ import datetime -import six -import typing_utils - +import typing +from capif_acl import typing_utils def serialize_clean_camel_case(obj): res = obj.to_dict() @@ -53,6 +52,7 @@ def dict_to_camel_case(my_dict): return result + def _deserialize(data, klass): """Deserializes dict, list, str into an object. @@ -64,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) @@ -93,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 @@ -158,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)): @@ -193,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_Access_Control_Policy_API/setup.py b/services/TS29222_CAPIF_Access_Control_Policy_API/setup.py index 275b7b6..78262fd 100644 --- a/services/TS29222_CAPIF_Access_Control_Policy_API/setup.py +++ b/services/TS29222_CAPIF_Access_Control_Policy_API/setup.py @@ -1,9 +1,7 @@ -# coding: utf-8 - import sys from setuptools import setup, find_packages -NAME = "openapi_server" +NAME = "capif_acl" VERSION = "1.0.0" # To install the library, run the following @@ -31,7 +29,7 @@ setup( package_data={'': ['openapi/openapi.yaml']}, include_package_data=True, entry_points={ - 'console_scripts': ['openapi_server=openapi_server.__main__:main']}, + 'console_scripts': ['capif_acl=capif_acl.__main__:main']}, long_description="""\ API for access control policy. © 2022, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. """ diff --git a/services/TS29222_CAPIF_Access_Control_Policy_API/test-requirements.txt b/services/TS29222_CAPIF_Access_Control_Policy_API/test-requirements.txt index 422ece8..58f51d6 100644 --- a/services/TS29222_CAPIF_Access_Control_Policy_API/test-requirements.txt +++ b/services/TS29222_CAPIF_Access_Control_Policy_API/test-requirements.txt @@ -1,4 +1,4 @@ pytest~=7.1.0 pytest-cov>=2.8.1 pytest-randomly>=1.2.3 -Flask-Testing == 0.8.1 +Flask-Testing==0.8.1 diff --git a/services/TS29222_CAPIF_Access_Control_Policy_API/tox.ini b/services/TS29222_CAPIF_Access_Control_Policy_API/tox.ini index f66b2d8..539b51b 100644 --- a/services/TS29222_CAPIF_Access_Control_Policy_API/tox.ini +++ b/services/TS29222_CAPIF_Access_Control_Policy_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=openapi_server + pytest --cov=capif_acl -- GitLab