func (loc *TagLocator) ByTag(resourceType string, tags []string, options rsapi.APIParams) ([]map[string]interface{}, error) {
	var res []map[string]interface{}
	if resourceType == "" {
		return res, fmt.Errorf("resourceType is required")
	}
	if len(tags) == 0 {
		return res, fmt.Errorf("tags is required")
	}
	var params rsapi.APIParams
	var p rsapi.APIParams
	p = rsapi.APIParams{
		"resource_type": resourceType,
		"tags":          tags,
	}
	var includeTagsWithPrefixOpt = options["include_tags_with_prefix"]
	if includeTagsWithPrefixOpt != nil {
		p["include_tags_with_prefix"] = includeTagsWithPrefixOpt
	}
	var matchAllOpt = options["match_all"]
	if matchAllOpt != nil {
		p["match_all"] = matchAllOpt
	}
	var withDeletedOpt = options["with_deleted"]
	if withDeletedOpt != nil {
		p["with_deleted"] = withDeletedOpt
	}
	uri, err := loc.ActionPath("Tag", "by_tag")
	if err != nil {
		return res, err
	}
	req, err := loc.api.BuildHTTPRequest(uri.HTTPMethod, uri.Path, APIVersion, params, p)
	if err != nil {
		return res, err
	}
	resp, err := loc.api.PerformRequest(req)
	if err != nil {
		return res, err
	}
	defer resp.Body.Close()
	if resp.StatusCode < 200 || resp.StatusCode > 299 {
		respBody, _ := ioutil.ReadAll(resp.Body)
		sr := string(respBody)
		if sr != "" {
			sr = ": " + sr
		}
		return res, fmt.Errorf("invalid response %s%s", resp.Status, sr)
	}
	defer resp.Body.Close()
	respBody, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return res, err
	}
	err = json.Unmarshal(respBody, &res)
	return res, err
}
func (loc *TagLocator) ByTag(resourceType string, tags []string, options rsapi.APIParams) ([]map[string]interface{}, error) {
	var res []map[string]interface{}
	if resourceType == "" {
		return res, fmt.Errorf("resourceType is required")
	}
	if len(tags) == 0 {
		return res, fmt.Errorf("tags is required")
	}
	var params rsapi.APIParams
	var p rsapi.APIParams
	p = rsapi.APIParams{
		"resource_type": resourceType,
		"tags":          tags,
	}
	var includeTagsWithPrefixOpt = options["include_tags_with_prefix"]
	if includeTagsWithPrefixOpt != nil {
		p["include_tags_with_prefix"] = includeTagsWithPrefixOpt
	}
	var matchAllOpt = options["match_all"]
	if matchAllOpt != nil {
		p["match_all"] = matchAllOpt
	}
	var withDeletedOpt = options["with_deleted"]
	if withDeletedOpt != nil {
		p["with_deleted"] = withDeletedOpt
	}
	uri, err := loc.ActionPath("Tag", "by_tag")
	if err != nil {
		return res, err
	}
	req, err := loc.api.BuildHTTPRequest(uri.HTTPMethod, uri.Path, APIVersion, params, p)
	if err != nil {
		return res, err
	}
	resp, err := loc.api.PerformRequest(req)
	if err != nil {
		return res, err
	}
	defer resp.Body.Close()
	if resp.StatusCode < 200 || resp.StatusCode > 299 {
		respBody, _ := ioutil.ReadAll(resp.Body)
		sr := string(respBody)
		if sr != "" {
			sr = ": " + sr
		}
		return res, fmt.Errorf("invalid response %s%s", resp.Status, sr)
	}
	defer resp.Body.Close()
	respBody, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return res, err
	}
	err = json.Unmarshal(respBody, &res)
	return res, err
}
// POST /api/tags/by_tag
//
// Search for resources having a list of tags in a specific resource_type.
// The search criteria can contain plain tags ("my_db_server"), machine tags ("server:db=true"), or
// namespace &amp; predicate wildcards ("server:db=*"). The result set includes links to the resources.
// If match_all is "true", then the search is an "AND" operation -- only resources having all the
// tags are returned. If match_all has any other value or is missing, the search is performed
// as an "OR" operation.
// PLEASE NOTE the behavior of the include_tags_with_prefix parameter: if it is absent,
// or blank, then you will find resources that match your query but receive no information about
// the tags that apply to those resources. (Your search will also complete much more quickly in
// this case.)
// For example, a search with tag[]="server:db=true" and include_tags_with_prefix="backup:"
// will return resources that are tagged as a DB server, and also return all "backup" related tags
// for every matching resource.
// Required parameters:
// resource_type: Search among a single resource type.
// tags: The tags which must be present on the resource.
// Optional parameters:
// include_tags_with_prefix: If included, all tags matching this prefix will be returned. If not included, no tags will be returned.
// match_all: If set to 'true', resources having all the tags specified in the 'tags' parameter are returned. Otherwise, resources having any of the tags are returned.
// with_deleted: If set to 'true', tags for deleted resources will also be returned. Default value is 'false'.