Add a tag to a resource.

        Args:
            tag (str): The tag to be added to the resource.
            resource (obj): An instance of tcex resource class.
12426
def stage_tc_create_tag(self, tag, resource):
        
        tag_resource = resource.tags(self.tcex.safetag(tag))
        tag_resource.http_method = 'POST'
        t_response = tag_resource.request()
        if t_response.get('status') != 'Success':
            self.log.warning(
                '[tcex] Failed adding tag "{}" ({}).'.format(tag, t_response.get('response').text)
            )
880016
def tag(self, repository_tag, tags=[]):
        
        if not isinstance(repository_tag, six.string_types):
            raise TypeError('repository_tag must be a string')

        if not isinstance(tags, list):
            raise TypeError('tags must be a list.')

        if ':' in repository_tag:
            repository, tag = repository_tag.split(':')
            tags.append(tag)
        else:
            repository = repository_tag

            if not tags:
                tags.append('latest')

        for tag in tags:
            repo_tag = "{0}:{1}".format(repository, tag)

            if repo_tag not in self.repo_tags:
                logger.info("Tagging Image: {0} Repo Tag: {1}".format(self.identifier, repo_tag))
                self.repo_tags = self.repo_tags + (repo_tag, )

                # always going to force tags until a feature is added to allow users to specify.
                try:
                    self.client.tag(self.id, repository, tag)
                except:
                    self.client.tag(self.id, repository, tag, force=True)
396934
def create_tag(self, name):
        
        return self._tag(self.request('/v2/tags', method='POST', data={
            "name": name,
        })["tag"])
671030
def tag(self, value):
        
        if value is None:
            value = sys.argv[0]
        self._tag = value[:self.MAX_TAG_LEN]
364122
def record_add_tags(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/addTags' % object_id, input_params, always_retry=always_retry, **kwargs)
304639
def tag(self, *tags):
        
        if any([not isinstance(tag, collections.Hashable) for tag in tags]):
            raise TypeError('Every tag should be hashable')

        if not all(isinstance(tag, collections.Hashable) for tag in tags):
            raise TypeError('Tags must be hashable')
        self.tags.update(tags)
        return self
893662
def applet_add_tags(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/addTags' % object_id, input_params, always_retry=always_retry, **kwargs)
62334
def add_tags(self, *tags):
        
        self.tags.extend([
            Tag(name=tag) for tag in tags
        ])
1047459
public void addTag(Tag tag) {
    set(PackageMetadata.TAGS, concat(getTags(), singletonList(tag)));
  }
54957
def update_tag(self, name):
        # The `_tag` is to avoid conflicts with MutableMapping.update.
        
        api = self.doapi_manager
        return api._tag(api.request(self.url, method='PUT',
                                    data={"name": name})["tag"])
589437
def add_tags(jobflow_id, tags)
      params = {
        :operation => 'AddTags',
        :resource_id => jobflow_id,
        :tags => tags
      }
      aws_result = @aws_request.submit(params)
      yield aws_result if block_given?
    end
1062712
def create_tag(self, path, ref='HEAD', message=None, force=False, **kwargs):
        
        return TagReference.create(self, path, ref, message, force, **kwargs)
1283574
def update_tag(self, tag_name, description=None,
                   custom_properties=None, **kwargs):
        
        data = {'description': description or '',
                'customProperties': custom_properties or {}}
        resp = self._put(self._u(self._TAG_ENDPOINT_SUFFIX, tag_name),
                         data=data, **kwargs)
        resp.raise_for_status()
        return resp.json()
175482
def add(self, tag, data=None, indicators=None, **kwargs):
        
        if tag.startswith("00") and (data is None or data == "") and not self.strict:
            return

        if data:
            if indicators:
                raise ValueError(Record.E_NO_INDICATORS)
            if not tag.startswith('00'):
                raise ValueError(Record.E_NO_DATA)
        else:
            if tag.startswith('00'):
                raise ValueError(Record.E_EMPTY)

        if tag.startswith('00') and kwargs:
            raise ValueError(Record.E_NO_SUBFIELDS)

        if indicators is None:
            indicators = [' ', ' ']
        if isinstance(indicators, basestring):
            if len(indicators) == 2:
                indicators = [indicators[0], indicators[1]]
            else:
                raise ValueError(Record.E_INVALID_INDICATOR)

        if data:  # == control field (001 -- 009)
            field = pymarc.Field(tag, data=data)
        else:     # == non-control field (010 -- 999)
            if 'subfields' in kwargs:
                sfs = kwargs['subfields']
                subfields = [v for sl in [(a, b) for a, b in zip(sfs[::2], sfs[1::2]) if b] for v in sl]
            else:
                subfields = []
                for key, value in kwargs.items():
                    if value is None:
                        continue
                    key = key.replace('_', '')
                    if isinstance(value, basestring):
                        if value == "":
                            continue
                        subfields += [key, value]
                    elif isinstance(value, collections.Iterable):
                        for val in value:
                            if not isinstance(val, basestring):
                                raise ValueError('subfield values must be strings')
                            if val:
                                subfields += [key, val]
                    else:
                        raise ValueError('subfield values must be strings')

            if not any(subfields[1::2]):
                if self.strict:
                    raise ValueError('none of the subfields contains a value')
                else:
                    return

            field = pymarc.Field(tag, indicators, subfields=subfields)
        self.add_field(field)
420752
def add_tag(self, new_tags):
        

        tags = self.get_tags()
        orig_tag_cnt = len(tags)
        # print("self.get_tags() {}".format(tags))

        if isinstance(new_tags, six.string_types):
            new_tags = new_tags.split(',')
            # print("spliting tags :: {}".format(new_tags))

        for tag in new_tags:
            if not tag in tags:
                tags.append(tag.strip())

        if len(tags) > orig_tag_cnt:
            xml_tags = escape(",".join(tags))
            post_data = TAGS_TEMPLATE.format(connectware_id=self.get_connectware_id(),
                                             tags=xml_tags)
            self._conn.put('/ws/DeviceCore', post_data)

            # Invalidate cache
            self._device_json = None
279215
def tag(request, tag_id=None):
    
    html = get_tag_html(tag_id)
    t = template.Template(html)
    c = template.RequestContext(request)

    return HttpResponse(t.render(c))
614035
def add_tags(self, **kwargs):
        
        j, _ = self.datacenter.request('POST', self.path + '/tags', 
            data=kwargs)
        return j