// Code generated by applyconfiguration-gen. DO NOT EDIT.

package v1alpha1

import (
	resource "k8s.io/apimachinery/pkg/api/resource"
)

// ContainerResourceApplyConfiguration represents a declarative configuration of the ContainerResource type for use
// with apply.
//
// MaxItems on []ContainerResource fields is kept at 5 to stay within the
// Kubernetes CRD CEL validation cost budget (StaticEstimatedCRDCostLimit).
// The quantity() CEL function has a high fixed estimated cost per invocation,
// and the limit-vs-request comparison rule is costed per maxItems per location.
// With multiple structs in ClusterMonitoringSpec embedding []ContainerResource,
// maxItems > 5 causes the total estimated rule cost to exceed the budget.
// ContainerResource defines a single resource requirement for a container.
type ContainerResourceApplyConfiguration struct {
	// name of the resource (e.g. "cpu", "memory", "hugepages-2Mi").
	// This field is required.
	// name must consist only of alphanumeric characters, `-`, `_` and `.` and must start and end with an alphanumeric character.
	Name *string `json:"name,omitempty"`
	// request is the minimum amount of the resource required (e.g. "2Mi", "1Gi").
	// This field is optional.
	// When limit is specified, request cannot be greater than limit.
	// The value must be greater than 0 when specified.
	Request *resource.Quantity `json:"request,omitempty"`
	// limit is the maximum amount of the resource allowed (e.g. "2Mi", "1Gi").
	// This field is optional.
	// When request is specified, limit cannot be less than request.
	// The value must be greater than 0 when specified.
	Limit *resource.Quantity `json:"limit,omitempty"`
}

// ContainerResourceApplyConfiguration constructs a declarative configuration of the ContainerResource type for use with
// apply.
func ContainerResource() *ContainerResourceApplyConfiguration {
	return &ContainerResourceApplyConfiguration{}
}

// WithName sets the Name field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Name field is set to the value of the last call.
func (b *ContainerResourceApplyConfiguration) WithName(value string) *ContainerResourceApplyConfiguration {
	b.Name = &value
	return b
}

// WithRequest sets the Request field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Request field is set to the value of the last call.
func (b *ContainerResourceApplyConfiguration) WithRequest(value resource.Quantity) *ContainerResourceApplyConfiguration {
	b.Request = &value
	return b
}

// WithLimit sets the Limit field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Limit field is set to the value of the last call.
func (b *ContainerResourceApplyConfiguration) WithLimit(value resource.Quantity) *ContainerResourceApplyConfiguration {
	b.Limit = &value
	return b
}
