/*
Copyright The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

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

package v1

// PodResourceClaimApplyConfiguration represents a declarative configuration of the PodResourceClaim type for use
// with apply.
//
// PodResourceClaim references exactly one ResourceClaim, either directly
// or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim
// for the pod.
//
// It adds a name to it that uniquely identifies the ResourceClaim inside the Pod.
// Containers that need access to the ResourceClaim reference it with this name.
//
// When the DRAWorkloadResourceClaims feature gate is enabled and this Pod
// belongs to a PodGroup, a PodResourceClaim is matched to a
// PodGroupResourceClaim if all of their fields are equal (Name,
// ResourceClaimName, and ResourceClaimTemplateName). A matched claim references
// a single ResourceClaim shared across all Pods in the PodGroup, reserved for
// the PodGroup in ResourceClaimStatus.ReservedFor rather than for individual
// Pods.
type PodResourceClaimApplyConfiguration struct {
	// Name uniquely identifies this resource claim inside the pod.
	// This must be a DNS_LABEL.
	Name *string `json:"name,omitempty"`
	// ResourceClaimName is the name of a ResourceClaim object in the same
	// namespace as this pod.
	//
	// Exactly one of ResourceClaimName and ResourceClaimTemplateName must
	// be set.
	ResourceClaimName *string `json:"resourceClaimName,omitempty"`
	// ResourceClaimTemplateName is the name of a ResourceClaimTemplate
	// object in the same namespace as this pod.
	//
	// The template will be used to create a new ResourceClaim, which will
	// be bound to this pod. When this pod is deleted, the ResourceClaim
	// will also be deleted. The pod name and resource name, along with a
	// generated component, will be used to form a unique name for the
	// ResourceClaim, which will be recorded in pod.status.resourceClaimStatuses.
	//
	// When the DRAWorkloadResourceClaims feature gate is enabled and the pod
	// belongs to a PodGroup that defines a PodGroupResourceClaim with the same
	// Name and ResourceClaimTemplateName, this PodResourceClaim resolves to the
	// ResourceClaim generated for the PodGroup. All pods in the group that
	// define an equivalent PodResourceClaim matching the
	// PodGroupResourceClaim's Name and ResourceClaimTemplateName share the same
	// generated ResourceClaim. ResourceClaims generated for a PodGroup are
	// owned by the PodGroup and their lifecycles are tied to the PodGroup
	// instead of any individual pod.
	//
	// This field is immutable and no changes will be made to the
	// corresponding ResourceClaim by the control plane after creating the
	// ResourceClaim.
	//
	// Exactly one of ResourceClaimName and ResourceClaimTemplateName must
	// be set.
	ResourceClaimTemplateName *string `json:"resourceClaimTemplateName,omitempty"`
}

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

// 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 *PodResourceClaimApplyConfiguration) WithName(value string) *PodResourceClaimApplyConfiguration {
	b.Name = &value
	return b
}

// WithResourceClaimName sets the ResourceClaimName 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 ResourceClaimName field is set to the value of the last call.
func (b *PodResourceClaimApplyConfiguration) WithResourceClaimName(value string) *PodResourceClaimApplyConfiguration {
	b.ResourceClaimName = &value
	return b
}

// WithResourceClaimTemplateName sets the ResourceClaimTemplateName 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 ResourceClaimTemplateName field is set to the value of the last call.
func (b *PodResourceClaimApplyConfiguration) WithResourceClaimTemplateName(value string) *PodResourceClaimApplyConfiguration {
	b.ResourceClaimTemplateName = &value
	return b
}
