Loading services/TS29222_CAPIF_Publish_Service_API/published_apis/core/serviceapidescriptions.py +29 −9 Original line number Diff line number Diff line Loading @@ -200,8 +200,18 @@ class PublishServiceOperations(Resource): "Removing api service with id: " + service_api_id) my_query = {'apf_id': apf_id, 'api_id': service_api_id} serviceapidescription_dict = mycol.find_one( my_query, {"_id": 0, "onboarding_date": 0, "apf_id": 0}) serviceapidescription_dict = mycol.find_one(my_query, {"_id": 0, "api_name": 1, "api_id": 1, "aef_profiles": 1, "description": 1, "supported_features": 1, "shareable_info": 1, "service_api_category": 1, "api_supp_feats": 1, "pub_api_path": 1, "ccf_id": 1, "api_status": 1}) if serviceapidescription_dict is None: current_app.logger.error(service_api_not_found_message) Loading @@ -219,12 +229,19 @@ class PublishServiceOperations(Resource): serviceapidescription = clean_empty( dict_to_camel_case(serviceapidescription_dict)) if res.status_code == 204: current_app.logger.info("Service unavailable") current_app.logger.debug("Checking if SERVICE_API_UNAVAILABLE event must be notified") event_to_send = self.service_api_availability_event( clean_n_camel_case( serviceapidescription_dict)) if event_to_send != "SERVICE_API_UNAVAILABLE": current_app.logger.info("Send SERVICE_API_UNAVAILABLE event") RedisEvent( "SERVICE_API_UNAVAILABLE", service_api_descriptions=[serviceapidescription], api_ids=[str(service_api_id)] ).send_event() else: current_app.logger.info("Not send SERVICE_API_UNAVAILABLE because this Service API was unavailable previously") return res Loading Loading @@ -257,7 +274,8 @@ class PublishServiceOperations(Resource): "pub_api_path": 1, "ccf_id": 1, "apf_id":1, "onboarding_date": 1}) "onboarding_date": 1, "api_status": 1}) if serviceapidescription_old is None: current_app.logger.error(service_api_not_found_message) return not_found_error(detail="Service API not existing", cause="Service API id not found") Loading Loading @@ -414,8 +432,10 @@ class PublishServiceOperations(Resource): current_app.logger.debug("Send Events if needed") service_api_status_event_old = self.service_api_availability_event( service_api_description_old) current_app.logger.debug("Service API status before update is " + service_api_status_event_old) service_api_status_event_new = self.service_api_availability_event( service_api_description_new) current_app.logger.debug("Service API status after update is " + service_api_status_event_new) if service_api_status_event_old == service_api_status_event_new: current_app.logger.info( Loading Loading
services/TS29222_CAPIF_Publish_Service_API/published_apis/core/serviceapidescriptions.py +29 −9 Original line number Diff line number Diff line Loading @@ -200,8 +200,18 @@ class PublishServiceOperations(Resource): "Removing api service with id: " + service_api_id) my_query = {'apf_id': apf_id, 'api_id': service_api_id} serviceapidescription_dict = mycol.find_one( my_query, {"_id": 0, "onboarding_date": 0, "apf_id": 0}) serviceapidescription_dict = mycol.find_one(my_query, {"_id": 0, "api_name": 1, "api_id": 1, "aef_profiles": 1, "description": 1, "supported_features": 1, "shareable_info": 1, "service_api_category": 1, "api_supp_feats": 1, "pub_api_path": 1, "ccf_id": 1, "api_status": 1}) if serviceapidescription_dict is None: current_app.logger.error(service_api_not_found_message) Loading @@ -219,12 +229,19 @@ class PublishServiceOperations(Resource): serviceapidescription = clean_empty( dict_to_camel_case(serviceapidescription_dict)) if res.status_code == 204: current_app.logger.info("Service unavailable") current_app.logger.debug("Checking if SERVICE_API_UNAVAILABLE event must be notified") event_to_send = self.service_api_availability_event( clean_n_camel_case( serviceapidescription_dict)) if event_to_send != "SERVICE_API_UNAVAILABLE": current_app.logger.info("Send SERVICE_API_UNAVAILABLE event") RedisEvent( "SERVICE_API_UNAVAILABLE", service_api_descriptions=[serviceapidescription], api_ids=[str(service_api_id)] ).send_event() else: current_app.logger.info("Not send SERVICE_API_UNAVAILABLE because this Service API was unavailable previously") return res Loading Loading @@ -257,7 +274,8 @@ class PublishServiceOperations(Resource): "pub_api_path": 1, "ccf_id": 1, "apf_id":1, "onboarding_date": 1}) "onboarding_date": 1, "api_status": 1}) if serviceapidescription_old is None: current_app.logger.error(service_api_not_found_message) return not_found_error(detail="Service API not existing", cause="Service API id not found") Loading Loading @@ -414,8 +432,10 @@ class PublishServiceOperations(Resource): current_app.logger.debug("Send Events if needed") service_api_status_event_old = self.service_api_availability_event( service_api_description_old) current_app.logger.debug("Service API status before update is " + service_api_status_event_old) service_api_status_event_new = self.service_api_availability_event( service_api_description_new) current_app.logger.debug("Service API status after update is " + service_api_status_event_new) if service_api_status_event_old == service_api_status_event_new: current_app.logger.info( Loading