def _get_applications(self) -> Applications: try: return eureka_client.get_applications(self.config.registrar_url) # TODO: add custom eureka not found error except URLError: log.error("no eureka instance is running at: %s", self.config.registrar_url) exit(1)
def get_eureka_apps(self): apps_list = {} for app in eureka_client.get_applications( eureka_server=self.host).applications: for instance in app.up_instances: app_name = str(instance.app.lower()) if app_name not in apps_list: apps_list[app_name] = [] apps_list[app_name].append({ "ipAddr": str(instance.ipAddr), "port": str(instance.port.port), "securePort": str(instance.securePort.port), "app": app_name, "metadata": instance.metadata, "homePageUrl": str(instance.homePageUrl), "healthCheckUrl": str(instance.healthCheckUrl), "statusPageUrl": str(instance.statusPageUrl) }) return apps_list
def get_apps(self): apps_list = [] print("Getting apps from eureka server " + self.host + ". \n") for app in eureka_client.get_applications(eureka_server=self.host).applications: for instance in app.up_instances: # print(instance.app) apps_list.append(instance.hostName) return apps_list
def get_apps(self): apps_list = [] print(f"Getting apps from eureka server {self.host} ... \n") for app in eureka_client.get_applications( eureka_server=f"{self.host}").applications: for instance in app.up_instances: # print(instance.app) apps_list.append(instance) return apps_list
def get_applications(eureka_hosts="127.0.0.1", eureka_client=None): """ 从eureka获取所有服务 :param eureka_hosts: eureka地址 :param eureka_client: eureka客户端 :return: list """ apps = eureka_client.get_applications(eureka_hosts) return apps.applications
def get_apps(self): apps_list = [] print("Getting apps from eureka server {} ... \n".format(self.host)) for app in eureka_client.get_applications( eureka_server=self.host).applications: for instance in app.up_instances: apps_list.append({ "ip": str(instance.ipAddr), "port": str(instance.port.port), "app": str(instance.app.lower()), "homePageUrl": str(instance.homePageUrl), "healthCheckUrl": str(instance.healthCheckUrl), "statusPageUrl": str(instance.statusPageUrl) }) return apps_list
def _get_applications(self) -> Applications: applications = super()._get_applications() try: resolver_applications = eureka_client.get_applications( cast(RestGatewayServiceConfig, self.config).resolver_url ) # TODO: add custom eureka not found error except URLError: log.error( "no eureka instance is running at: %s", cast(RestGatewayServiceConfig, self.config).resolver_url, ) exit(1) gateway_prefix = self.config.name.split(".")[0] for application in resolver_applications.applications: application.instances[ 0 ].app = f"{gateway_prefix}.{application.instances[0].app}" # application.name = "CR" + application.name applications.add_application(application) return applications
def get_applications(eureka_hosts="127.0.0.1", eureka_client=None): apps = eureka_client.get_applications(eureka_hosts) return apps.applications