def get_service_details(self, tenant, service): service_base = service.to_dict() service_labels = service_label_repo.get_service_labels(service.service_id) service_domains = domain_repo.get_service_domains(service.service_id) service_tcpdomains = tcp_domain.get_service_tcpdomains(service.service_id) service_events = event_repo.get_specified_num_events(tenant.tenant_id, service.service_id) service_perms = service_perm_repo.get_service_perms_by_service_pk(service.ID) service_probes = probe_repo.get_service_probe(service.service_id) service_source = service_source_repo.get_service_source(tenant.tenant_id, service.service_id) service_auths = auth_repo.get_service_auth(service.service_id) service_env_vars = env_var_repo.get_service_env(tenant.tenant_id, service.service_id) service_compile_env = compile_env_repo.get_service_compile_env(service.service_id) service_extend_method = extend_repo.get_extend_method_by_service(service) image_service_relation = image_service_relation_repo.get_image_service_relation(tenant.tenant_id, service.service_id) service_mnts = mnt_repo.get_service_mnts(tenant.tenant_id, service.service_id) service_plugin_relation = app_plugin_relation_repo.get_service_plugin_relation_by_service_id(service.service_id) service_plugin_config = service_plugin_config_repo.get_service_plugin_all_config(service.service_id) service_relation = dep_relation_repo.get_service_dependencies(tenant.tenant_id, service.service_id) service_volumes = volume_repo.get_service_volumes(service.service_id) service_config_file = volume_repo.get_service_config_files(service.service_id) service_ports = port_repo.get_service_ports(tenant.tenant_id, service.service_id) app_info = { "service_base": service_base, "service_labels": [label.to_dict() for label in service_labels], "service_domains": [domain.to_dict() for domain in service_domains], "service_tcpdomains": [tcpdomain.to_dict() for tcpdomain in service_tcpdomains], "service_events": [event.to_dict() for event in service_events], "service_perms": [perm.to_dict() for perm in service_perms], "service_probes": [probe.to_dict() for probe in service_probes], "service_source": service_source.to_dict() if service_source else None, "service_auths": [auth.to_dict() for auth in service_auths], "service_env_vars": [env_var.to_dict() for env_var in service_env_vars], "service_compile_env": service_compile_env.to_dict() if service_compile_env else None, "service_extend_method": service_extend_method.to_dict() if service_extend_method else None, "image_service_relation": image_service_relation.to_dict() if image_service_relation else None, "service_mnts": [mnt.to_dict() for mnt in service_mnts], "service_plugin_relation": [plugin_relation.to_dict() for plugin_relation in service_plugin_relation], "service_plugin_config": [config.to_dict() for config in service_plugin_config], "service_relation": [relation.to_dict() for relation in service_relation], "service_volumes": [volume.to_dict() for volume in service_volumes], "service_config_file": [config_file.to_dict() for config_file in service_config_file], "service_ports": [port.to_dict() for port in service_ports] } return app_info
def get_service_details(self, tenant, service): service_base = service.to_dict() service_labels = service_label_repo.get_service_labels( service.service_id) service_domains = domain_repo.get_service_domains(service.service_id) http_rule_configs = configuration_repo.list_by_rule_ids( [sd.http_rule_id for sd in service_domains]) service_tcpdomains = tcp_domain.get_service_tcpdomains( service.service_id) service_probes = probe_repo.get_service_probe(service.service_id) service_source = service_source_repo.get_service_source( tenant.tenant_id, service.service_id) service_auths = auth_repo.get_service_auth(service.service_id) service_env_vars = env_var_repo.get_service_env( tenant.tenant_id, service.service_id) service_compile_env = compile_env_repo.get_service_compile_env( service.service_id) service_extend_method = extend_repo.get_extend_method_by_service( service) service_mnts = mnt_repo.get_service_mnts(tenant.tenant_id, service.service_id) service_volumes = volume_repo.get_service_volumes_with_config_file( service.service_id) service_config_file = volume_repo.get_service_config_files( service.service_id) service_ports = port_repo.get_service_ports(tenant.tenant_id, service.service_id) service_relation = dep_relation_repo.get_service_dependencies( tenant.tenant_id, service.service_id) service_monitors = service_monitor_repo.get_component_service_monitors( tenant.tenant_id, service.service_id) component_graphs = component_graph_repo.list(service.service_id) # plugin service_plugin_relation = app_plugin_relation_repo.get_service_plugin_relation_by_service_id( service.service_id) service_plugin_config = service_plugin_config_repo.get_service_plugin_all_config( service.service_id) # third_party_service third_party_service_endpoints = service_endpoints_repo.get_service_endpoints_by_service_id( service.service_id) if service.service_source == "third_party": if not third_party_service_endpoints: raise ServiceHandleException( msg="third party service endpoints can't be null", msg_show="第三方组件实例不可为空") app_info = { "component_id": service.component_id, "service_base": service_base, "service_labels": [label.to_dict() for label in service_labels], "service_domains": [domain.to_dict() for domain in service_domains], "http_rule_configs": [config.to_dict() for config in http_rule_configs], "service_tcpdomains": [tcpdomain.to_dict() for tcpdomain in service_tcpdomains], "service_probes": [probe.to_dict() for probe in service_probes], "service_source": service_source.to_dict() if service_source else None, "service_auths": [auth.to_dict() for auth in service_auths], "service_env_vars": [env_var.to_dict() for env_var in service_env_vars], "service_compile_env": service_compile_env.to_dict() if service_compile_env else None, "service_extend_method": service_extend_method.to_dict() if service_extend_method else None, "service_mnts": [mnt.to_dict() for mnt in service_mnts], "service_plugin_relation": [ plugin_relation.to_dict() for plugin_relation in service_plugin_relation ], "service_plugin_config": [config.to_dict() for config in service_plugin_config], "service_relation": [relation.to_dict() for relation in service_relation], "service_volumes": [volume.to_dict() for volume in service_volumes], "service_config_file": [config_file.to_dict() for config_file in service_config_file], "service_ports": [port.to_dict() for port in service_ports], "third_party_service_endpoints": [endpoint.to_dict() for endpoint in third_party_service_endpoints], "service_monitors": [monitor.to_dict() for monitor in service_monitors], "component_graphs": [graph.to_dict() for graph in component_graphs] } plugin_ids = [pr.plugin_id for pr in service_plugin_relation] return app_info, plugin_ids