def _api_method_to_info(): """ Returns a dictionary mapping each API method to a tuple (path, HTTP method)""" service_methods = MlflowService.DESCRIPTOR.methods res = {} for service_method in service_methods: endpoints = service_method.GetOptions().Extensions[databricks_pb2.rpc].endpoints endpoint = endpoints[0] endpoint_path = _get_path(endpoint.path) res[MlflowService().GetRequestClass(service_method)] = (endpoint_path, endpoint.method) return res
def get_endpoints(): """ :return: List of tuples (path, handler, methods) """ service_methods = MlflowService.DESCRIPTOR.methods ret = [] for service_method in service_methods: endpoints = service_method.GetOptions().Extensions[databricks_pb2.rpc].endpoints for endpoint in endpoints: for http_path in _get_paths(endpoint.path): handler = get_handler(MlflowService().GetRequestClass(service_method)) ret.append((http_path, handler, [endpoint.method])) return ret