{"modulePath":"github.com/devfile/devworkspace-operator","version":"v1.1.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package resources\n\n## Functions\n\n```go\nfunc AddResourceRequirements(resources, toAdd *corev1.ResourceRequirements) *corev1.ResourceRequirements\n```\nAdds the resource limits and requests that are set in the component \"toAdd\" to \"resources\". Returns an error if the \"resources\" defined in \"toAdd\" could not be parsed.\n\nNote: only resources that are set in the argument \"resources\" will be summed with the resources set in \"toAdd\". For example, if \"resources\" does not set a CPU limit but \"toAdd\" does set a CPU limit, the CPU limit of \"resources\" will remain unset.\n\n```go\nfunc ApplyCaps(resources, caps *corev1.ResourceRequirements) *corev1.ResourceRequirements\n```\n\n```go\nfunc ApplyDefaults(resources, defaults *corev1.ResourceRequirements) *corev1.ResourceRequirements\n```\n\n```go\nfunc ApplyResourceRequirementsToComponent(container *dw.ContainerComponent, resources *corev1.ResourceRequirements)\n```\nApplies the given resource limits and requirements that are non-zero to the container component. If a resource limit or request has a value of zero, then the corresponding limit or request is not set in the container component's resource requirements.\n\n```go\nfunc FilterResources(resources *corev1.ResourceRequirements) *corev1.ResourceRequirements\n```\nFilterResources removes zero values from a corev1.ResourceRequirements in order to allow explicitly defining \"do not set a limit/request\" for a resource. Any request/limit that has a zero value is removed from the returned corev1.ResourceRequirements.\n\n```go\nfunc ParseResourcesFromComponent(component *dw.Component) (*corev1.ResourceRequirements, error)\n```\nTakes a component and returns the resource requests and limits that it defines. If a resource request or limit is not defined within the component, it will not be populated in the corresponding corev1.ResourceList map.\n\nReturns an error if  a non-container component is passed to the function, or if an error occurs while parsing a resource limit or request.\n\n```go\nfunc ValidateResources(resources *corev1.ResourceRequirements) error\n```\nValidateResources validates that a corev1.ResourceRequirements is valid, i.e. that (if specified), limits are greater than or equal to requests\n\n","path":"github.com/devfile/devworkspace-operator/pkg/library/resources","name":"resources","synopsis":"","isRedistributable":true}
