// ExtractRestrictSources returns the first found RestrictSourcesOption from the
// given variadic arguments or nil otherwise.
15900
func ExtractRestrictSources(opts ...interface{}) *opt.RestrictSourcesOption {
	for _, o := range opts {
		if v, ok := o.(*opt.RestrictSourcesOption); ok {
			return v
		}
	}
	return nil
}
677065
func (d *DNS) GetDomainResources(domainID int) ([]*Resource, error) {
	params := linode.Parameters{
		"DomainID": strconv.Itoa(domainID),
	}

	var list []*Resource
	_, err := d.linode.Request("domain.resource.list", params, &list)
	if err != nil {
		return nil, err
	}
	return list, nil
}
1293321
func (o *RollbackOptions) findResource(targetName string) (runtime.Object, *meta.RESTMapping, error) {
	candidates := []string{}
	if strings.Index(targetName, "/") == -1 {
		candidates = append(candidates, "rc/"+targetName)
		candidates = append(candidates, "dc/"+targetName)
	} else {
		candidates = append(candidates, targetName)
	}
	var obj runtime.Object
	var m *meta.RESTMapping
	for _, name := range candidates {
		r := o.builder().
			WithScheme(scheme.Scheme, scheme.Scheme.PrioritizedVersionsAllGroups()...).
			NamespaceParam(o.Namespace).
			ResourceTypeOrNameArgs(false, name).
			SingleResourceType().
			Do()
		if r.Err() != nil {
			return nil, nil, r.Err()
		}

		resultObj, err := r.Object()
		if err != nil {
			// If the resource wasn't found, try another candidate.
			if kerrors.IsNotFound(err) {
				continue
			}
			return nil, nil, err
		}
		obj = resultObj
		mapping, err := r.ResourceMapping()
		if err != nil {
			return nil, nil, err
		}

		m = mapping
		break
	}
	if obj == nil {
		return nil, nil, fmt.Errorf("%s is not a valid deployment or deployment config", targetName)
	}
	return obj, m, nil
}
1135877
func ExtractQueryType(opts ...interface{}) *opt.QueryTypeOption {
	for _, o := range opts {
		if v, ok := o.(*opt.QueryTypeOption); ok {
			return v
		}
	}
	return nil
}
93984
func (s *Service) FindSources(ctx context.Context, opt influxdb.FindOptions) ([]*influxdb.Source, int, error) {
	ss := []*influxdb.Source{}
	err := s.kv.View(ctx, func(tx Tx) error {
		srcs, err := s.findSources(ctx, tx, opt)
		if err != nil {
			return err
		}
		ss = srcs
		return nil
	})

	if err != nil {
		return nil, 0, &influxdb.Error{
			Op:  influxdb.OpFindSources,
			Err: err,
		}
	}

	return ss, len(ss), nil
}
429684
func extractRespElements(w http.ResponseWriter) map[string]string {

	return map[string]string{
		"requestId":      w.Header().Get(responseRequestIDKey),
		"content-length": w.Header().Get("Content-Length"),
		// Add more fields here.
	}
}
1142655
func extractParams(p url.Values) Params {
	params := Params{}
	for k, l := range p {
		for _, v := range l {
			params[k] = v
		}
	}
	return params
}
1059053
func ExtractAllowTyposOnNumericTokens(opts ...interface{}) *opt.AllowTyposOnNumericTokensOption {
	for _, o := range opts {
		if v, ok := o.(*opt.AllowTyposOnNumericTokensOption); ok {
			return v
		}
	}
	return nil
}
501144
func ExtractType(opts ...interface{}) *opt.TypeOption {
	for _, o := range opts {
		if v, ok := o.(*opt.TypeOption); ok {
			return v
		}
	}
	return nil
}
1196373
func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organization string) (*InteractionRestriction, *Response, error) {
	u := fmt.Sprintf("orgs/%v/interaction-limits", organization)
	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	// TODO: remove custom Accept header when this API fully launches.
	req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview)

	organizationInteractions := new(InteractionRestriction)

	resp, err := s.client.Do(ctx, req, organizationInteractions)
	if err != nil {
		return nil, resp, err
	}

	return organizationInteractions, resp, nil
}
807929
func _getResourceParams(r *raml.Resource, params []string) []string {
	if r == nil {
		return params
	}

	matches := reResourceParam.FindAllString(r.URI, -1)
	for _, match := range matches {
		matchEscaped := commons.NormalizeIdentifier(match[1 : len(match)-1])
		params = append(params, matchEscaped)
	}

	return _getResourceParams(r.Parent, params)
}
346132
func ExtractFilters(opts ...interface{}) *opt.FiltersOption {
	for _, o := range opts {
		if v, ok := o.(*opt.FiltersOption); ok {
			return v
		}
	}
	return nil
}
370172
func (i *ImportRestriction) isRestrictedPath(packageToCheck string) bool {
	// if its not under our root, then its a built-in.  Everything else is under
	// github.com/openshift/origin or github.com/openshift/origin/vendor
	if !strings.HasPrefix(packageToCheck, rootPackage) {
		return false
	}

	// some subtrees are specifically excluded.  Not sure if we still need this given
	// explicit inclusion
	for _, ignored := range i.IgnoredSubTrees {
		if strings.HasPrefix(packageToCheck, ignored) {
			return false
		}
	}

	return true
}
863047
func (s *Snapshot) GetResources(typ string) map[string]Resource {
	if s == nil {
		return nil
	}
	switch typ {
	case EndpointType:
		return s.Endpoints.Items
	case ClusterType:
		return s.Clusters.Items
	case RouteType:
		return s.Routes.Items
	case ListenerType:
		return s.Listeners.Items
	case SecretType:
		return s.Secrets.Items
	}
	return nil
}
253383
func ExtractResourceValueByContainerName(fs *v1.ResourceFieldSelector, pod *v1.Pod, containerName string) (string, error) {
	container, err := findContainerInPod(pod, containerName)
	if err != nil {
		return "", err
	}
	return ExtractContainerResourceValue(fs, container)
}
828904
func ExtractInsideBoundingBox(opts ...interface{}) *opt.InsideBoundingBoxOption {
	for _, o := range opts {
		if v, ok := o.(*opt.InsideBoundingBoxOption); ok {
			return v
		}
	}
	return nil
}
1361012
func extractResourceGroupByProviderID(providerID string) (string, error) {
	matches := resourceGroupRE.FindStringSubmatch(providerID)
	if len(matches) != 2 {
		return "", ErrorNotVmssInstance
	}

	return matches[1], nil
}