Add user tags via rabbitmqctl set_user_tags

    CLI Example:

    .. code-block:: bash

        salt '*' rabbitmq.set_user_tags myadmin administrator
773435
def set_user_tags(name, tags, runas=None):
    '''
    '''
    if runas is None and not salt.utils.platform.is_windows():
        runas = salt.utils.user.get_user()

    if not isinstance(tags, (list, tuple)):
        tags = [tags]

    res = __salt__['cmd.run_all'](
        [RABBITMQCTL, 'set_user_tags', name] + list(tags),
        reset_system_locale=False,
        runas=runas,
        python_shell=False)
    msg = "Tag(s) set"
    return _format_response(res, msg)
1279470
def list_users(self):
        
        lines = output_lines(self.exec_rabbitmqctl_list('users'))
        return [_parse_rabbitmq_user(line) for line in lines]
190733
def set_tags(tags)
      return unless tags.is_a?(Hash)
      tags.each do |k,v|
        set_tag(k, v)
      end
      self
    end
441126
def add_tags(host)
      host[:host_tags].merge(
          'beaker_version'    => Beaker::Version::STRING,
          'jenkins_build_url' => @options[:jenkins_build_url],
          'department'        => @options[:department],
          'project'           => @options[:project],
          'created_by'        => @options[:created_by],
          'name'              => host.name,
          'roles'             => host.host_hash[:roles].join(', ')
      )
    end
335864
def add_tags(self, *tags):
        '''
        
        '''
        normed_tags = self.api.manager._normalize_tags(tags)
        self.api.manager.add_tags(self.archive_name, normed_tags)
161079
def user_modify(attribs)
      defaults = {user_name: "!", min_bal: "!",
                  email: "!", dept_name: "!", pimary_pin: "!",
                  secondary_pin: "!", quota: "!", alternate_pin: "!",
                  home_server: "!", locked: "!", location: "!",
                  default_bc: "!", additional_info: "!", home_folder: "!"}
      attribs = defaults.merge(attribs)
      attribs = check_atrribs(attribs)
      "modify ur #{attribs[:user_id]} \"#{attribs[:user_name]}\"" +
      " #{attribs[:min_bal]} #{attribs[:email]} #{attribs[:dept_name]}" +
      " #{attribs[:primary_pin]} #{attribs[:secondary_pin]}" +
      " #{attribs[:quota]} #{attribs[:alternate_pin]}" +
      " #{attribs[:home_server]} #{attribs[:locked]}" +
      " #{attribs[:location]} #{attribs[:default_bc]}" +
      " #{attribs[:additional_info]} #{attribs[:home_folder]}"
    end
599673
def add_tags(self):
        """"""
        if self.tags is None:
            self.tags = VCFLACDict()
            self.metadata_blocks.append(self.tags)
        else:
            raise FLACVorbisError("a Vorbis comment already exists")
