diff --git a/services/TS29222_CAPIF_API_Invoker_Management_API/api_invoker_management/core/apiinvokerenrolmentdetails.py b/services/TS29222_CAPIF_API_Invoker_Management_API/api_invoker_management/core/apiinvokerenrolmentdetails.py index 038b97c056569fef0dbad99f1ca5a02cdb51dc03..af08e7efb4aa8fb1f3f54a667f67dc13d819606b 100644 --- a/services/TS29222_CAPIF_API_Invoker_Management_API/api_invoker_management/core/apiinvokerenrolmentdetails.py +++ b/services/TS29222_CAPIF_API_Invoker_Management_API/api_invoker_management/core/apiinvokerenrolmentdetails.py @@ -14,6 +14,7 @@ from api_invoker_management.models.api_invoker_enrolment_details import APIInvok from .redis_event import RedisEvent from .redis_internal_event import RedisInternalEvent from .publisher import Publisher +import os publisher_ops = Publisher() @@ -101,8 +102,7 @@ class InvokerManagementOperations(Resource): res = make_response(object=serialize_clean_camel_case( apiinvokerenrolmentdetail), status=201) - res.headers['Location'] = "/api-invoker-management/v1/onboardedInvokers/" + \ - str(api_invoker_id) + res.headers['Location'] = f"https://{os.getenv("CAPIF_HOSTNAME")}/api-invoker-management/v1/onboardedInvokers/{str(api_invoker_id)}" if res.status_code == 201: current_app.logger.info("Invoker Created") diff --git a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/core/provider_enrolment_details_api.py b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/core/provider_enrolment_details_api.py index de8b08f969573f6854a1dedeb4fb3eacddcd7a99..459361c6ba5acbb567ae21bd3ff39c84f2b75c22 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/core/provider_enrolment_details_api.py +++ b/services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/core/provider_enrolment_details_api.py @@ -11,6 +11,7 @@ from .auth_manager import AuthManager from api_provider_management.models.api_provider_enrolment_details import APIProviderEnrolmentDetails # noqa: E501 from .redis_internal_event import RedisInternalEvent +import os class ProviderManagementOperations(Resource): @@ -73,8 +74,7 @@ class ProviderManagementOperations(Resource): res = make_response(object=serialize_clean_camel_case( api_provider_enrolment_details), status=201) - res.headers['Location'] = "/api-provider-management/v1/registrations/" + \ - str(api_provider_enrolment_details.api_prov_dom_id) + res.headers['Location'] = f"https://{os.getenv("CAPIF_HOSTNAME")}/api-provider-management/v1/registrations/{str(api_provider_enrolment_details.api_prov_dom_id)}" return res except Exception as e: diff --git a/services/TS29222_CAPIF_Events_API/capif_events/core/events_apis.py b/services/TS29222_CAPIF_Events_API/capif_events/core/events_apis.py index f0226d0fa230277081026b98d547ce7742c684c6..3555281a625cd073af05c6905feff6637d3b8294 100644 --- a/services/TS29222_CAPIF_Events_API/capif_events/core/events_apis.py +++ b/services/TS29222_CAPIF_Events_API/capif_events/core/events_apis.py @@ -83,7 +83,7 @@ class EventSubscriptionsOperations(Resource): self.auth_manager.add_auth_event(subscription_id, subscriber_id) res = make_response(object=serialize_clean_camel_case(event_subscription), status=201) - res.headers['Location'] = f"http://{os.getenv("CAPIF_HOSTNAME")}/capif-events/v1/{str(subscriber_id)}/subscriptions/{str(subscription_id)}" + res.headers['Location'] = f"https://{os.getenv("CAPIF_HOSTNAME")}/capif-events/v1/{str(subscriber_id)}/subscriptions/{str(subscription_id)}" return res diff --git a/services/TS29222_CAPIF_Logging_API_Invocation_API/api_invocation_logs/core/invocationlogs.py b/services/TS29222_CAPIF_Logging_API_Invocation_API/api_invocation_logs/core/invocationlogs.py index 345076cb1a289b307548cd48174c82af90ac4d1b..92f7c270434ba8fd56e240cf00a27f92a4fc5260 100644 --- a/services/TS29222_CAPIF_Logging_API_Invocation_API/api_invocation_logs/core/invocationlogs.py +++ b/services/TS29222_CAPIF_Logging_API_Invocation_API/api_invocation_logs/core/invocationlogs.py @@ -136,9 +136,8 @@ class LoggingInvocationOperations(Resource): log.api_id: log.api_name for log in invocationlog.logs} current_app.logger.debug(f"Added log entry to apis: {apis_added}") + res.headers['Location'] = f"https://{os.getenv("CAPIF_HOSTNAME")}/api-invocation-logs/v1/{str(aef_id)}/logs/{str(log_id)}" - res.headers['Location'] = "https://{}/api-invocation-logs/v1/{}/logs/{}".format( - os.getenv('CAPIF_HOSTNAME'), str(aef_id), str(log_id)) return res except Exception as e: diff --git a/services/TS29222_CAPIF_Publish_Service_API/published_apis/core/serviceapidescriptions.py b/services/TS29222_CAPIF_Publish_Service_API/published_apis/core/serviceapidescriptions.py index ffc31e59a6df7b2d6b136e445b6d70ae89fc946c..3e42703f28ddcd76105617287249330393e9f1b7 100644 --- a/services/TS29222_CAPIF_Publish_Service_API/published_apis/core/serviceapidescriptions.py +++ b/services/TS29222_CAPIF_Publish_Service_API/published_apis/core/serviceapidescriptions.py @@ -13,6 +13,7 @@ from ..models.service_api_description import ServiceAPIDescription import json from ..encoder import CustomJSONEncoder from ..vendor_specific import add_vend_spec_fields +import os publisher_ops = Publisher() @@ -127,8 +128,7 @@ class PublishServiceOperations(Resource): res = make_response(object=clean_n_camel_case( serviceapidescription_dict), status=201) - res.headers['Location'] = "http://localhost:8080/published-apis/v1/" + \ - str(apf_id) + "/service-apis/" + str(api_id) + res.headers['Location'] = f"https://{os.getenv("CAPIF_HOSTNAME")}/published-apis/v1/{str(apf_id)}/service-apis/{str(api_id)}" if res.status_code == 201: current_app.logger.info("Service published") diff --git a/services/TS29222_CAPIF_Security_API/capif_security/core/servicesecurity.py b/services/TS29222_CAPIF_Security_API/capif_security/core/servicesecurity.py index e4ecc12918709c9ef7e1570e97f8f54b15b87c93..e030457706da6ba06557f906f43b86f309a151e8 100644 --- a/services/TS29222_CAPIF_Security_API/capif_security/core/servicesecurity.py +++ b/services/TS29222_CAPIF_Security_API/capif_security/core/servicesecurity.py @@ -197,8 +197,7 @@ class SecurityOperations(Resource): mycol.insert_one(rec) res = make_response(object=serialize_clean_camel_case(service_security), status=201) - res.headers['Location'] = "https://{}/capif-security/v1/trustedInvokers/{}".format( - os.getenv('CAPIF_HOSTNAME'), str(api_invoker_id)) + res.headers['Location'] = f"https://{os.getenv("CAPIF_HOSTNAME")}/capif-security/v1/trustedInvokers/{str(api_invoker_id)}" return res @@ -356,8 +355,8 @@ class SecurityOperations(Resource): current_app.logger.debug("Updated security context") res= make_response(object=dict_to_camel_case(clean_empty(result)), status=200) - res.headers['Location'] = "https://{}/capif-security/v1/trustedInvokers/{}".format( - os.getenv('CAPIF_HOSTNAME'), str(api_invoker_id)) + res.headers['Location'] = f"https://{os.getenv("CAPIF_HOSTNAME")}/capif-security/v1/trustedInvokers/{str(api_invoker_id)}" + return res except Exception as e: exception = "An exception occurred in update security info" diff --git a/services/docker-compose-capif.yml b/services/docker-compose-capif.yml index 8aa7d02deb7fcf890888c7c703bf16d0b04f9ea3..45de9c32106ec07a38fccf11e3e7794be6f609a6 100644 --- a/services/docker-compose-capif.yml +++ b/services/docker-compose-capif.yml @@ -48,6 +48,7 @@ services: - fluent-bit:host-gateway - otel-collector:host-gateway environment: + - CAPIF_HOSTNAME=${CAPIF_HOSTNAME} - CONTAINER_NAME=access-control-policy - MONITORING=${MONITORING} - LOG_LEVEL=${LOG_LEVEL} @@ -70,6 +71,7 @@ services: - otel-collector:host-gateway - vault:host-gateway environment: + - CAPIF_HOSTNAME=${CAPIF_HOSTNAME} - CONTAINER_NAME=api-invoker-management - MONITORING=${MONITORING} - VAULT_HOSTNAME=vault @@ -96,6 +98,7 @@ services: - vault:host-gateway image: labs.etsi.org:5050/ocf/capif/api-provider-management-api:v2.x.x-release environment: + - CAPIF_HOSTNAME=${CAPIF_HOSTNAME} - CONTAINER_NAME=api-provider-management - MONITORING=${MONITORING} - VAULT_HOSTNAME=vault @@ -120,6 +123,7 @@ services: restart: unless-stopped image: labs.etsi.org:5050/ocf/capif/auditing-api:v2.x.x-release environment: + - CAPIF_HOSTNAME=${CAPIF_HOSTNAME} - CONTAINER_NAME=api-auditing - MONITORING=${MONITORING} - LOG_LEVEL=${LOG_LEVEL} @@ -140,6 +144,7 @@ services: - otel-collector:host-gateway image: labs.etsi.org:5050/ocf/capif/discover-service-api:v2.x.x-release environment: + - CAPIF_HOSTNAME=${CAPIF_HOSTNAME} - CONTAINER_NAME=services-apis - MONITORING=${MONITORING} - LOG_LEVEL=${LOG_LEVEL} @@ -155,6 +160,7 @@ services: - ./TS29222_CAPIF_Events_API:/usr/src/app image: labs.etsi.org:5050/ocf/capif/events-api:v2.x.x-release environment: + - CAPIF_HOSTNAME=${CAPIF_HOSTNAME} - CONTAINER_NAME=api-events - MONITORING=${MONITORING} - LOG_LEVEL=${LOG_LEVEL} @@ -201,6 +207,7 @@ services: - fluent-bit:host-gateway - otel-collector:host-gateway environment: + - CAPIF_HOSTNAME=${CAPIF_HOSTNAME} - CONTAINER_NAME=api-publish-apis - MONITORING=${MONITORING} - LOG_LEVEL=${LOG_LEVEL}