docs: def agent_service_register(consul_url=None, token=None, **kwargs):
      '''
      The used to add a new service, with an optional
      health check, to the local agent.
  
      :param consul_url: The Consul server URL.
      :param name: A name describing the service.
      :param address: The address used by the service, defaults
                      to the address of the agent.
      :param port: The port used by the service.
      :param id: Unique ID to identify the service, if not
                 provided the value of the name parameter is used.
      :param tags: Identifying tags for service, string or list.
      :param script: If script is provided, the check type is
                     a script, and Consul will evaluate that script
                     based on the interval parameter.
      :param http: Check will perform an HTTP GET request against
                   the value of HTTP (expected to be a URL) based
                   on the interval parameter.
      :param check_ttl: If a TTL type is used, then the TTL update
                        endpoint must be used periodically to update
                        the state of the check.
      :param check_interval: Interval at which the check should run.
      :return: Boolean and message indicating success or failure.
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' consul.agent_service_register name='redis' tags='["master", "v1"]' address="127.0.0.1" port="8080" check_script="/usr/local/bin/check_redis.py" interval="10s"
  
      '''
      ret = {}
      data = {}
      if not consul_url:
          consul_url = _get_config()
          if not consul_url:
              log.error('No Consul URL found.')
              ret['message'] = 'No Consul URL found.'
              ret['res'] = False
              return ret
  
      lc_kwargs = dict()
      for k, v in six.iteritems(kwargs):
          lc_kwargs[k.lower()] = v
  
      if 'name' in lc_kwargs:
          data['Name'] = lc_kwargs['name']
      else:
          raise SaltInvocationError('Required argument "name" is missing.')
  
      if 'address' in lc_kwargs:
          data['Address'] = lc_kwargs['address']
  
      if 'port' in lc_kwargs:
          data['Port'] = lc_kwargs['port']
  
      if 'id' in lc_kwargs:
          data['ID'] = lc_kwargs['id']
  
      if 'tags' in lc_kwargs:
          _tags = lc_kwargs['tags']
          if not isinstance(_tags, list):
              _tags = [_tags]
          data['Tags'] = _tags
  
      if 'enabletagoverride' in lc_kwargs:
          data['EnableTagOverride'] = lc_kwargs['enabletagoverride']
  
      if 'check' in lc_kwargs:
          dd = dict()
          for k, v in six.iteritems(lc_kwargs['check']):
              dd[k.lower()] = v
          interval_required = False
          check_dd = dict()
  
          if 'script' in dd:
              interval_required = True
              check_dd['Script'] = dd['script']
          if 'http' in dd:
              interval_required = True
              check_dd['HTTP'] = dd['http']
          if 'ttl' in dd:
              check_dd['TTL'] = dd['ttl']
          if 'interval' in dd:
              check_dd['Interval'] = dd['interval']
  
          if interval_required:
              if 'Interval' not in check_dd:
                  ret['message'] = 'Required parameter "interval" is missing.'
                  ret['res'] = False
                  return ret
          else:
              if 'Interval' in check_dd:
                  del check_dd['Interval']  # not required, so ignore it
  
          if check_dd > 0:
              data['Check'] = check_dd  # if empty, ignore it
  
      function = 'agent/service/register'
      res = _query(consul_url=consul_url,
                   function=function,
                   token=token,
                   method='PUT',
                   data=data)
      if res['res']:
          ret['res'] = True
          ret['message'] = 'Service {0} registered on agent.'.format(kwargs['name'])
      else:
          ret['res'] = False
          ret['message'] = 'Unable to register service {0}.'.format(kwargs['name'])
      return ret