text: import json, subprocess
  from .... pyaz_utils import get_cli_name, get_params
  
  
  def create(hub_name, route_name, source_type, endpoint_name, enabled=None, condition=None, resource_group=None):
      params = get_params(locals())   
      command = "az iot hub route create " + params
      print(command)
      output = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
      stdout =  output.stdout.decode("utf-8")
      stderr = output.stderr.decode("utf-8")
      if stdout:
          return json.loads(stdout)
          print(stdout)
      else:
          raise Exception(stderr)
          print(stderr)  
  
  def show(hub_name, route_name, resource_group=None):
      params = get_params(locals())   
      command = "az iot hub route show " + params
      print(command)
      output = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
      stdout =  output.stdout.decode("utf-8")
      stderr = output.stderr.decode("utf-8")
      if stdout:
          return json.loads(stdout)
          print(stdout)
      else:
          raise Exception(stderr)
          print(stderr)  
  
  def list(hub_name, source_type=None, resource_group=None):
      params = get_params(locals())   
      command = "az iot hub route list " + params
      print(command)
      output = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
      stdout =  output.stdout.decode("utf-8")
      stderr = output.stderr.decode("utf-8")
      if stdout:
          return json.loads(stdout)
          print(stdout)
      else:
          raise Exception(stderr)
          print(stderr)  
  
  def delete(hub_name, route_name=None, source_type=None, resource_group=None):
      params = get_params(locals())   
      command = "az iot hub route delete " + params
      print(command)
      output = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
      stdout =  output.stdout.decode("utf-8")
      stderr = output.stderr.decode("utf-8")
      if stdout:
          return json.loads(stdout)
          print(stdout)
      else:
          raise Exception(stderr)
          print(stderr)  
  
  def update(hub_name, route_name, source_type=None, endpoint_name=None, enabled=None, condition=None, resource_group=None):
      params = get_params(locals())   
      command = "az iot hub route update " + params
      print(command)
      output = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
      stdout =  output.stdout.decode("utf-8")
      stderr = output.stderr.decode("utf-8")
      if stdout:
          return json.loads(stdout)
          print(stdout)
      else:
          raise Exception(stderr)
          print(stderr)  
  
  def test(hub_name, route_name=None, source_type=None, body=None, app_properties=None, system_properties=None, resource_group=None):
      params = get_params(locals())   
      command = "az iot hub route test " + params
      print(command)
      output = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
      stdout =  output.stdout.decode("utf-8")
      stderr = output.stderr.decode("utf-8")
      if stdout:
          return json.loads(stdout)
          print(stdout)
      else:
          raise Exception(stderr)
          print(stderr)  
  