From 0a0b8ffe1780c6e0d2bff71a84727d74887a230d Mon Sep 17 00:00:00 2001 From: Pelayo Torres Date: Thu, 18 Jul 2024 11:10:51 +0200 Subject: [PATCH] REL18 api provider management --- .../.openapi-generator/FILES | 12 +- .../.openapi-generator/VERSION | 2 +- .../README.md | 2 +- .../controllers/default_controller.py | 19 +- ...i_provider_enrolment_details_controller.py | 12 +- ..._controller_.py => security_controller.py} | 0 .../api_provider_management/encoder.py | 6 +- .../models/__init__.py | 4 - .../models/api_provider_enrolment_details.py | 63 +++++-- .../api_provider_enrolment_details_patch.py | 13 +- .../models/api_provider_func_role.py | 7 +- .../models/api_provider_func_role_any_of.py | 43 ----- .../models/api_provider_function_details.py | 21 +-- .../models/{base_model_.py => base_model.py} | 9 +- .../models/invalid_param.py | 13 +- .../models/problem_details.py | 49 +++-- .../models/registration_information.py | 13 +- .../openapi/openapi.yaml | 171 +++++++++++++----- .../api_provider_management/test/__init__.py | 16 ++ .../test/test_default_controller.py | 68 +++++++ ...i_provider_enrolment_details_controller.py | 35 ++++ .../api_provider_management/typing_utils.py | 2 - .../api_provider_management/util.py | 13 +- .../api_provider_management/wsgi copy.py | 4 + .../git_push.sh | 6 +- .../setup.py | 4 +- .../test-requirements.txt | 6 +- .../tox.ini | 2 +- 28 files changed, 388 insertions(+), 227 deletions(-) rename services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/controllers/{security_controller_.py => security_controller.py} (100%) delete mode 100644 services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_func_role_any_of.py rename services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/{base_model_.py => base_model.py} (92%) create mode 100644 services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/test/__init__.py create mode 100644 services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/test/test_default_controller.py create mode 100644 services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/test/test_individual_api_provider_enrolment_details_controller.py create mode 100644 services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/wsgi copy.py diff --git a/services/TS29222_CAPIF_API_Provider_Management_API/.openapi-generator/FILES b/services/TS29222_CAPIF_API_Provider_Management_API/.openapi-generator/FILES index 4baa18d..3ffb37b 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/.openapi-generator/FILES +++ b/services/TS29222_CAPIF_API_Provider_Management_API/.openapi-generator/FILES @@ -1,28 +1,32 @@ .dockerignore .gitignore +.openapi-generator-ignore .travis.yml Dockerfile README.md +git_push.sh api_provider_management/__init__.py api_provider_management/__main__.py api_provider_management/controllers/__init__.py api_provider_management/controllers/default_controller.py -api_provider_management/controllers/security_controller_.py +api_provider_management/controllers/individual_api_provider_enrolment_details_controller.py +api_provider_management/controllers/security_controller.py api_provider_management/encoder.py api_provider_management/models/__init__.py api_provider_management/models/api_provider_enrolment_details.py +api_provider_management/models/api_provider_enrolment_details_patch.py api_provider_management/models/api_provider_func_role.py -api_provider_management/models/api_provider_func_role_any_of.py api_provider_management/models/api_provider_function_details.py -api_provider_management/models/base_model_.py +api_provider_management/models/base_model.py api_provider_management/models/invalid_param.py api_provider_management/models/problem_details.py api_provider_management/models/registration_information.py api_provider_management/openapi/openapi.yaml api_provider_management/test/__init__.py +api_provider_management/test/test_default_controller.py +api_provider_management/test/test_individual_api_provider_enrolment_details_controller.py api_provider_management/typing_utils.py api_provider_management/util.py -git_push.sh requirements.txt setup.py test-requirements.txt diff --git a/services/TS29222_CAPIF_API_Provider_Management_API/.openapi-generator/VERSION b/services/TS29222_CAPIF_API_Provider_Management_API/.openapi-generator/VERSION index 4b448de..18bb418 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/.openapi-generator/VERSION +++ b/services/TS29222_CAPIF_API_Provider_Management_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_API_Provider_Management_API/README.md b/services/TS29222_CAPIF_API_Provider_Management_API/README.md index c9acf91..3aa91ec 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/README.md +++ b/services/TS29222_CAPIF_API_Provider_Management_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 api_provider_management +python3 -m openapi_server ``` and open your browser to here: diff --git a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/controllers/default_controller.py b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/controllers/default_controller.py index d9a190c..64aed15 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/controllers/default_controller.py +++ b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/controllers/default_controller.py @@ -2,9 +2,10 @@ import connexion from flask import Response, request, current_app from ..core.provider_enrolment_details_api import ProviderManagementOperations -from ..models.api_provider_enrolment_details import APIProviderEnrolmentDetails # noqa: E501 -from ..models.problem_details import ProblemDetails # noqa: E501 -from .. import util +from api_provider_management.models.api_provider_enrolment_details import APIProviderEnrolmentDetails # noqa: E501 +from api_provider_management.models.problem_details import ProblemDetails # noqa: E501 +from api_provider_management import util + from ..core.validate_user import ControlAccess from cryptography import x509 @@ -14,9 +15,6 @@ from cryptography import x509 from functools import wraps -import sys - - provider_management_ops = ProviderManagementOperations() valid_user = ControlAccess() @@ -54,9 +52,8 @@ def registrations_post(body): # noqa: E501 :param api_provider_enrolment_details: :type api_provider_enrolment_details: dict | bytes - :rtype: APIProviderEnrolmentDetails + :rtype: Union[APIProviderEnrolmentDetails, Tuple[APIProviderEnrolmentDetails, int], Tuple[APIProviderEnrolmentDetails, int, Dict[str, str]] """ - identity = get_jwt_identity() username, uuid = identity.split() @@ -79,7 +76,7 @@ def registrations_registration_id_delete(registration_id): # noqa: E501 :param registration_id: String identifying an registered API provider domain resource. :type registration_id: str - :rtype: None + :rtype: Union[None, Tuple[None, int], Tuple[None, int, Dict[str, str]] """ current_app.logger.info("Removing Provider Domain") res = provider_management_ops.delete_api_provider_enrolment_details(registration_id) @@ -95,10 +92,10 @@ def registrations_registration_id_put(registration_id, body): # noqa: E501 :param registration_id: String identifying an registered API provider domain resource. :type registration_id: str - :param api_provider_enrolment_details: Representation of the API provider domain registration details to be updated in CAPIF core function. + :param api_provider_enrolment_details: Representation of the API provider domain registration details to be updated in CAPIF core function. :type api_provider_enrolment_details: dict | bytes - :rtype: APIProviderEnrolmentDetails + :rtype: Union[APIProviderEnrolmentDetails, Tuple[APIProviderEnrolmentDetails, int], Tuple[APIProviderEnrolmentDetails, int, Dict[str, str]] """ current_app.logger.info("Updating Provider Domain") if connexion.request.is_json: diff --git a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/controllers/individual_api_provider_enrolment_details_controller.py b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/controllers/individual_api_provider_enrolment_details_controller.py index dee8d15..0403d7a 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/controllers/individual_api_provider_enrolment_details_controller.py +++ b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/controllers/individual_api_provider_enrolment_details_controller.py @@ -2,17 +2,16 @@ import connexion from flask import Response, request, current_app from ..core.provider_enrolment_details_api import ProviderManagementOperations from ..encoder import JSONEncoder -from ..models.api_provider_enrolment_details import APIProviderEnrolmentDetails # noqa: E501 -from ..models.api_provider_enrolment_details_patch import APIProviderEnrolmentDetailsPatch # noqa: E501 -from ..models.problem_details import ProblemDetails # noqa: E501 -from .. import util +from api_provider_management.models.api_provider_enrolment_details import APIProviderEnrolmentDetails # noqa: E501 +from api_provider_management.models.api_provider_enrolment_details_patch import APIProviderEnrolmentDetailsPatch # noqa: E501 +from api_provider_management.models.problem_details import ProblemDetails # noqa: E501 +from api_provider_management import util from cryptography.hazmat.backends import default_backend from cryptography import x509 provider_management_ops = ProviderManagementOperations() - def modify_ind_api_provider_enrolment(registration_id, body): # noqa: E501 """modify_ind_api_provider_enrolment @@ -23,9 +22,8 @@ def modify_ind_api_provider_enrolment(registration_id, body): # noqa: E501 :param api_provider_enrolment_details_patch: :type api_provider_enrolment_details_patch: dict | bytes - :rtype: APIProviderEnrolmentDetails + :rtype: Union[APIProviderEnrolmentDetails, Tuple[APIProviderEnrolmentDetails, int], Tuple[APIProviderEnrolmentDetails, int, Dict[str, str]] """ - current_app.logger.info("Patch Provider Domain") if connexion.request.is_json: body = APIProviderEnrolmentDetailsPatch.from_dict(connexion.request.get_json()) # noqa: E501 diff --git a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/controllers/security_controller_.py b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/controllers/security_controller.py similarity index 100% rename from services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/controllers/security_controller_.py rename to services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/controllers/security_controller.py diff --git a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/encoder.py b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/encoder.py index 3f1c01c..da36f4c 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/encoder.py +++ b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/encoder.py @@ -1,7 +1,7 @@ from connexion.apps.flask_app import FlaskJSONEncoder -import six -from models.base_model_ import Model +from api_provider_management.models.base_model import Model + class JSONEncoder(FlaskJSONEncoder): include_nulls = False @@ -9,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_API_Provider_Management_API/api_provider_management/models/__init__.py b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/__init__.py index 785be45..5ad7c47 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/__init__.py +++ b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/__init__.py @@ -1,13 +1,9 @@ -# coding: utf-8 - # flake8: noqa -from __future__ import absolute_import # import models into model package from api_provider_management.models.api_provider_enrolment_details import APIProviderEnrolmentDetails from api_provider_management.models.api_provider_enrolment_details_patch import APIProviderEnrolmentDetailsPatch from api_provider_management.models.api_provider_function_details import APIProviderFunctionDetails from api_provider_management.models.api_provider_func_role import ApiProviderFuncRole -from api_provider_management.models.api_provider_func_role_any_of import ApiProviderFuncRoleAnyOf from api_provider_management.models.invalid_param import InvalidParam from api_provider_management.models.problem_details import ProblemDetails from api_provider_management.models.registration_information import RegistrationInformation diff --git a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_enrolment_details.py b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_enrolment_details.py index b4d4f38..3199537 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_enrolment_details.py +++ b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_enrolment_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 api_provider_management.models.base_model_ import Model +from api_provider_management.models.base_model import Model from api_provider_management.models.api_provider_function_details import APIProviderFunctionDetails import re from api_provider_management import util @@ -19,7 +16,7 @@ class APIProviderEnrolmentDetails(Model): Do not edit the class manually. """ - def __init__(self, api_prov_dom_id=None, reg_sec=None, api_prov_funcs=None, api_prov_dom_info=None, supp_feat=None, fail_reason=None): # noqa: E501 + def __init__(self, api_prov_dom_id=None, reg_sec=None, api_prov_funcs=None, api_prov_dom_info=None, supp_feat=None, fail_reason=None, api_prov_name=None): # noqa: E501 """APIProviderEnrolmentDetails - a model defined in OpenAPI :param api_prov_dom_id: The api_prov_dom_id of this APIProviderEnrolmentDetails. # noqa: E501 @@ -34,6 +31,8 @@ class APIProviderEnrolmentDetails(Model): :type supp_feat: str :param fail_reason: The fail_reason of this APIProviderEnrolmentDetails. # noqa: E501 :type fail_reason: str + :param api_prov_name: The api_prov_name of this APIProviderEnrolmentDetails. # noqa: E501 + :type api_prov_name: str """ self.openapi_types = { 'api_prov_dom_id': str, @@ -41,7 +40,8 @@ class APIProviderEnrolmentDetails(Model): 'api_prov_funcs': List[APIProviderFunctionDetails], 'api_prov_dom_info': str, 'supp_feat': str, - 'fail_reason': str + 'fail_reason': str, + 'api_prov_name': str } self.attribute_map = { @@ -50,7 +50,8 @@ class APIProviderEnrolmentDetails(Model): 'api_prov_funcs': 'apiProvFuncs', 'api_prov_dom_info': 'apiProvDomInfo', 'supp_feat': 'suppFeat', - 'fail_reason': 'failReason' + 'fail_reason': 'failReason', + 'api_prov_name': 'apiProvName' } self._api_prov_dom_id = api_prov_dom_id @@ -59,6 +60,7 @@ class APIProviderEnrolmentDetails(Model): self._api_prov_dom_info = api_prov_dom_info self._supp_feat = supp_feat self._fail_reason = fail_reason + self._api_prov_name = api_prov_name @classmethod def from_dict(cls, dikt) -> 'APIProviderEnrolmentDetails': @@ -72,7 +74,7 @@ class APIProviderEnrolmentDetails(Model): return util.deserialize_model(dikt, cls) @property - def api_prov_dom_id(self): + def api_prov_dom_id(self) -> str: """Gets the api_prov_dom_id of this APIProviderEnrolmentDetails. API provider domain ID assigned by the CAPIF core function to the API management function while registering the API provider domain. Shall not be present in the HTTP POST request from the API Management function to the CAPIF core function, to on-board itself. Shall be present in all other HTTP requests and responses. # noqa: E501 @@ -83,7 +85,7 @@ class APIProviderEnrolmentDetails(Model): return self._api_prov_dom_id @api_prov_dom_id.setter - def api_prov_dom_id(self, api_prov_dom_id): + def api_prov_dom_id(self, api_prov_dom_id: str): """Sets the api_prov_dom_id of this APIProviderEnrolmentDetails. API provider domain ID assigned by the CAPIF core function to the API management function while registering the API provider domain. Shall not be present in the HTTP POST request from the API Management function to the CAPIF core function, to on-board itself. Shall be present in all other HTTP requests and responses. # noqa: E501 @@ -95,7 +97,7 @@ class APIProviderEnrolmentDetails(Model): self._api_prov_dom_id = api_prov_dom_id @property - def reg_sec(self): + def reg_sec(self) -> str: """Gets the reg_sec of this APIProviderEnrolmentDetails. Security information necessary for the CAPIF core function to validate the registration of the API provider domain. Shall be present in HTTP POST request from API management function to CAPIF core function for API provider domain registration. # noqa: E501 @@ -106,7 +108,7 @@ class APIProviderEnrolmentDetails(Model): return self._reg_sec @reg_sec.setter - def reg_sec(self, reg_sec): + def reg_sec(self, reg_sec: str): """Sets the reg_sec of this APIProviderEnrolmentDetails. Security information necessary for the CAPIF core function to validate the registration of the API provider domain. Shall be present in HTTP POST request from API management function to CAPIF core function for API provider domain registration. # noqa: E501 @@ -120,7 +122,7 @@ class APIProviderEnrolmentDetails(Model): self._reg_sec = reg_sec @property - def api_prov_funcs(self): + def api_prov_funcs(self) -> List[APIProviderFunctionDetails]: """Gets the api_prov_funcs of this APIProviderEnrolmentDetails. A list of individual API provider domain functions details. When included by the API management function in the HTTP request message, it lists the API provider domain functions that the API management function intends to register/update in registration or update registration procedure. When included by the CAPIF core function in the HTTP response message, it lists the API domain functions details that are registered or updated successfully. # noqa: E501 @@ -131,7 +133,7 @@ class APIProviderEnrolmentDetails(Model): return self._api_prov_funcs @api_prov_funcs.setter - def api_prov_funcs(self, api_prov_funcs): + def api_prov_funcs(self, api_prov_funcs: List[APIProviderFunctionDetails]): """Sets the api_prov_funcs of this APIProviderEnrolmentDetails. A list of individual API provider domain functions details. When included by the API management function in the HTTP request message, it lists the API provider domain functions that the API management function intends to register/update in registration or update registration procedure. When included by the CAPIF core function in the HTTP response message, it lists the API domain functions details that are registered or updated successfully. # noqa: E501 @@ -145,7 +147,7 @@ class APIProviderEnrolmentDetails(Model): self._api_prov_funcs = api_prov_funcs @property - def api_prov_dom_info(self): + def api_prov_dom_info(self) -> str: """Gets the api_prov_dom_info of this APIProviderEnrolmentDetails. Generic information related to the API provider domain such as details of the API provider applications. # noqa: E501 @@ -156,7 +158,7 @@ class APIProviderEnrolmentDetails(Model): return self._api_prov_dom_info @api_prov_dom_info.setter - def api_prov_dom_info(self, api_prov_dom_info): + def api_prov_dom_info(self, api_prov_dom_info: str): """Sets the api_prov_dom_info of this APIProviderEnrolmentDetails. Generic information related to the API provider domain such as details of the API provider applications. # noqa: E501 @@ -168,7 +170,7 @@ class APIProviderEnrolmentDetails(Model): self._api_prov_dom_info = api_prov_dom_info @property - def supp_feat(self): + def supp_feat(self) -> str: """Gets the supp_feat of this APIProviderEnrolmentDetails. 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 @@ -179,7 +181,7 @@ class APIProviderEnrolmentDetails(Model): return self._supp_feat @supp_feat.setter - def supp_feat(self, supp_feat): + def supp_feat(self, supp_feat: str): """Sets the supp_feat of this APIProviderEnrolmentDetails. 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 @@ -193,7 +195,7 @@ class APIProviderEnrolmentDetails(Model): self._supp_feat = supp_feat @property - def fail_reason(self): + def fail_reason(self) -> str: """Gets the fail_reason of this APIProviderEnrolmentDetails. Registration or update specific failure information of failed API provider domain function registrations.Shall be present in the HTTP response body if atleast one of the API provider domain function registration or update registration fails. # noqa: E501 @@ -204,7 +206,7 @@ class APIProviderEnrolmentDetails(Model): return self._fail_reason @fail_reason.setter - def fail_reason(self, fail_reason): + def fail_reason(self, fail_reason: str): """Sets the fail_reason of this APIProviderEnrolmentDetails. Registration or update specific failure information of failed API provider domain function registrations.Shall be present in the HTTP response body if atleast one of the API provider domain function registration or update registration fails. # noqa: E501 @@ -214,3 +216,26 @@ class APIProviderEnrolmentDetails(Model): """ self._fail_reason = fail_reason + + @property + def api_prov_name(self) -> str: + """Gets the api_prov_name of this APIProviderEnrolmentDetails. + + Represents the API provider name. # noqa: E501 + + :return: The api_prov_name of this APIProviderEnrolmentDetails. + :rtype: str + """ + return self._api_prov_name + + @api_prov_name.setter + def api_prov_name(self, api_prov_name: str): + """Sets the api_prov_name of this APIProviderEnrolmentDetails. + + Represents the API provider name. # noqa: E501 + + :param api_prov_name: The api_prov_name of this APIProviderEnrolmentDetails. + :type api_prov_name: str + """ + + self._api_prov_name = api_prov_name diff --git a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_enrolment_details_patch.py b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_enrolment_details_patch.py index acd2728..e16230b 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_enrolment_details_patch.py +++ b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_enrolment_details_patch.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 api_provider_management.models.base_model_ import Model +from api_provider_management.models.base_model import Model from api_provider_management.models.api_provider_function_details import APIProviderFunctionDetails from api_provider_management import util @@ -50,7 +47,7 @@ class APIProviderEnrolmentDetailsPatch(Model): return util.deserialize_model(dikt, cls) @property - def api_prov_funcs(self): + def api_prov_funcs(self) -> List[APIProviderFunctionDetails]: """Gets the api_prov_funcs of this APIProviderEnrolmentDetailsPatch. A list of individual API provider domain functions details. When included by the API management function in the HTTP request message, it lists the API provider domain functions that the API management function intends to register/update in registration or update registration procedure. # noqa: E501 @@ -61,7 +58,7 @@ class APIProviderEnrolmentDetailsPatch(Model): return self._api_prov_funcs @api_prov_funcs.setter - def api_prov_funcs(self, api_prov_funcs): + def api_prov_funcs(self, api_prov_funcs: List[APIProviderFunctionDetails]): """Sets the api_prov_funcs of this APIProviderEnrolmentDetailsPatch. A list of individual API provider domain functions details. When included by the API management function in the HTTP request message, it lists the API provider domain functions that the API management function intends to register/update in registration or update registration procedure. # noqa: E501 @@ -75,7 +72,7 @@ class APIProviderEnrolmentDetailsPatch(Model): self._api_prov_funcs = api_prov_funcs @property - def api_prov_dom_info(self): + def api_prov_dom_info(self) -> str: """Gets the api_prov_dom_info of this APIProviderEnrolmentDetailsPatch. Generic information related to the API provider domain such as details of the API provider applications. # noqa: E501 @@ -86,7 +83,7 @@ class APIProviderEnrolmentDetailsPatch(Model): return self._api_prov_dom_info @api_prov_dom_info.setter - def api_prov_dom_info(self, api_prov_dom_info): + def api_prov_dom_info(self, api_prov_dom_info: str): """Sets the api_prov_dom_info of this APIProviderEnrolmentDetailsPatch. Generic information related to the API provider domain such as details of the API provider applications. # noqa: E501 diff --git a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_func_role.py b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_func_role.py index 9c2b1da..7f3bb0f 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_func_role.py +++ b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_func_role.py @@ -1,15 +1,10 @@ -# coding: utf-8 - -from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 -from api_provider_management.models.base_model_ import Model -from api_provider_management.models.api_provider_func_role_any_of import ApiProviderFuncRoleAnyOf +from api_provider_management.models.base_model import Model from api_provider_management import util -from api_provider_management.models.api_provider_func_role_any_of import ApiProviderFuncRoleAnyOf # noqa: E501 class ApiProviderFuncRole(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_func_role_any_of.py b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_func_role_any_of.py deleted file mode 100644 index 8d4b9b0..0000000 --- a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_func_role_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 api_provider_management.models.base_model_ import Model -from api_provider_management import util - - -class ApiProviderFuncRoleAnyOf(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - """ - allowed enum values - """ - AEF = "AEF" - APF = "APF" - AMF = "AMF" - def __init__(self): # noqa: E501 - """ApiProviderFuncRoleAnyOf - a model defined in OpenAPI - - """ - self.openapi_types = { - } - - self.attribute_map = { - } - - @classmethod - def from_dict(cls, dikt) -> 'ApiProviderFuncRoleAnyOf': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The ApiProviderFuncRole_anyOf of this ApiProviderFuncRoleAnyOf. # noqa: E501 - :rtype: ApiProviderFuncRoleAnyOf - """ - return util.deserialize_model(dikt, cls) diff --git a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_function_details.py b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_function_details.py index eb21ba7..d6989b1 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_function_details.py +++ b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_function_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 api_provider_management.models.base_model_ import Model +from api_provider_management.models.base_model import Model from api_provider_management.models.api_provider_func_role import ApiProviderFuncRole from api_provider_management.models.registration_information import RegistrationInformation from api_provider_management import util @@ -62,7 +59,7 @@ class APIProviderFunctionDetails(Model): return util.deserialize_model(dikt, cls) @property - def api_prov_func_id(self): + def api_prov_func_id(self) -> str: """Gets the api_prov_func_id of this APIProviderFunctionDetails. API provider domain functionID assigned by the CAPIF core function to the API provider domain function while registering/updating the API provider domain. Shall not be present in the HTTP POST request from the API management function to the CAPIF core function, to register itself. Shall be present in all other HTTP requests and responses. # noqa: E501 @@ -73,7 +70,7 @@ class APIProviderFunctionDetails(Model): return self._api_prov_func_id @api_prov_func_id.setter - def api_prov_func_id(self, api_prov_func_id): + def api_prov_func_id(self, api_prov_func_id: str): """Sets the api_prov_func_id of this APIProviderFunctionDetails. API provider domain functionID assigned by the CAPIF core function to the API provider domain function while registering/updating the API provider domain. Shall not be present in the HTTP POST request from the API management function to the CAPIF core function, to register itself. Shall be present in all other HTTP requests and responses. # noqa: E501 @@ -85,7 +82,7 @@ class APIProviderFunctionDetails(Model): self._api_prov_func_id = api_prov_func_id @property - def reg_info(self): + def reg_info(self) -> RegistrationInformation: """Gets the reg_info of this APIProviderFunctionDetails. @@ -95,7 +92,7 @@ class APIProviderFunctionDetails(Model): return self._reg_info @reg_info.setter - def reg_info(self, reg_info): + def reg_info(self, reg_info: RegistrationInformation): """Sets the reg_info of this APIProviderFunctionDetails. @@ -108,7 +105,7 @@ class APIProviderFunctionDetails(Model): self._reg_info = reg_info @property - def api_prov_func_role(self): + def api_prov_func_role(self) -> ApiProviderFuncRole: """Gets the api_prov_func_role of this APIProviderFunctionDetails. @@ -118,7 +115,7 @@ class APIProviderFunctionDetails(Model): return self._api_prov_func_role @api_prov_func_role.setter - def api_prov_func_role(self, api_prov_func_role): + def api_prov_func_role(self, api_prov_func_role: ApiProviderFuncRole): """Sets the api_prov_func_role of this APIProviderFunctionDetails. @@ -131,7 +128,7 @@ class APIProviderFunctionDetails(Model): self._api_prov_func_role = api_prov_func_role @property - def api_prov_func_info(self): + def api_prov_func_info(self) -> str: """Gets the api_prov_func_info of this APIProviderFunctionDetails. Generic information related to the API provider domain function such as details of the API provider applications. # noqa: E501 @@ -142,7 +139,7 @@ class APIProviderFunctionDetails(Model): return self._api_prov_func_info @api_prov_func_info.setter - def api_prov_func_info(self, api_prov_func_info): + def api_prov_func_info(self, api_prov_func_info: str): """Sets the api_prov_func_info of this APIProviderFunctionDetails. Generic information related to the API provider domain function such as details of the API provider applications. # noqa: E501 diff --git a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/base_model_.py b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/base_model.py similarity index 92% rename from services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/base_model_.py rename to services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/base_model.py index bd3a034..4fd1d5c 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/base_model_.py +++ b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/base_model.py @@ -1,6 +1,5 @@ import pprint -import six import typing from api_provider_management import util @@ -8,14 +7,14 @@ from api_provider_management 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_API_Provider_Management_API/api_provider_management/models/invalid_param.py b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/invalid_param.py index 58aae71..003aa18 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/invalid_param.py +++ b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/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 api_provider_management.models.base_model_ import Model +from api_provider_management.models.base_model import Model from api_provider_management 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_API_Provider_Management_API/api_provider_management/models/problem_details.py b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/problem_details.py index 44fe344..6ce7d77 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/problem_details.py +++ b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/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 api_provider_management.models.base_model_ import Model +from api_provider_management.models.base_model import Model from api_provider_management.models.invalid_param import InvalidParam import re from api_provider_management 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_API_Provider_Management_API/api_provider_management/models/registration_information.py b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/registration_information.py index 7e1b08a..3e4d440 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/registration_information.py +++ b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/registration_information.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 api_provider_management.models.base_model_ import Model +from api_provider_management.models.base_model import Model from api_provider_management import util @@ -48,7 +45,7 @@ class RegistrationInformation(Model): return util.deserialize_model(dikt, cls) @property - def api_prov_pub_key(self): + def api_prov_pub_key(self) -> str: """Gets the api_prov_pub_key of this RegistrationInformation. Public Key of API Provider domain function. # noqa: E501 @@ -59,7 +56,7 @@ class RegistrationInformation(Model): return self._api_prov_pub_key @api_prov_pub_key.setter - def api_prov_pub_key(self, api_prov_pub_key): + def api_prov_pub_key(self, api_prov_pub_key: str): """Sets the api_prov_pub_key of this RegistrationInformation. Public Key of API Provider domain function. # noqa: E501 @@ -73,7 +70,7 @@ class RegistrationInformation(Model): self._api_prov_pub_key = api_prov_pub_key @property - def api_prov_cert(self): + def api_prov_cert(self) -> str: """Gets the api_prov_cert of this RegistrationInformation. API provider domain function's client certificate # noqa: E501 @@ -84,7 +81,7 @@ class RegistrationInformation(Model): return self._api_prov_cert @api_prov_cert.setter - def api_prov_cert(self, api_prov_cert): + def api_prov_cert(self, api_prov_cert: str): """Sets the api_prov_cert of this RegistrationInformation. API provider domain function's client certificate # noqa: E501 diff --git a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/openapi/openapi.yaml b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/openapi/openapi.yaml index 59ea36c..60fd3db 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/openapi/openapi.yaml +++ b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/openapi/openapi.yaml @@ -1,15 +1,15 @@ openapi: 3.0.0 info: - description: "API for API provider domain functions management. \n© 2022, 3GPP\ + description: "API for API provider domain functions management. \n© 2024, 3GPP\ \ Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). \nAll rights\ \ reserved.\n" title: CAPIF_API_Provider_Management_API - version: 1.1.0 + version: 1.2.0-alpha.3 externalDocs: - description: 3GPP TS 29.222 V17.5.0 Common API Framework for 3GPP Northbound APIs + description: 3GPP TS 29.222 V18.5.0 Common API Framework for 3GPP Northbound APIs url: https://www.3gpp.org/ftp/Specs/archive/29_series/29.222/ servers: -- url: '{apiRoot}/api-provider-management/v1' +- url: "{apiRoot}/api-provider-management/v1" variables: apiRoot: default: https://example.com @@ -77,7 +77,7 @@ paths: application/problem+json: schema: $ref: '#/components/schemas/ProblemDetails' - description: Payload Too Large + description: Content Too Large "415": content: application/problem+json: @@ -261,7 +261,7 @@ paths: application/problem+json: schema: $ref: '#/components/schemas/ProblemDetails' - description: Payload Too Large + description: Content Too Large "415": content: application/problem+json: @@ -371,7 +371,7 @@ paths: application/problem+json: schema: $ref: '#/components/schemas/ProblemDetails' - description: Payload Too Large + description: Content Too Large "415": content: application/problem+json: @@ -400,10 +400,90 @@ paths: description: Generic Error x-openapi-router-controller: api_provider_management.controllers.default_controller components: + responses: + "400": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + description: Bad request + "401": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + description: Unauthorized + "403": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + description: Forbidden + "404": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + description: Not Found + "411": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + description: Length Required + "413": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + description: Content Too Large + "415": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + description: Unsupported Media Type + "429": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + description: Too Many Requests + "500": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + description: Internal Server Error + "503": + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + description: Service Unavailable + default: + description: Generic Error + "307": + description: Temporary Redirect + headers: + Location: + description: An alternative URI of the resource. + required: true + schema: + type: string + "308": + description: Permanent Redirect + headers: + Location: + description: An alternative URI of the resource. + required: true + schema: + type: string schemas: APIProviderEnrolmentDetails: description: Represents an API provider domain's enrolment details. example: + apiProvName: apiProvName regSec: regSec apiProvFuncs: - apiProvFuncId: apiProvFuncId @@ -411,11 +491,13 @@ components: regInfo: apiProvCert: apiProvCert apiProvPubKey: apiProvPubKey + apiProvFuncRole: AEF - apiProvFuncId: apiProvFuncId apiProvFuncInfo: apiProvFuncInfo regInfo: apiProvCert: apiProvCert apiProvPubKey: apiProvPubKey + apiProvFuncRole: AEF failReason: failReason apiProvDomId: apiProvDomId apiProvDomInfo: apiProvDomInfo @@ -448,7 +530,7 @@ components: suppFeat: 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]*$ + pattern: "^[A-Fa-f0-9]*$" title: suppFeat type: string failReason: @@ -456,18 +538,23 @@ components: Registration or update specific failure information of failed API provider domain function registrations.Shall be present in the HTTP response body if atleast one of the API provider domain function registration or update registration fails. title: failReason type: string + apiProvName: + description: Represents the API provider name. + title: apiProvName + type: string required: - regSec title: APIProviderEnrolmentDetails type: object APIProviderFunctionDetails: - description: Represents API provider domain function's details. + description: Represents an API provider domain function's details. example: apiProvFuncId: apiProvFuncId apiProvFuncInfo: apiProvFuncInfo regInfo: apiProvCert: apiProvCert apiProvPubKey: apiProvPubKey + apiProvFuncRole: AEF properties: apiProvFuncId: description: | @@ -507,20 +594,9 @@ components: - apiProvPubKey title: RegistrationInformation type: object - ApiProviderFuncRole: - anyOf: - - $ref: '#/components/schemas/ApiProviderFuncRole_anyOf' - - description: | - This string provides forward-compatiblity with future extensions to the enumeration but is not used to encode content defined in the present version of this API. - type: string - description: | - Possible values are: - - AEF: API provider function is API Exposing Function. - - APF: API provider function is API Publishing Function. - - AMF: API Provider function is API Management Function. - title: ApiProviderFuncRole APIProviderEnrolmentDetailsPatch: - description: Represents an API provider domain's enrolment details. + description: | + Represents a list of modifications for the API provider domain's enrolment details. properties: apiProvFuncs: description: "A list of individual API provider domain functions details.\ @@ -531,12 +607,30 @@ components: items: $ref: '#/components/schemas/APIProviderFunctionDetails' minItems: 1 + title: apiProvFuncs type: array apiProvDomInfo: description: | Generic information related to the API provider domain such as details of the API provider applications. + title: apiProvDomInfo type: string + title: APIProviderEnrolmentDetailsPatch type: object + ApiProviderFuncRole: + anyOf: + - enum: + - AEF + - APF + - AMF + type: string + - description: | + This string provides forward-compatiblity 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 role (e.g. AEF, APF, etc.) of an API provider domain\ + \ function. \nPossible values are:\n- AEF: API provider function is API Exposing\ + \ Function.\n- APF: API provider function is API Publishing Function.\n- AMF:\ + \ API Provider function is API Management Function.\n" + title: ApiProviderFuncRole ProblemDetails: description: Represents additional information and details on an error response. properties: @@ -545,8 +639,8 @@ components: title: type type: string title: - description: A short, human-readable summary of the problem type. It should - not change from occurrence to occurrence of the problem. + 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: @@ -563,14 +657,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 @@ -579,7 +672,7 @@ components: 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]*$ + pattern: "^[A-Fa-f0-9]*$" title: suppFeat type: string title: ProblemDetails @@ -589,15 +682,16 @@ 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. + 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". + description: "A human-readable reason, e.g. \"must be a positive integer\"\ + ." title: reason type: string required: @@ -607,13 +701,6 @@ components: 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]*$ + pattern: "^[A-Fa-f0-9]*$" title: suppFeat type: string - ApiProviderFuncRole_anyOf: - enum: - - AEF - - APF - - AMF - title: ApiProviderFuncRole_anyOf - type: string diff --git a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/test/__init__.py b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/test/__init__.py new file mode 100644 index 0000000..9853918 --- /dev/null +++ b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/test/__init__.py @@ -0,0 +1,16 @@ +import logging + +import connexion +from flask_testing import TestCase + +from api_provider_management.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_API_Provider_Management_API/api_provider_management/test/test_default_controller.py b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/test/test_default_controller.py new file mode 100644 index 0000000..2b12ff8 --- /dev/null +++ b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/test/test_default_controller.py @@ -0,0 +1,68 @@ +import unittest + +from flask import json + +from api_provider_management.models.api_provider_enrolment_details import APIProviderEnrolmentDetails # noqa: E501 +from api_provider_management.models.problem_details import ProblemDetails # noqa: E501 +from api_provider_management.test import BaseTestCase + + +class TestDefaultController(BaseTestCase): + """DefaultController integration test stubs""" + + def test_registrations_post(self): + """Test case for registrations_post + + + """ + api_provider_enrolment_details = {"apiProvName":"apiProvName","regSec":"regSec","apiProvFuncs":[{"apiProvFuncId":"apiProvFuncId","apiProvFuncInfo":"apiProvFuncInfo","regInfo":{"apiProvCert":"apiProvCert","apiProvPubKey":"apiProvPubKey"},"apiProvFuncRole":"AEF"},{"apiProvFuncId":"apiProvFuncId","apiProvFuncInfo":"apiProvFuncInfo","regInfo":{"apiProvCert":"apiProvCert","apiProvPubKey":"apiProvPubKey"},"apiProvFuncRole":"AEF"}],"failReason":"failReason","apiProvDomId":"apiProvDomId","apiProvDomInfo":"apiProvDomInfo","suppFeat":"suppFeat"} + headers = { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + } + response = self.client.open( + '/api-provider-management/v1/registrations', + method='POST', + headers=headers, + data=json.dumps(api_provider_enrolment_details), + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_registrations_registration_id_delete(self): + """Test case for registrations_registration_id_delete + + + """ + headers = { + 'Accept': 'application/problem+json', + } + response = self.client.open( + '/api-provider-management/v1/registrations/{registration_id}'.format(registration_id='registration_id_example'), + method='DELETE', + headers=headers) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_registrations_registration_id_put(self): + """Test case for registrations_registration_id_put + + + """ + api_provider_enrolment_details = {"apiProvName":"apiProvName","regSec":"regSec","apiProvFuncs":[{"apiProvFuncId":"apiProvFuncId","apiProvFuncInfo":"apiProvFuncInfo","regInfo":{"apiProvCert":"apiProvCert","apiProvPubKey":"apiProvPubKey"},"apiProvFuncRole":"AEF"},{"apiProvFuncId":"apiProvFuncId","apiProvFuncInfo":"apiProvFuncInfo","regInfo":{"apiProvCert":"apiProvCert","apiProvPubKey":"apiProvPubKey"},"apiProvFuncRole":"AEF"}],"failReason":"failReason","apiProvDomId":"apiProvDomId","apiProvDomInfo":"apiProvDomInfo","suppFeat":"suppFeat"} + headers = { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + } + response = self.client.open( + '/api-provider-management/v1/registrations/{registration_id}'.format(registration_id='registration_id_example'), + method='PUT', + headers=headers, + data=json.dumps(api_provider_enrolment_details), + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + +if __name__ == '__main__': + unittest.main() diff --git a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/test/test_individual_api_provider_enrolment_details_controller.py b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/test/test_individual_api_provider_enrolment_details_controller.py new file mode 100644 index 0000000..463aa43 --- /dev/null +++ b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/test/test_individual_api_provider_enrolment_details_controller.py @@ -0,0 +1,35 @@ +import unittest + +from flask import json + +from api_provider_management.models.api_provider_enrolment_details import APIProviderEnrolmentDetails # noqa: E501 +from api_provider_management.models.api_provider_enrolment_details_patch import APIProviderEnrolmentDetailsPatch # noqa: E501 +from api_provider_management.models.problem_details import ProblemDetails # noqa: E501 +from api_provider_management.test import BaseTestCase + + +class TestIndividualAPIProviderEnrolmentDetailsController(BaseTestCase): + """IndividualAPIProviderEnrolmentDetailsController integration test stubs""" + + def test_modify_ind_api_provider_enrolment(self): + """Test case for modify_ind_api_provider_enrolment + + + """ + api_provider_enrolment_details_patch = openapi_server.APIProviderEnrolmentDetailsPatch() + headers = { + 'Accept': 'application/json', + 'Content-Type': 'application/merge-patch+json', + } + response = self.client.open( + '/api-provider-management/v1/registrations/{registration_id}'.format(registration_id='registration_id_example'), + method='PATCH', + headers=headers, + data=json.dumps(api_provider_enrolment_details_patch), + content_type='application/merge-patch+json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + +if __name__ == '__main__': + unittest.main() diff --git a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/typing_utils.py b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/typing_utils.py index 0563f81..74e3c91 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/typing_utils.py +++ b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/typing_utils.py @@ -1,5 +1,3 @@ -# coding: utf-8 - import sys if sys.version_info < (3, 7): diff --git a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/util.py b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/util.py index 431a28c..f533c8d 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/util.py +++ b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/util.py @@ -1,7 +1,7 @@ import datetime -import six -import typing_utils +import typing +from api_provider_management import typing_utils def serialize_clean_camel_case(obj): res = obj.to_dict() @@ -51,7 +51,6 @@ def dict_to_camel_case(my_dict): return result - def _deserialize(data, klass): """Deserializes dict, list, str into an object. @@ -63,7 +62,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) @@ -92,7 +91,7 @@ def _deserialize_primitive(data, klass): try: value = klass(data) except UnicodeEncodeError: - value = six.u(data) + value = data except TypeError: value = data return value @@ -157,7 +156,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)): @@ -192,4 +191,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_API_Provider_Management_API/api_provider_management/wsgi copy.py b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/wsgi copy.py new file mode 100644 index 0000000..6026b0f --- /dev/null +++ b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/wsgi copy.py @@ -0,0 +1,4 @@ +from app import app + +if __name__ == "__main__": + app.run() diff --git a/services/TS29222_CAPIF_API_Provider_Management_API/git_push.sh b/services/TS29222_CAPIF_API_Provider_Management_API/git_push.sh index 9405f72..f53a75d 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/git_push.sh +++ b/services/TS29222_CAPIF_API_Provider_Management_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_API_Provider_Management_API/setup.py b/services/TS29222_CAPIF_API_Provider_Management_API/setup.py index ac408ac..9eba8bd 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/setup.py +++ b/services/TS29222_CAPIF_API_Provider_Management_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': ['api_provider_management=api_provider_management.__main__:main']}, long_description="""\ - API for API provider domain functions management. © 2021, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. + API for API provider domain functions management. © 2024, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. """ ) diff --git a/services/TS29222_CAPIF_API_Provider_Management_API/test-requirements.txt b/services/TS29222_CAPIF_API_Provider_Management_API/test-requirements.txt index 202a684..58f51d6 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/test-requirements.txt +++ b/services/TS29222_CAPIF_API_Provider_Management_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_API_Provider_Management_API/tox.ini b/services/TS29222_CAPIF_API_Provider_Management_API/tox.ini index 5dbd962..371a15e 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/tox.ini +++ b/services/TS29222_CAPIF_API_Provider_Management_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=api_provider_management -- GitLab