Commit a1b62a26 authored by Pelayo Torres's avatar Pelayo Torres
Browse files

Merge branch 'REL18-CAPIF_Publish_Service' into 'OCF64-rel17-to-rel18'

REL18 publish service

See merge request !52
parents 55ab925e 70b60a57
Loading
Loading
Loading
Loading
Loading
+32 −7
Original line number Diff line number Diff line
.dockerignore
.gitignore
.openapi-generator-ignore
.travis.yml
Dockerfile
README.md
@@ -8,32 +9,56 @@ published_apis/__init__.py
published_apis/__main__.py
published_apis/controllers/__init__.py
published_apis/controllers/default_controller.py
published_apis/controllers/security_controller_.py
published_apis/controllers/individual_apf_published_api_controller.py
published_apis/controllers/security_controller.py
published_apis/encoder.py
published_apis/models/__init__.py
published_apis/models/aef_location.py
published_apis/models/aef_profile.py
published_apis/models/base_model_.py
published_apis/models/api_status.py
published_apis/models/base_model.py
published_apis/models/civic_address.py
published_apis/models/communication_type.py
published_apis/models/communication_type_any_of.py
published_apis/models/custom_operation.py
published_apis/models/data_format.py
published_apis/models/data_format_any_of.py
published_apis/models/ellipsoid_arc.py
published_apis/models/gad_shape.py
published_apis/models/geographic_area.py
published_apis/models/geographical_coordinates.py
published_apis/models/interface_description.py
published_apis/models/invalid_param.py
published_apis/models/ip_addr_range.py
published_apis/models/ipv4_address_range.py
published_apis/models/ipv6_addr1.py
published_apis/models/ipv6_address_range.py
published_apis/models/local2d_point_uncertainty_ellipse.py
published_apis/models/local3d_point_uncertainty_ellipsoid.py
published_apis/models/local_origin.py
published_apis/models/operation.py
published_apis/models/operation_any_of.py
published_apis/models/point.py
published_apis/models/point_altitude.py
published_apis/models/point_altitude_uncertainty.py
published_apis/models/point_uncertainty_circle.py
published_apis/models/point_uncertainty_ellipse.py
published_apis/models/polygon.py
published_apis/models/problem_details.py
published_apis/models/protocol.py
published_apis/models/protocol_any_of.py
published_apis/models/published_api_path.py
published_apis/models/relative_cartesian_location.py
published_apis/models/resource.py
published_apis/models/security_method.py
published_apis/models/security_method_any_of.py
published_apis/models/service_api_description.py
published_apis/models/service_api_description_patch.py
published_apis/models/service_kpis.py
published_apis/models/shareable_information.py
published_apis/models/supported_gad_shapes.py
published_apis/models/uncertainty_ellipse.py
published_apis/models/uncertainty_ellipsoid.py
published_apis/models/version.py
published_apis/openapi/openapi.yaml
published_apis/test/__init__.py
published_apis/test/test_default_controller.py
published_apis/test/test_individual_apf_published_api_controller.py
published_apis/typing_utils.py
published_apis/util.py
requirements.txt
+1 −1
Original line number Diff line number Diff line
5.3.0-SNAPSHOT
 No newline at end of file
7.5.0
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ To run the server, please execute the following from the root directory:

```
pip3 install -r requirements.txt
python3 -m published_apis
python3 -m openapi_server
```

and open your browser to here:
+3 −3
Original line number Diff line number Diff line
#!/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
+9 −14
Original line number Diff line number Diff line
@@ -2,6 +2,10 @@ import connexion
from ..models.service_api_description import ServiceAPIDescription  # noqa: E501
from ..core.serviceapidescriptions import PublishServiceOperations

from published_apis.models.problem_details import ProblemDetails  # noqa: E501
from published_apis.models.service_api_description import ServiceAPIDescription  # noqa: E501
from published_apis import util

from flask import Response, request, current_app

from cryptography import x509
@@ -14,7 +18,6 @@ service_operations = PublishServiceOperations()

valid_user = ControlAccess()


def cert_validation():
    def _cert_validation(f):
        @wraps(f)
@@ -43,7 +46,6 @@ def cert_validation():
        return __cert_validation
    return _cert_validation


def apf_id_service_apis_get(apf_id):  # noqa: E501
    """apf_id_service_apis_get

@@ -52,7 +54,7 @@ def apf_id_service_apis_get(apf_id): # noqa: E501
    :param apf_id: 
    :type apf_id: str

    :rtype: ServiceAPIDescription
    :rtype: Union[List[ServiceAPIDescription], Tuple[List[ServiceAPIDescription], int], Tuple[List[ServiceAPIDescription], int, Dict[str, str]]
    """
    current_app.logger.info("Obtainig all service published")
    res = service_operations.get_serviceapis(apf_id)
@@ -70,9 +72,8 @@ def apf_id_service_apis_post(apf_id, body): # noqa: E501
    :param service_api_description: 
    :type service_api_description: dict | bytes

    :rtype: ServiceAPIDescription
    :rtype: Union[ServiceAPIDescription, Tuple[ServiceAPIDescription, int], Tuple[ServiceAPIDescription, int, Dict[str, str]]
    """

    current_app.logger.info("Publishing service")
    if connexion.request.is_json:
        body = ServiceAPIDescription.from_dict(connexion.request.get_json())  # noqa: E501
@@ -81,7 +82,6 @@ def apf_id_service_apis_post(apf_id, body): # noqa: E501

    return res


@cert_validation()
def apf_id_service_apis_service_api_id_delete(service_api_id, apf_id):  # noqa: E501
    """apf_id_service_apis_service_api_id_delete
@@ -93,16 +93,14 @@ def apf_id_service_apis_service_api_id_delete(service_api_id, apf_id): # noqa:
    :param apf_id: 
    :type apf_id: str

    :rtype: None
    :rtype: Union[None, Tuple[None, int], Tuple[None, int, Dict[str, str]]
    """

    current_app.logger.info("Removing service published")
    res = service_operations.delete_serviceapidescription(
        service_api_id, apf_id)

    return res


@cert_validation()
def apf_id_service_apis_service_api_id_get(service_api_id, apf_id):  # noqa: E501
    """apf_id_service_apis_service_api_id_get
@@ -114,15 +112,13 @@ def apf_id_service_apis_service_api_id_get(service_api_id, apf_id): # noqa: E50
    :param apf_id: 
    :type apf_id: str

    :rtype: ServiceAPIDescription
    :rtype: Union[ServiceAPIDescription, Tuple[ServiceAPIDescription, int], Tuple[ServiceAPIDescription, int, Dict[str, str]]
    """

    current_app.logger.info("Obtaining service api with id: " + service_api_id)
    res = service_operations.get_one_serviceapi(service_api_id, apf_id)

    return res


@cert_validation()
def apf_id_service_apis_service_api_id_put(service_api_id, apf_id, body):  # noqa: E501
    """apf_id_service_apis_service_api_id_put
@@ -136,9 +132,8 @@ def apf_id_service_apis_service_api_id_put(service_api_id, apf_id, body): # noq
    :param service_api_description: 
    :type service_api_description: dict | bytes

    :rtype: ServiceAPIDescription
    :rtype: Union[ServiceAPIDescription, Tuple[ServiceAPIDescription, int], Tuple[ServiceAPIDescription, int, Dict[str, str]]
    """

    current_app.logger.info(
        "Updating service api id with id: " + service_api_id)

Loading