// SupportsLimit provides a check to see if the limitRange is applicable to image objects.
// Implements the LimitRangerActions interface.
555119
func (a *imageLimitRangerPlugin) SupportsLimit(limitRange *corev1.LimitRange) bool {
	if limitRange == nil {
		return false
	}

	for _, limit := range limitRange.Spec.Limits {
		if limit.Type == imagev1.LimitTypeImage {
			return true
		}
	}
	return false
}
1019387
func (s *GetDiscoveredResourceCountsInput) SetLimit(v int64) *GetDiscoveredResourceCountsInput {
	s.Limit = &v
	return s
}
93676
func validateLimit(v, min, max int) error {

	// ensure the value for `limit` is valid
	if v < min || v > max {
		err := fmt.Errorf("%d is not a valid value for `limit`, must be between %d-%d (inclusive).", v, min, max)
		return err
	}

	return nil
}
735151
func (s *DescribeStreamInput) SetLimit(v int64) *DescribeStreamInput {
	s.Limit = &v
	return s
}
860380
func (s *DescribeFleetUtilizationInput) SetLimit(v int64) *DescribeFleetUtilizationInput {
	s.Limit = &v
	return s
}
1272686
func exceedsLimits(is *imagev1.ImageStream, image *imagev1.Image, limits map[string][]*corev1.LimitRange) bool {
	limitRanges, ok := limits[is.Namespace]
	if !ok || len(limitRanges) == 0 {
		return false
	}

	if err := imageutil.ImageWithMetadata(image); err != nil {
		return false
	}
	dockerImage, ok := image.DockerImageMetadata.Object.(*dockerv10.DockerImage)
	if !ok {
		return false
	}
	imageSize := resource.NewQuantity(dockerImage.Size, resource.BinarySI)
	for _, limitRange := range limitRanges {
		if limitRange == nil {
			continue
		}
		for _, limit := range limitRange.Spec.Limits {
			if limit.Type != imagev1.LimitTypeImage {
				continue
			}

			limitQuantity, ok := limit.Max[corev1.ResourceStorage]
			if !ok {
				continue
			}
			if limitQuantity.Cmp(*imageSize) < 0 {
				// image size is larger than the permitted limit range max size
				klog.V(4).Infof("Image %s in stream %s exceeds limit %s: %v vs %v",
					image.Name, getName(is), limitRange.Name, *imageSize, limitQuantity)
				return true
			}
		}
	}
	return false
}
1136706
func (s *ListTagsForStreamInput) SetLimit(v int64) *ListTagsForStreamInput {
	s.Limit = &v
	return s
}
807033
func (s *GetDocumentPathInput) SetLimit(v int64) *GetDocumentPathInput {
	s.Limit = &v
	return s
}
1033886
func (s *DescribeSessionsInput) SetLimit(v int64) *DescribeSessionsInput {
	s.Limit = &v
	return s
}
65283
func (s *DescribeAggregateComplianceByConfigRulesInput) SetLimit(v int64) *DescribeAggregateComplianceByConfigRulesInput {
	s.Limit = &v
	return s
}
69893
func containsLimit(execs []*tipb.Executor) bool {
	for _, exec := range execs {
		if exec.Limit != nil {
			return true
		}
	}
	return false
}
1173235
func (s *GetBasePathMappingsInput) SetLimit(v int64) *GetBasePathMappingsInput {
	s.Limit = &v
	return s
}
443987
func (s *GetRequestValidatorsInput) SetLimit(v int64) *GetRequestValidatorsInput {
	s.Limit = &v
	return s
}
608369
func (s *DescribeMatchmakingRuleSetsInput) SetLimit(v int64) *DescribeMatchmakingRuleSetsInput {
	s.Limit = &v
	return s
}
999428
func (s *DescribeConfigurationAggregatorsInput) SetLimit(v int64) *DescribeConfigurationAggregatorsInput {
	s.Limit = &v
	return s
}
463246
func (s *ListApplicationSnapshotsInput) SetLimit(v int64) *ListApplicationSnapshotsInput {
	s.Limit = &v
	return s
}
1241160
func (s *ListJobsInput) SetLimit(v string) *ListJobsInput {
	s.Limit = &v
	return s
}