// TagID calculates Tag entity ID (SHA1 digest) from the given tag.
//
// Panics if the tag is invalid.
437334
func TagID(t *api.Tag) string {
	tag := common.JoinInstanceTag(t)
	if err := common.ValidateInstanceTag(tag); err != nil {
		panic(err)
	}
	digest := sha1.Sum([]byte(tag))
	return hex.EncodeToString(digest[:])
}
636062
func API2ID(tagStr string) (string, error) {
	if tagStr == "" {
		return tagStr, nil
	}
	tag, err := names.ParsePayloadTag(tagStr)
	if err != nil {
		return "", errors.Trace(err)
	}
	return tag.Id(), nil
}
1219272
func (i *Image) TagLayerID(tagName string) (string, error) {
	layerID, ok := i.tags[tagName]
	if !ok {
		return "", fmt.Errorf("can't find tag '%s' for image '%s'", tagName, i.Name)
	}

	return layerID, nil
}
1259237
func (s *PutScriptService) Id(id string) *PutScriptService {
	s.id = id
	return s
}
1190612
func (s *SliceQuery) Id(id int) *SliceQuery {
	s.id = &id
	return s
}
47189
func (tracker *issueTracker) StoryTagToReadableStoryId(tag string) (storyId string, err error) {
	// The format is owner/repo#issueNum
	re := regexp.MustCompile("^[^/]+/[^#]+(#[0-9]+)$")
	match := re.FindStringSubmatch(tag)
	if len(match) == 0 {
		return "", fmt.Errorf("invalid GitHub issue tag: %v", tag)
	}
	return match[1], nil
}
905383
func (s *ClusterStatsService) NodeId(nodeId []string) *ClusterStatsService {
	s.nodeId = nodeId
	return s
}
1032663
func docId(metadata *Metadata) string {
	return fmt.Sprintf("%s-%s-%s-%s", metadata.ModelUUID, metadata.Kind, metadata.Series, metadata.Arch)
}
87158
func (i *RelationInfo) EntityId() EntityId {
	return EntityId{
		Kind:      "relation",
		ModelUUID: i.ModelUUID,
		Id:        i.Key,
	}
}
39314
func (s *PutTemplateService) Id(id string) *PutTemplateService {
	s.id = id
	return s
}
650986
func ById(id string) Matcher {
	return func(node *html.Node) bool { return Attr(node, "id") == id }
}
81008
func (s *UIServerAPI) ChainId() math.HexOrDecimal64 {
	return (math.HexOrDecimal64)(s.extApi.chainID.Uint64())
}
840665
func (s *NodesStatsService) NodeId(nodeId ...string) *NodesStatsService {
	s.nodeId = append(s.nodeId, nodeId...)
	return s
}
1157323
func (serv *v2MetadataService) TagAndAdd(diffID layer.DiffID, hmacKey []byte, meta V2Metadata) error {
	meta.HMAC = ComputeV2MetadataHMAC(hmacKey, &meta)
	return serv.Add(diffID, meta)
}
169544
func HashtagIsValid(hashtag string) bool {
	if hashtag == "" {
		return false
	}

	extracted := extract.ExtractHashtags(hashtag)
	return len(extracted) == 1 && extracted[0].Text == hashtag
}
594471
func (a *Annotator) Tag(tags ...TagValueGenerator) *Annotator {
	if a == nil {
		return a
	}
	tagMap := make(map[TagKey]interface{}, len(tags))
	for _, t := range tags {
		v := t.GenerateErrorTagValue()
		tagMap[v.Key] = v.Value
	}
	if len(tagMap) > 0 {
		if a.ctx.tags == nil {
			a.ctx.tags = tagMap
		} else {
			for k, v := range tagMap {
				a.ctx.tags[k] = v
			}
		}
	}
	return a
}
772330
func (s *AssociateTagOptionWithResourceInput) SetTagOptionId(v string) *AssociateTagOptionWithResourceInput {
	s.TagOptionId = &v
	return s
}