// GetTagsForToken
198385
func (a postgres) GetTagsForToken(token string) ([]string, error) {

	rows, err := a.query("SELECT tag FROM tags INNER JOIN tokens ON (tags.token_id = tokens.token_id) WHERE token = $1", token)
	if err != nil {
		return nil, err
	}
	defer rows.Close()

	var tags []string

	for rows.Next() {
		var tag string
		if err := rows.Scan(&tag); err != nil {
			return nil, err
		}
		tags = append(tags, tag)
	}

	err = rows.Err()

	switch {
	case len(tags) == 0:
		return tags, ErrTokenNotFound
	default:
		return tags, err
	}
}
1370852
func (client *Client) GetFeatureFlags() ([]FeatureFlag, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetFeatureFlagsRequest,
	})

	if err != nil {
		return nil, nil, err
	}

	var fullFeatureFlagList []FeatureFlag
	warnings, err := client.paginate(request, FeatureFlag{}, func(item interface{}) error {
		if featureFlag, ok := item.(FeatureFlag); ok {
			fullFeatureFlagList = append(fullFeatureFlagList, featureFlag)
		} else {
			return ccerror.UnknownObjectInListError{
				Expected:   FeatureFlag{},
				Unexpected: item,
			}
		}
		return nil
	})

	return fullFeatureFlagList, warnings, err

}
318439
func (entry *Entry) GetTag() (Tag, error) {
	var t C.acl_tag_t
	rv, _ := C.acl_get_tag_type(entry.e, &t)
	if rv < 0 {
		return TagUndefined, fmt.Errorf("unable to get tag")
	}
	return Tag(t), nil
}
894896
func (v *VerbalExpression) getFlags() string {
	flags := "misU" // warning, follow Flag const order
	result := []rune{}

	for i, flag := range flags {
		if v.flags&(1<<uint(i)) != 0 {
			result = append(result, flag)
		}
	}

	return string(result)
}
1265685
func parseMacroToken(p *parser, t *token) (string, error) {
	return parseMacro(p, t.value)
}
999658
func (c *Manager) GetTag(ctx context.Context, id string) (*Tag, error) {
	if isName(id) {
		tags, err := c.GetTags(ctx)
		if err != nil {
			return nil, err
		}

		for i := range tags {
			if tags[i].Name == id {
				return &tags[i], nil
			}
		}
	}

	url := internal.URL(c, internal.TagPath).WithID(id)
	var res Tag
	return &res, c.Do(ctx, url.Request(http.MethodGet), &res)

}
872881
func (s *IdentityService) GetSignupTokens() ([]services.SignupToken, error) {
	startKey := backend.Key(userTokensPrefix)
	result, err := s.GetRange(context.TODO(), startKey, backend.RangeEnd(startKey), backend.NoLimit)
	if err != nil {
		return nil, trace.Wrap(err)
	}
	tokens := make([]services.SignupToken, len(result.Items))
	for i, item := range result.Items {
		var signupToken services.SignupToken
		err = json.Unmarshal(item.Value, &signupToken)
		if err != nil {
			return nil, trace.Wrap(err)
		}
		tokens[i] = signupToken
	}
	return tokens, nil
}
903629
func GetFromFlags() log.Logger {
	if logger != nil {
		return logger
	}
	if !flag.Parsed() {
		flag.Parse()
	}

	threshold := getLevelFromName(*thresholdName)
	thresholdName = nil

	out := getStream(*logToStderr)
	logToStderr = nil

	flushThreshold := getLevelFromName(*flushThresholdName)
	flushThresholdName = nil

	if flushThreshold == log.None {
		logger = golog.New(out, threshold)
	} else {
		logger = buflog.New(out, threshold, flushThreshold)
	}

	return logger
}
866118
func (c *aliCloudImplementation) GetTags(resourceId string, resourceType string) (map[string]string, error) {
	if resourceId == "" {
		return nil, errors.New("resourceId not provided to GetTags")
	}
	tags := map[string]string{}

	request := &ecs.DescribeTagsArgs{
		RegionId:     common.Region(c.Region()),
		ResourceType: ecs.TagResourceType(resourceType), //image, instance, snapshot or disk
		ResourceId:   resourceId,
	}
	responseTags, _, err := c.EcsClient().DescribeTags(request)
	if err != nil {
		return tags, fmt.Errorf("error getting tags on %v: %v", resourceId, err)
	}

	for _, tag := range responseTags {
		tags[tag.TagKey] = tag.TagValue
	}
	return tags, nil

}
617257
func (r Tag) GetTagByTagName(tagList *string) (resp []datatypes.Tag, err error) {
	params := []interface{}{
		tagList,
	}
	err = r.Session.DoRequest("SoftLayer_Tag", "getTagByTagName", params, &r.Options, &resp)
	return
}
750803
func (c *Manager) GetAttachedTags(ctx context.Context, ref mo.Reference) ([]Tag, error) {
	ids, err := c.ListAttachedTags(ctx, ref)
	if err != nil {
		return nil, fmt.Errorf("get attached tags %s: %s", ref, err)
	}

	var info []Tag
	for _, id := range ids {
		tag, err := c.GetTag(ctx, id)
		if err != nil {
			return nil, fmt.Errorf("get tag %s: %s", id, err)
		}
		info = append(info, *tag)
	}
	return info, nil
}
703510
func (a *api) GetSnapshotByServiceIDAndTag(serviceID string, tag string) (string, error) {
	client, err := a.connectDAO()
	if err != nil {
		return "", err
	}
	req := dao.SnapshotByTagRequest{
		ServiceID: serviceID,
		TagName:   tag,
	}

	var snapshot dao.SnapshotInfo
	if err := client.GetSnapshotByServiceIDAndTag(req, &snapshot); err != nil {
		return "", err
	}

	return snapshot.SnapshotID, nil
}
133672
func (v *BtrfsVolume) GetSnapshotWithTag(tagName string) (*volume.SnapshotInfo, error) {
	// Get all the snapshots on the volume
	snapshotLabels, err := v.Snapshots()
	if err != nil {
		glog.Errorf("Could not get current snapshot list: %s", err)
		return nil, err
	}
	// Get info for each snapshot and return if a matching tag is found
	for _, snapshotLabel := range snapshotLabels {
		if info, err := v.SnapshotInfo(snapshotLabel); err != volume.ErrInvalidSnapshot {
			if err != nil {
				glog.Errorf("Could not get info for snapshot %s: %s", snapshotLabel, err)
				return nil, err
			}
			for _, tag := range info.Tags {
				if tag == tagName {
					return info, nil
				}
			}
		}
	}
	return nil, volume.ErrSnapshotDoesNotExist
}
1035741
func getActionTagsByPrefix(api APIClient, prefix string) ([]names.ActionTag, error) {
	results := []names.ActionTag{}

	tags, err := api.FindActionTagsByPrefix(params.FindTags{Prefixes: []string{prefix}})
	if err != nil {
		return results, err
	}

	matches, ok := tags.Matches[prefix]
	if !ok || len(matches) < 1 {
		return results, nil
	}

	results, rejects := getActionTags(matches)
	if len(rejects) > 0 {
		logger.Errorf("FindActionTagsByPrefix for prefix %q found invalid tags %v", prefix, rejects)
	}
	return results, nil
}
1220034
func GetTagMappings(cfg interface{}) (Mappings, error) {
	return getTagMappingsRecursive("", reflect.Indirect(reflect.ValueOf(cfg)))
}
1339570
func (c *Client) GetQueryTags(ctx context.Context, options *QueryTagsOptions) (*QueryTags, error) {
	var queryTags QueryTags

	req, err := c.NewRequest("GET", queryTagsPath, options, nil)
	if err != nil {
		return nil, err
	}

	if err := c.Do(ctx, req, &queryTags); err != nil {
		return nil, err
	}

	return &queryTags, nil
}
1271602
func (fi *FileInfo) getRequestorToken() (syscall.Token, error) {
	hdl := syscall.Handle(C.kbfsLibdokan_OpenRequestorToken(fi.ptr))
	var err error
	if hdl == syscall.InvalidHandle {
		// Tokens are value types, so returning nil is impossible,
		// returning an InvalidHandle is the best way.
		err = errors.New("Invalid handle from DokanOpenRequestorHandle")
	}
	return syscall.Token(hdl), err
}