// ProjectLinks returns the navigation list surrounding a project and optionally group.
420036
func ProjectLinks(c context.Context, project, group string) []ui.LinkGroup {
	if project == "" {
		return nil
	}
	projLinks := []*ui.Link{
		ui.NewLink(
			"Builders",
			fmt.Sprintf("/p/%s/builders", project),
			fmt.Sprintf("All builders for project %s", project))}
	links := []ui.LinkGroup{
		{
			Name: ui.NewLink(
				project,
				fmt.Sprintf("/p/%s", project),
				fmt.Sprintf("Project page for %s", project)),
			Links: projLinks,
		},
	}
	if group != "" {
		groupLinks := []*ui.Link{}
		con, err := common.GetConsole(c, project, group)
		if err != nil {
			logging.WithError(err).Warningf(c, "error getting console")
		} else if !con.Def.BuilderViewOnly {
			groupLinks = append(groupLinks, ui.NewLink(
				"Console",
				fmt.Sprintf("/p/%s/g/%s/console", project, group),
				fmt.Sprintf("Console for group %s in project %s", group, project)))
		}

		groupLinks = append(groupLinks, ui.NewLink(
			"Builders",
			fmt.Sprintf("/p/%s/g/%s/builders", project, group),
			fmt.Sprintf("Builders for group %s in project %s", group, project)))

		links = append(links, ui.LinkGroup{
			Name:  ui.NewLink(group, "", ""),
			Links: groupLinks,
		})
	}
	return links
}
386382
func (r Response) Links(req *http.Request, baseURL string) (ret jsonapi.Links) {
	ret = make(jsonapi.Links)

	if r.Pagination.Next != nil {
		ret["next"] = buildLink(baseURL, req, r.Pagination.Next)
	}
	if r.Pagination.Prev != nil {
		ret["prev"] = buildLink(baseURL, req, r.Pagination.Prev)
	}
	if r.Pagination.First != nil {
		ret["first"] = buildLink(baseURL, req, r.Pagination.First)
	}
	if r.Pagination.Last != nil {
		ret["last"] = buildLink(baseURL, req, r.Pagination.Last)
	}
	return
}
1102368
func (v *version) AppProjects() AppProjectInformer {
	return &appProjectInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
252975
func (rmr *RecordMatchRun) GetLinks() []Link {
	var links []Link
	for _, response := range rmr.Responses {
		for _, entry := range response.Message.Entry {
			if len(entry.Link) == 2 {
				source := entry.FullUrl
				var target string
				for _, l := range entry.Link {
					if l.Relation == "related" {
						target = l.Url
					}
				}
				var match string
				for _, e := range entry.Search.Extension {
					if e.Url == "http://hl7.org/fhir/StructureDefinition/patient-mpi-match" {
						match = e.ValueCode
					}
				}
				score := *entry.Search.Score
				links = append(links, Link{source, target, match, score})
			}
		}
	}
	sort.Sort(LinkSlice(links))
	return links
}
26024
func serviceLinks(serviceID string) []link {
	serviceURI := fmt.Sprintf("/services/%s", serviceID)
	return []link{
		link{retrievelink, "GET", serviceURI},
		link{"ServiceLogs", "GET", serviceURI + "/logs"},
		link{updatelink, "PUT", serviceURI},
		link{deletelink, "DELETE", serviceURI},
	}
}
706547
func (s *EnvironmentDescription) SetEnvironmentLinks(v []*EnvironmentLink) *EnvironmentDescription {
	s.EnvironmentLinks = v
	return s
}
384608
func (p ListedPathProviders) ListedPaths() []string {
	ret := sets.String{}
	for _, provider := range p {
		for _, path := range provider.ListedPaths() {
			ret.Insert(path)
		}
	}

	return ret.List()
}
633098
func BuilderIDLink(b, project string) string {
	parts := strings.Split(b, "/")
	if len(parts) != 3 {
		return InvalidBuilderIDURL
	}

	switch source := parts[0]; source {
	case "buildbot":
		return fmt.Sprintf("/buildbot/%s/%s", parts[1], parts[2])
	case "buildbucket":
		return fmt.Sprintf("/p/%s/builders/%s/%s", project, parts[1], parts[2])
	default:
		return InvalidBuilderIDURL
	}
}
1100309
func Convert_v1_ProjectStatus_To_project_ProjectStatus(in *v1.ProjectStatus, out *project.ProjectStatus, s conversion.Scope) error {
	return autoConvert_v1_ProjectStatus_To_project_ProjectStatus(in, out, s)
}
389292
func (c *ProjectsClient) List(ctx context.Context, opts *ProjectsListOpts) *ProjectIter {
	iter := ProjectIter{
		first: true,
		i:     -1,
	}

	p := "/projects"

	var q url.Values
	if opts != nil {
		q = make(url.Values)
		if opts.Me != nil {
			q.Set("me", strconv.FormatBool(*opts.Me))
		}

		if opts.TeamID != nil {
			b, err := opts.TeamID.MarshalText()
			if err != nil {
				return &iter
			}
			q.Set("team_id", string(b))
		}

		if opts.Label != nil {
			q.Set("label", *opts.Label)
		}
	}

	var req *http.Request
	req, iter.err = c.backend.NewRequest(http.MethodGet, p, q, nil)
	if iter.err != nil {
		return &iter
	}

	_, iter.err = c.backend.Do(ctx, req, &iter.page, func(code int) error {
		return &Error{}
	})
	return &iter
}
485751
func (bow *Browser) Links() []*Link {
	links := make([]*Link, 0, InitialAssetsSliceSize)
	bow.Find("a").Each(func(_ int, s *goquery.Selection) {
		href, err := bow.attrToResolvedUrl("href", s)
		if err == nil {
			links = append(links, NewLinkAsset(
				href,
				bow.attrOrDefault("id", "", s),
				s.Text(),
			))
		}
	})

	return links
}
426425
func ProjectNames(c context.Context, a cfgclient.Authority) ([]types.ProjectName, error) {
	configPath := ProjectConfigPath(c)

	var metas []*config.Meta
	if err := cfgclient.Projects(c, a, configPath, nil, &metas); err != nil {
		log.WithError(err).Errorf(c, "Failed to load project configs.")
		return nil, err
	}

	// Iterate through our Metas and extract the project names.
	projects := make([]types.ProjectName, 0, len(metas))
	for _, meta := range metas {
		if projectName := meta.ConfigSet.Project(); projectName != "" {
			projects = append(projects, types.ProjectName(projectName))
		}
	}
	sort.Sort(projectNameSlice(projects))
	return projects, nil
}
1070133
func Convert_project_ProjectList_To_v1_ProjectList(in *project.ProjectList, out *v1.ProjectList, s conversion.Scope) error {
	return autoConvert_project_ProjectList_To_v1_ProjectList(in, out, s)
}
320739
func (n navigator) getLinks(uri string) (Links, error) {
	req, err := newHalRequest("GET", uri, nil)
	if err != nil {
		return Links{}, err
	}

	res, err := n.HttpClient.Do(req)
	if err != nil {
		return Links{}, err
	}
	defer res.Body.Close()

	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		return Links{}, err
	}

	var m Links

	if err := json.Unmarshal(body, &m); err != nil {
		return Links{}, fmt.Errorf("Unable to unmarshal '%s': %v", string(body), err)
	}

	return m, nil
}
1338338
func (s *ListProjectsOutput) SetProjects(v []*ProjectSummary) *ListProjectsOutput {
	s.Projects = v
	return s
}
1290464
func (l *ListSpec) Link(scope Scope) (TypeSpec, error) {
	if l.linked() {
		return l, nil
	}

	var err error
	l.ValueSpec, err = l.ValueSpec.Link(scope)
	return l, err
}
248478
func (s *RepositoriesService) ListProjects(ctx context.Context, owner, repo string, opt *ProjectListOptions) ([]*Project, *Response, error) {
	u := fmt.Sprintf("repos/%v/%v/projects", owner, repo)
	u, err := addOptions(u, opt)
	if err != nil {
		return nil, nil, err
	}

	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	// TODO: remove custom Accept headers when APIs fully launch.
	req.Header.Set("Accept", mediaTypeProjectsPreview)

	var projects []*Project
	resp, err := s.client.Do(ctx, req, &projects)
	if err != nil {
		return nil, resp, err
	}

	return projects, resp, nil
}