// IsStandardContainerResourceName returns true if the container can make a resource request
// for the specified resource
359337
func IsStandardContainerResourceName(str string) bool {
	return standardContainerResources.Has(str) || IsHugePageResourceName(corev1.ResourceName(str))
}
337764
func networkResourceDistance(resourceUsed *structs.NetworkResource, resourceNeeded *structs.NetworkResource) float64 {
	networkCoord := math.MaxFloat64
	if resourceUsed != nil && resourceNeeded != nil {
		networkCoord = float64(resourceNeeded.MBits-resourceUsed.MBits) / float64(resourceNeeded.MBits)
	}

	originDist := math.Abs(networkCoord)
	return originDist
}
1319389
func IsIntegerResourceName(str string) bool {
	return integerResources.Has(str) || IsExtendedResourceName(core.ResourceName(str))
}
344549
func (s *Operation) SetResourceName(v string) *Operation {
	s.ResourceName = &v
	return s
}
272527
func ValidateResourceQuotaResourceName(value string, fldPath *field.Path) field.ErrorList {
	allErrs := validateResourceName(value, fldPath)

	if len(strings.Split(value, "/")) == 1 {
		if !helper.IsStandardQuotaResourceName(value) {
			return append(allErrs, field.Invalid(fldPath, value, isInvalidQuotaResource))
		}
	}
	return allErrs
}
905892
func (s *ListTagsForResourceInput) SetResourceName(v string) *ListTagsForResourceInput {
	s.ResourceName = &v
	return s
}
700650
func isHandlerFuncInResource(m string, r Resource) (func(w http.ResponseWriter, r *http.Request), bool) {
	name := strings.Title(strings.ToLower(m))
	method := reflect.ValueOf(r).MethodByName(name)
	if !method.IsValid() {
		return nil, false
	}

	// Native http.HandlerFunc
	fn, ok := method.Interface().(func(w http.ResponseWriter, r *http.Request))
	if ok {
		return fn, true
	}

	// ... or check for a contextual handler
	cfn, ok := method.Interface().(func(Context))
	if !ok {
		return nil, false
	}
	return wrap(cfn).ServeHTTP, ok
}
1313759
func (p *StatsProvider) GetRawContainerInfo(containerName string, req *cadvisorapiv1.ContainerInfoRequest, subcontainers bool) (map[string]*cadvisorapiv1.ContainerInfo, error) {
	if subcontainers {
		return p.cadvisor.SubcontainerInfo(containerName, req)
	}
	containerInfo, err := p.cadvisor.ContainerInfo(containerName, req)
	if err != nil {
		return nil, err
	}
	return map[string]*cadvisorapiv1.ContainerInfo{
		containerInfo.Name: containerInfo,
	}, nil
}
270597
func (d *DNS) CreateDomainResource(r *Resource) (*ResourceResponse, error) {
	// Ensure that the resource has a name.
	if len(r.Name) == 0 {
		return nil, linode.NewError(errors.New("dns: creating a resource requires Name be specified"))
	}

	// Initialize parameters that are shared across resource types.
	params := linode.Parameters{
		"DomainID": strconv.Itoa(r.DomainID),
		"Name":     r.Name,
		"TTL_Sec":  strconv.Itoa(r.TTL_Sec),
	}

	// Ensure that the resource has a valid, supported type.
	r.Type = strings.ToUpper(r.Type)
	switch r.Type {
	case "A":
	case "AAAA":
	case "CNAME":
	case "MX":
	case "NS":
	case "TXT":
		// No further processing required for these types.
		break
	case "SRV":
		// Ensure that SRV has a protocol.
		if len(r.Protocol) == 0 {
			return nil, linode.NewError(errors.New("dns: creating a SRV resource requires Priority be specified"))
		}
		params.Set("Protocol", r.Protocol)
		break
	default:
		// Unsupported type.
		return nil, linode.NewError(errors.New("dns: can not create resource of unsupported type: " + r.Type))
	}
	params.Set("Type", r.Type)

	// Ensure that the resource has a valid target.
	if len(r.Target) == 0 {
		return nil, linode.NewError(errors.New("dns: creating a resource requires Target to be specified"))
	}
	params.Set("Target", r.Target)

	if r.Name == "MX" || r.Name == "SRV" {
		// If priority is defined, ensure that it's valid.
		if r.Priority != nil {
			priority, ok := r.Priority.(int)
			if !ok {
				return nil, linode.NewError(errors.New("dns: priority must be specified as an int"))
			}
			if priority < 0 || priority > 255 {
				return nil, linode.NewError(errors.New("dns: priority must be within the range of 0-255"))
			}
			r.Priority = priority
			params.Set("Priority", strconv.Itoa(priority))
		}
	}

	// Create the resource.
	return d.createDomainResource(params)
}
411506
func (s *ListMigrationTasksInput) SetResourceName(v string) *ListMigrationTasksInput {
	s.ResourceName = &v
	return s
}
237032
func (o *AttachOptions) GetContainerName(pod *corev1.Pod) (string, error) {
	c, err := o.containerToAttachTo(pod)
	if err != nil {
		return "", err
	}
	return c.Name, nil
}
1367608
func (d *DNS) CreateDomainResourceA(domainID int, name, target string, ttlSeconds int) (*ResourceResponse, error) {
	return d.createDomainResource(linode.Parameters{
		"Type":     "A",
		"DomainID": strconv.Itoa(domainID),
		"Name":     name,
		"Target":   target,
		"TTL_Sec":  strconv.Itoa(ttlSeconds),
	})
}
1265959
func (c *ChainConfig) IsConstantinople(num *big.Int) bool {
	return isForked(c.ConstantinopleBlock, num)
}
879818
func isDiscreteResource(values []string) (int64, bool) {
	if len(values) != 1 {
		return int64(0), false
	}

	u, err := discreteResourceVal(values[0])
	if err != nil {
		return int64(0), false
	}

	return u, true

}
897379
func (s *DescribeTagsInput) SetResourceName(v string) *DescribeTagsInput {
	s.ResourceName = &v
	return s
}
1370934
func (s *CreateFunctionInput) SetDataSourceName(v string) *CreateFunctionInput {
	s.DataSourceName = &v
	return s
}
922587
func (m *MenuEntry) IsSameResource(inme *MenuEntry) bool {
	murl, inmeurl := m.URL(), inme.URL()
	return murl != "" && inmeurl != "" && murl == inmeurl
}