//Given a QbsRestFindUdid return a RestFindUdid
353686
func QbsWrapFindUdid(finder QbsRestFindUdid, s *QbsStore) RestFindUdid {
	return &qbsWrappedUdid{find: finder, store: s}
}
298696
func (s *GuestOSService) GetOsCategoryID(name string, opts ...OptionFunc) (string, int, error) {
	p := &ListOsCategoriesParams{}
	p.p = make(map[string]interface{})

	p.p["name"] = name

	for _, fn := range append(s.cs.options, opts...) {
		if err := fn(s.cs, p); err != nil {
			return "", -1, err
		}
	}

	l, err := s.ListOsCategories(p)
	if err != nil {
		return "", -1, err
	}

	if l.Count == 0 {
		return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l)
	}

	if l.Count == 1 {
		return l.OsCategories[0].Id, l.Count, nil
	}

	if l.Count > 1 {
		for _, v := range l.OsCategories {
			if v.Name == name {
				return v.Id, l.Count, nil
			}
		}
	}
	return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l)
}
596107
func GetDSNOrDie() *qbs.DataSourceName {
	db := os.Getenv("DATABASE_URL")
	if db == "" {
		panic("no DATABASE_URL found, cannot connect to a *QbsStore")
	}
	u, err := url.Parse(db)
	if err != nil {
		panic(fmt.Sprintf("unable to parse database URL: %s", err))
	}
	log.Printf("DATABASE_URL found, connecting to %+v\n", u)
	dsn := &qbs.DataSourceName{}
	dsn.DbName = u.Path[1:]
	dsn.Host = u.Host
	if strings.Index(u.Host, ":") != -1 {
		pair := strings.Split(u.Host, ":")
		if len(pair) != 2 {
			panic("badly formed host:port")
		}
		dsn.Host = pair[0]
		dsn.Port = pair[1]
	}
	p, set := u.User.Password()
	if set {
		dsn.Password = p
	}

	dsn.Username = u.User.Username()
	dsn.Dialect = StringToDialect(u.Scheme)
	return dsn
}
422277
func (kl *Kubelet) getPodVolumeSubpathsDir(podUID types.UID) string {
	return filepath.Join(kl.getPodDir(podUID), config.DefaultKubeletVolumeSubpathsDirName)
}
208212
func (res *Resolver) RestAXFR(req *restful.Request, resp *restful.Response) {
	records := res.records()

	AXFRRecords := models.AXFRRecords{
		SRVs:  records.SRVs.ToAXFRResourceRecordSet(),
		As:    records.As.ToAXFRResourceRecordSet(),
		AAAAs: records.AAAAs.ToAXFRResourceRecordSet(),
	}
	AXFR := models.AXFR{
		Records:        AXFRRecords,
		Serial:         atomic.LoadUint32(&res.config.SOASerial),
		Mname:          res.config.SOAMname,
		Rname:          res.config.SOARname,
		TTL:            res.config.TTL,
		RefreshSeconds: res.config.RefreshSeconds,
		Domain:         res.config.Domain,
	}

	if err := resp.WriteAsJson(AXFR); err != nil {
		logging.Error.Println(err)
	}
}
675120
func (e *Empire) AppsFind(q AppsQuery) (*App, error) {
	return appsFind(e.db, q)
}
831076
func GetDigestByNid(nid NID) (*Digest, error) {
	sn, err := Nid2ShortName(nid)
	if err != nil {
		return nil, err
	}
	return GetDigestByName(sn)
}
1303738
func (m MiddlewareFunc) SchemeEndsWith(tests ...string) MiddlewareFunc {
	return func(h HandlerFunc) HandlerFunc {
		return func(c *Context) error {
			for _, test := range tests {
				if strings.HasSuffix(c.Request().URL().Scheme, test) {
					return m(h)(c)
				}
			}
			return h(c)
		}
	}
}
252813
func (r Network_Interconnect_Tenant) GetDirectLinkSpeeds(offeringType *string) (resp string, err error) {
	params := []interface{}{
		offeringType,
	}
	err = r.Session.DoRequest("SoftLayer_Network_Interconnect_Tenant", "getDirectLinkSpeeds", params, &r.Options, &resp)
	return
}
16685
func (s *ExplainService) Q(q string) *ExplainService {
	s.q = q
	return s
}
1134243
func (client *Client) GetSpaceQuotaDefinition(guid string) (SpaceQuota, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetSpaceQuotaDefinitionRequest,
		URIParams:   Params{"space_quota_guid": guid},
	})
	if err != nil {
		return SpaceQuota{}, nil, err
	}

	var spaceQuota SpaceQuota
	response := cloudcontroller.Response{
		DecodeJSONResponseInto: &spaceQuota,
	}

	err = client.connection.Make(request, &response)
	return spaceQuota, response.Warnings, err
}
1353538
func (c *DOM) GetContentQuadsWithParams(v *DOMGetContentQuadsParams) ([]float64, error) {
	resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "DOM.getContentQuads", Params: v})
	if err != nil {
		return nil, err
	}

	var chromeData struct {
		Result struct {
			Quads []float64
		}
	}

	if resp == nil {
		return nil, &gcdmessage.ChromeEmptyResponseErr{}
	}

	// test if error first
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return nil, &gcdmessage.ChromeRequestErr{Resp: cerr}
	}

	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return nil, err
	}

	return chromeData.Result.Quads, nil
}
343303
func (c *ClusterInfo) GetNSQDTopics(nsqdHTTPAddrs []string) ([]string, error) {
	var topics []string
	var lock sync.Mutex
	var wg sync.WaitGroup
	var errs []error

	type respType struct {
		Topics []struct {
			Name string `json:"topic_name"`
		} `json:"topics"`
	}

	for _, addr := range nsqdHTTPAddrs {
		wg.Add(1)
		go func(addr string) {
			defer wg.Done()

			endpoint := fmt.Sprintf("http://%s/stats?format=json", addr)
			c.logf("CI: querying nsqd %s", endpoint)

			var resp respType
			err := c.client.GETV1(endpoint, &resp)
			if err != nil {
				lock.Lock()
				errs = append(errs, err)
				lock.Unlock()
				return
			}

			lock.Lock()
			defer lock.Unlock()
			for _, topic := range resp.Topics {
				topics = stringy.Add(topics, topic.Name)
			}
		}(addr)
	}
	wg.Wait()

	if len(errs) == len(nsqdHTTPAddrs) {
		return nil, fmt.Errorf("Failed to query any nsqd: %s", ErrList(errs))
	}

	sort.Strings(topics)

	if len(errs) > 0 {
		return topics, ErrList(errs)
	}
	return topics, nil
}
1116059
func (q *QueryDsl) Qs(qs *QueryString) *QueryDsl {
	q.QueryEmbed.Qs = qs
	return q
}
536893
func NewAttemptID(qst string, aid uint32) *Attempt_ID {
	return &Attempt_ID{Quest: qst, Id: aid}
}
442855
func getNwAndEpgFromAddrReq(allocID string) (string, string) {
	nwList := strings.Split(allocID, ":")
	if len(nwList) == 2 { // allocReqId is nw:epg.tenant
		networkID := nwList[0]
		epgList := strings.Split(nwList[1], ".")
		if len(epgList) == 2 {
			epgName := epgList[0] + ":" + epgList[1]
			networkID = networkID + "." + epgList[1]
			return networkID, epgName
		}
	}
	return allocID, ""
}
50044
func (p *PullRequestComment) GetOriginalCommitID() string {
	if p == nil || p.OriginalCommitID == nil {
		return ""
	}
	return *p.OriginalCommitID
}