Loading src/open_exposure_gateway/adapters/http/srm_client.py +3 −2 Changes for src/open_exposure_gateway/adapters/http/srm_client.py: 3 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -235,12 +235,13 @@ class SRMClient: async def get_app_instances( self, app_provider_id: str, app_id: UUID | None = None, app_instance_id: UUID | None = None, region: str | None = None, x_correlator: str | None = None, ) -> list[SRMServiceInstance]: params: dict[str, Any] = {} params: dict[str, Any] = {"app_provider_id": app_provider_id} if app_id is not None: params["service_specification_id"] = str(app_id) if app_instance_id is not None: Loading @@ -249,7 +250,7 @@ class SRMClient: params["region"] = region headers = {"x-correlator": x_correlator} if x_correlator else None data = await self._request( "GET", "/internal/service-instances", params=params or None, headers=headers "GET", "/internal/service-instances", params=params, headers=headers ) return [SRMServiceInstance.model_validate(i) for i in data] Loading src/open_exposure_gateway/api/camara/edge_application_management/v0_1_0_alpha_1/router.py +2 −0 Changes for src/open_exposure_gateway/api/camara/edge_application_management/v0_1_0_alpha_1/router.py: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -264,6 +264,7 @@ async def get_app_instances( region: Annotated[Optional[str], Query(max_length=64)] = None, ) -> Any: return await service.get_app_instances( app_provider_id=caller.app_provider_id, app_id=appId, app_instance_id=appInstanceId, region=region, Loading Loading @@ -352,6 +353,7 @@ async def get_app_deployments( appDeploymentId: Annotated[Optional[CamaraUuid], Query()] = None, ) -> Any: return await service.get_app_deployments( app_provider_id=caller.app_provider_id, app_id=appId, app_deployment_id=appDeploymentId, x_correlator=caller.x_correlator, Loading src/open_exposure_gateway/application/services/edge_application_management_service.py +8 −0 Changes for src/open_exposure_gateway/application/services/edge_application_management_service.py: 8 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -729,6 +729,7 @@ class EdgeApplicationManagementService: async def get_app_deployments( self, app_provider_id: str, app_id: Optional[UUID] = None, app_deployment_id: Optional[UUID] = None, x_correlator: Optional[str] = None, Loading @@ -737,6 +738,8 @@ class EdgeApplicationManagementService: raise RuntimeError("AppRegistrationRepository is not available") if self._app_deployment_repo is None or self._app_instance_repo is None: raise RuntimeError("AppDeployment/AppInstance repositories are not available") if self._operation_repo is None: raise RuntimeError("OperationRepository is not available") resolved_app_registration_id: Optional[UUID] = None if app_id is not None: Loading Loading @@ -772,6 +775,9 @@ class EdgeApplicationManagementService: continue if len(result) == _MAX_APP_DEPLOYMENTS_PER_RESPONSE: break deploy_operation = await self._operation_repo.get_by_id(deployment.operation_id) if deploy_operation is None or deploy_operation.app_provider_id != app_provider_id: continue if deployment.app_registration_id not in app_id_cache: owner = await self._app_registration_repo.get_by_id(deployment.app_registration_id) app_id_cache[deployment.app_registration_id] = owner.app_id if owner else None Loading Loading @@ -920,6 +926,7 @@ class EdgeApplicationManagementService: async def get_app_instances( self, app_provider_id: str, app_id: Optional[UUID] = None, app_instance_id: Optional[UUID] = None, region: Optional[str] = None, Loading @@ -935,6 +942,7 @@ class EdgeApplicationManagementService: resolved_app_id = app_registration.app_registration_id instances = await self.srm_client.get_app_instances( app_provider_id=app_provider_id, app_id=resolved_app_id, app_instance_id=app_instance_id, region=region, Loading src/open_exposure_gateway/ports/srm_port.py +1 −0 Changes for src/open_exposure_gateway/ports/srm_port.py: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ class SRMClientPort(Protocol): async def get_app_instances( self, app_provider_id: str, app_id: UUID | None, app_instance_id: UUID | None, region: str | None, Loading tests/unit/fakes.py +2 −1 Changes for tests/unit/fakes.py: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -180,12 +180,13 @@ class FakeSRMClient: async def get_app_instances( self, app_provider_id: str, app_id: UUID | None = None, app_instance_id: UUID | None = None, region: str | None = None, x_correlator: str | None = None, ) -> list[SRMServiceInstance]: result = list(self.instances.values()) result = [i for i in self.instances.values() if i.app_provider_id == app_provider_id] if app_id is not None: result = [i for i in result if i.service_specification_id == str(app_id)] if app_instance_id is not None: Loading Loading
src/open_exposure_gateway/adapters/http/srm_client.py +3 −2 Changes for src/open_exposure_gateway/adapters/http/srm_client.py: 3 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -235,12 +235,13 @@ class SRMClient: async def get_app_instances( self, app_provider_id: str, app_id: UUID | None = None, app_instance_id: UUID | None = None, region: str | None = None, x_correlator: str | None = None, ) -> list[SRMServiceInstance]: params: dict[str, Any] = {} params: dict[str, Any] = {"app_provider_id": app_provider_id} if app_id is not None: params["service_specification_id"] = str(app_id) if app_instance_id is not None: Loading @@ -249,7 +250,7 @@ class SRMClient: params["region"] = region headers = {"x-correlator": x_correlator} if x_correlator else None data = await self._request( "GET", "/internal/service-instances", params=params or None, headers=headers "GET", "/internal/service-instances", params=params, headers=headers ) return [SRMServiceInstance.model_validate(i) for i in data] Loading
src/open_exposure_gateway/api/camara/edge_application_management/v0_1_0_alpha_1/router.py +2 −0 Changes for src/open_exposure_gateway/api/camara/edge_application_management/v0_1_0_alpha_1/router.py: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -264,6 +264,7 @@ async def get_app_instances( region: Annotated[Optional[str], Query(max_length=64)] = None, ) -> Any: return await service.get_app_instances( app_provider_id=caller.app_provider_id, app_id=appId, app_instance_id=appInstanceId, region=region, Loading Loading @@ -352,6 +353,7 @@ async def get_app_deployments( appDeploymentId: Annotated[Optional[CamaraUuid], Query()] = None, ) -> Any: return await service.get_app_deployments( app_provider_id=caller.app_provider_id, app_id=appId, app_deployment_id=appDeploymentId, x_correlator=caller.x_correlator, Loading
src/open_exposure_gateway/application/services/edge_application_management_service.py +8 −0 Changes for src/open_exposure_gateway/application/services/edge_application_management_service.py: 8 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -729,6 +729,7 @@ class EdgeApplicationManagementService: async def get_app_deployments( self, app_provider_id: str, app_id: Optional[UUID] = None, app_deployment_id: Optional[UUID] = None, x_correlator: Optional[str] = None, Loading @@ -737,6 +738,8 @@ class EdgeApplicationManagementService: raise RuntimeError("AppRegistrationRepository is not available") if self._app_deployment_repo is None or self._app_instance_repo is None: raise RuntimeError("AppDeployment/AppInstance repositories are not available") if self._operation_repo is None: raise RuntimeError("OperationRepository is not available") resolved_app_registration_id: Optional[UUID] = None if app_id is not None: Loading Loading @@ -772,6 +775,9 @@ class EdgeApplicationManagementService: continue if len(result) == _MAX_APP_DEPLOYMENTS_PER_RESPONSE: break deploy_operation = await self._operation_repo.get_by_id(deployment.operation_id) if deploy_operation is None or deploy_operation.app_provider_id != app_provider_id: continue if deployment.app_registration_id not in app_id_cache: owner = await self._app_registration_repo.get_by_id(deployment.app_registration_id) app_id_cache[deployment.app_registration_id] = owner.app_id if owner else None Loading Loading @@ -920,6 +926,7 @@ class EdgeApplicationManagementService: async def get_app_instances( self, app_provider_id: str, app_id: Optional[UUID] = None, app_instance_id: Optional[UUID] = None, region: Optional[str] = None, Loading @@ -935,6 +942,7 @@ class EdgeApplicationManagementService: resolved_app_id = app_registration.app_registration_id instances = await self.srm_client.get_app_instances( app_provider_id=app_provider_id, app_id=resolved_app_id, app_instance_id=app_instance_id, region=region, Loading
src/open_exposure_gateway/ports/srm_port.py +1 −0 Changes for src/open_exposure_gateway/ports/srm_port.py: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ class SRMClientPort(Protocol): async def get_app_instances( self, app_provider_id: str, app_id: UUID | None, app_instance_id: UUID | None, region: str | None, Loading
tests/unit/fakes.py +2 −1 Changes for tests/unit/fakes.py: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -180,12 +180,13 @@ class FakeSRMClient: async def get_app_instances( self, app_provider_id: str, app_id: UUID | None = None, app_instance_id: UUID | None = None, region: str | None = None, x_correlator: str | None = None, ) -> list[SRMServiceInstance]: result = list(self.instances.values()) result = [i for i in self.instances.values() if i.app_provider_id == app_provider_id] if app_id is not None: result = [i for i in result if i.service_specification_id == str(app_id)] if app_instance_id is not None: Loading