// FilterByProjects returns applications which belongs to the specified project
344941
func FilterByProjects(apps []argoappv1.Application, projects []string) []argoappv1.Application {
	if len(projects) == 0 {
		return apps
	}
	projectsMap := make(map[string]bool)
	for i := range projects {
		projectsMap[projects[i]] = true
	}
	items := make([]argoappv1.Application, 0)
	for i := 0; i < len(apps); i++ {
		a := apps[i]
		if _, ok := projectsMap[a.Spec.GetProject()]; ok {
			items = append(items, a)
		}
	}
	return items

}
996817
func (c *Client) GetProjectList(page string, pageSize string, projectOwner string) (result ProjectListResultModel, err error) {

	params := url.Values{}
	params.Add("Page", page)
	params.Add("PageSize", pageSize)

	if projectOwner != "" {
		params.Add("ProjectOwner", projectOwner)
	}

	paramsString := params.Encode()

	requestUrl := c.GetUrl("projects", "", "")
	requestPath := GetRequestPath("projects", "", "")

	responseResult, _ := c.GetResponseJson("GET", requestUrl+"?"+paramsString+"&resource", requestPath+"?"+paramsString+"&resource", "")

	err = json.Unmarshal([]byte(responseResult), &result)

	return result, err
}
346765
func (api *NFSAPI) FilterBy(key string, value interface{}) *NFSAPI {
	api.filterBy(key, value, false)
	return api
}
400180
func (api *IPv6AddrAPI) FilterBy(key string, value interface{}) *IPv6AddrAPI {
	api.filterBy(key, value, false)
	return api
}
1356545
func (api *AutoBackupAPI) FilterBy(key string, value interface{}) *AutoBackupAPI {
	api.filterBy(key, value, false)
	return api
}
1172472
func (api *PublicPriceAPI) FilterBy(key string, value interface{}) *PublicPriceAPI {
	api.filterBy(key, value, false)
	return api
}
950030
func (api *ProductLicenseAPI) FilterBy(key string, value interface{}) *ProductLicenseAPI {
	api.filterBy(key, value, false)
	return api
}
1090971
func (c *Client) ListProjectAccounts(p *ListProjectAccountsParameter) ([]*ProjectAccount, error) {
	obj, err := c.Request("listProjectAccounts", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.([]*ProjectAccount), err
}
855683
func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int64, opt *ProjectCardListOptions) ([]*ProjectCard, *Response, error) {
	u := fmt.Sprintf("projects/columns/%v/cards", columnID)
	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)

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

	return cards, resp, nil
}
1196190
func (api *SubnetAPI) FilterBy(key string, value interface{}) *SubnetAPI {
	api.filterBy(key, value, false)
	return api
}
334090
func (api *DNSAPI) FilterBy(key string, value interface{}) *DNSAPI {
	api.filterBy(key, value, false)
	return api
}
927516
func (api *RegionAPI) FilterBy(key string, value interface{}) *RegionAPI {
	api.filterBy(key, value, false)
	return api
}
376764
func filterClustersByName(clusterNames []string, clusters []*api.Cluster) ([]*api.Cluster, error) {
	if len(clusterNames) != 0 {
		// Build a map as we want to return them in the same order as args
		m := make(map[string]*api.Cluster)
		for _, c := range clusters {
			m[c.ObjectMeta.Name] = c
		}
		var filtered []*api.Cluster
		for _, clusterName := range clusterNames {
			c := m[clusterName]
			if c == nil {
				return nil, fmt.Errorf("cluster not found %q", clusterName)
			}

			filtered = append(filtered, c)
		}
		return filtered, nil
	}

	return clusters, nil
}
1279734
func (s *Schema) Filter(field string, value interface{}) []Project {
	result := []Project{}
	for _, item := range s.Projects {
		v := reflect.ValueOf(item)
		for i := 0; i < v.NumField(); i++ {
			if v.Type().Field(i).Name == field {
				if reflect.DeepEqual(v.Field(i).Interface(), value) {
					result = append(result, item)
				}
			}
		}
	}
	return result
}
374871
func (r *marathonClient) ApplicationBy(name string, opts *GetAppOpts) (*Application, error) {
	path, err := addOptions(buildPath(name), opts)
	if err != nil {
		return nil, err
	}
	var wrapper struct {
		Application *Application `json:"app"`
	}

	if err := r.apiGet(path, nil, &wrapper); err != nil {
		return nil, err
	}

	return wrapper.Application, nil
}
985777
func (api *ProjectsAPI) GetServices(projectID string) (result *Services, err error) {
	uri := api.client.Endpoint + projectUrl + projectID + "/services"
	res, err := api.client.restClient.GetList(api.client.Endpoint, uri, api.client.options.TokenOptions)
	if err != nil {
		return
	}

	result = &Services{}
	err = json.Unmarshal(res, result)
	return
}
77078
func (s *persistentStorage) LookupByProject(c context.Context, project string) (*ProjectIdentity, error) {
	return s.lookup(c, &ProjectIdentity{Project: project})
}