345505
def workflow_add_tags(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/addTags' % object_id, input_params, always_retry=always_retry, **kwargs)
536695
def job_add_tags(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/addTags' % object_id, input_params, always_retry=always_retry, **kwargs)
737731
def main():
    """"""
    mod_choices = ('banned', 'contributor', 'moderator')
    mod_choices_dsp = ', '.join(['`{}`'.format(x) for x in mod_choices])
    msg = {
        'add': ('Add users to one of the following categories: {}'
                .format(mod_choices_dsp)),
        'clear': 'Remove users who have no flair set.',
        'css': 'Ignore the CSS field when synchronizing flair.',
        'edit': 'When adding flair templates, mark them as editable.',
        'file': 'The file containing contents for --message',
        'flair': 'List flair for the subreddit.',
        'flair_stats': 'Display the number of users with each flair.',
        'json': 'Output the results as json. Applies to --flair',
        'limit': ('The minimum number of users that must have the specified '
                  'flair in order to add as a template. default: %default'),
        'list': ('List the users in one of the following categories: '
                 '{}. May be specified more than once.'
                 .format(mod_choices_dsp)),
        'msg': ('Send message to users of one of the following categories: '
                '{}. Message subject provided via --subject, content provided '
                'via --file or STDIN.').format(mod_choices_dsp),
        'sort': ('The order to add flair templates. Available options are '
                 '`alpha` to add alphabetically, and `size` to first add '
                 'flair that is shared by the most number of users. '
                 'default: %default'),
        'static': ('Add this template when syncing flair templates. When '
                   'syncing text and css use a comma to separate the two.'),
        'subject': 'The subject of the message to send for --message.',
        'sync': 'Synchronize flair templates with current user flair.',
        'text': 'Ignore the text field when synchronizing flair.'}

    usage = 'Usage: %prog [options] SUBREDDIT'
    parser = arg_parser(usage=usage)
    parser.add_option('-a', '--add', help=msg['add'])
    parser.add_option('-l', '--list', action='append', help=msg['list'],
                      choices=mod_choices, metavar='CATEGORY', default=[])
    parser.add_option('-c', '--clear-empty', action='store_true',
                      help=msg['clear'])
    parser.add_option('-F', '--file', help=msg['file'])
    parser.add_option('-f', '--flair', action='store_true', help=msg['flair'])
    parser.add_option('', '--flair-stats', action='store_true',
                      help=msg['flair_stats'])
    parser.add_option('-m', '--message', choices=mod_choices, help=msg['msg'])
    parser.add_option('', '--subject', help=msg['subject'])

    group = OptionGroup(parser, 'Format options')
    group.add_option('-j', '--json', action='store_true', help=msg['json'])
    parser.add_option_group(group)

    group = OptionGroup(parser, 'Sync options')
    group.add_option('', '--sync', action='store_true', help=msg['sync'])
    group.add_option('-s', '--static', action='append', help=msg['static'])
    group.add_option('', '--editable', action='store_true', help=msg['edit'])
    group.add_option('', '--ignore-css', action='store_true',
                     default=False, help=msg['css'])
    group.add_option('', '--ignore-text', action='store_true',
                     default=False, help=msg['text'])
    group.add_option('', '--limit', type='int', help=msg['limit'], default=2)
    group.add_option('', '--sort', action='store', choices=('alpha', 'size'),
                     default='alpha', help=msg['sort'])
    parser.add_option_group(group)

    options, args = parser.parse_args()
    if len(args) == 0:
        parser.error('Must provide subreddit name.')
    if options.message and not options.subject:
        parser.error('Must provide --subject when providing --message.')
    subreddit = args[0]

    check_for_updates(options)

    modutils = ModUtils(subreddit, options.site, options.verbose)

    if options.add:
        modutils.add_users(options.add)
    if options.clear_empty:
        modutils.clear_empty()
    for category in options.list:
        modutils.output_list(category)
    if options.flair:
        modutils.output_current_flair(as_json=options.json)
    if options.flair_stats:
        modutils.output_flair_stats()
    if options.sync:
        modutils.flair_template_sync(editable=options.editable,
                                     limit=options.limit,
                                     static=options.static, sort=options.sort,
                                     use_css=not options.ignore_css,
                                     use_text=not options.ignore_text)
    if options.message:
        modutils.message(options.message, options.subject, options.file)
414316
public void tagUsers(int tagId, List<String> openIds){
        Map<String, Object> map = new HashMap<>();
        map.put("tagid", tagId);
        map.put("openid_list", openIds);
        String url = WxEndpoint.get("url.tag.user.tag");
        logger.debug("add tag for users: {}", JsonMapper.defaultMapper().toJson(map));
        wxClient.post(url, JsonMapper.defaultMapper().toJson(map));
    }
1009966
def AddClusterTags(r, tags, dry_run=False):
    

    query = {
        "dry-run": dry_run,
        "tag": tags,
    }

    return r.request("put", "/2/tags", query=query)
46227
def add_tag(tag_name, timeout)
      cmd = { :name => :add_tag, :tag => tag_name }
      response = blocking_request(cmd, timeout)
      result = OperationResult.from_results(load(response, "Unexpected response #{response.inspect}"))
      if result.success?
        ::Chef::Log.info("Successfully added tag #{tag_name}")
      else
        raise TagError.new("Add tag failed: #{result.content}")
      end
      true
    end
336764
def tag_add(package, tag, pkghash):
    
    team, owner, pkg = parse_package(package)
    session = _get_session(team)

    session.put(
        "{url}/api/tag/{owner}/{pkg}/{tag}".format(
            url=get_registry_url(team),
            owner=owner,
            pkg=pkg,
            tag=tag
        ),
        data=json.dumps(dict(
            hash=_match_hash(package, pkghash)
        ))
    )
447748
def file_add_tags(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/addTags' % object_id, input_params, always_retry=always_retry, **kwargs)
608221
def user_tags(self, id, **kwargs):
        ""
        api_path = "/api/v2/users/{id}/tags.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
1119608
def set_tag(key, value)
      if custom?
        @data[:data][:sdk][:custom] ||= {}
        @data[:data][:sdk][:custom][:tags] ||= {}
        @data[:data][:sdk][:custom][:tags][key] = value

        if key.to_sym == :'span.kind'
          case value.to_sym
          when :server || :consumer
            @data[:data][:sdk][:type] = :entry
          when :client || :producer
            @data[:data][:sdk][:type] = :exit
          end
        end
      else
        if !@data[:data].key?(key)
          @data[:data][key] = value
        elsif value.is_a?(Hash) && self[:data][key].is_a?(Hash)
          @data[:data][key].merge!(value)
        else
          @data[:data][key] = value
        end
      end
      self
    end