/*
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 v1alpha1

import (
	lifecyclev1alpha1 "k8s.io/api/lifecycle/v1alpha1"
)

// TargetResponderApplyConfiguration represents a declarative configuration of the TargetResponder type for use
// with apply.
//
// TargetResponder allows you to specify the responder reacting to the Eviction.
// Responders should observe and communicate through the Eviction API (see .state) to help
// with the graceful eviction of a target (e.g. termination of a pod).
type TargetResponderApplyConfiguration struct {
	// name allows you to identify the responder reacting to the Eviction.
	//
	// It must be a valid domain-prefixed key (such as "acme.io/foo").
	// This field must be unique for each responder.
	// This field is required.
	Name *string `json:"name,omitempty"`
	// priority for this responder. Higher priorities are selected first by the evictionrequest-controller.
	// If there are responders with the same priority, the responder whose domain name comes first in the
	// alphabetical higher domain order, will be picked. This means that the top domain labels are compared
	// alphabetically first, followed by the lower domain labels. The key is compared last.
	//
	// The responder that is the managing controller of the pod should set the value of
	// this field to 10000 to allow both for preemption or fallback registration by other
	// responders.
	//
	// The minimum value is 0 and the maximum value is 100000.
	// The interval 0-999 is reserved for responders with *.k8s.io suffix.
	// This field is required and immutable.
	Priority *int32 `json:"priority,omitempty"`
	// state specifies a state that is assigned by the evictionrequest-controller. Responders should observe
	// this state in order to navigate their lifecycle.
	// - Inactive means that the responder should not yet process this eviction request.
	// - Active means that the responder is either running or expected to start soon.
	// Also, startTime has been set in the ResponderStatus by the evictionrequest-controller.
	//
	// An active responder should currently interact with the eviction process by updating
	// .status.responders, where .name is the active responder name. ResponderStatus fields
	// should be periodically updated to indicate the progress or completion of the eviction process.
	// If .status.responders[].heartbeatTime field is not updated within the heartbeat deadline defined
	// by the Eviction API (currently 20 minutes), the eviction is passed over to the next responder
	// with a lower priority. Only one responder can be active at a time.
	// - Interrupted means that the responder has failed to start or failed to update
	// heartbeatTime in ResponderStatus in a timely manner.
	// - Canceled means that the responder has been canceled. In other words, there	is no
	// EvictionRequest with the same target and Eviction intent in .spec.intent.
	// - Completed means that the responder has successfully completed and set completionTime
	// in ResponderStatus.
	//
	// Please refer to the ResponderStatus in .status.responders for more details on each responder.
	State *lifecyclev1alpha1.ResponderStateType `json:"state,omitempty"`
}

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

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

// WithPriority sets the Priority 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 Priority field is set to the value of the last call.
func (b *TargetResponderApplyConfiguration) WithPriority(value int32) *TargetResponderApplyConfiguration {
	b.Priority = &value
	return b
}

// WithState sets the State 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 State field is set to the value of the last call.
func (b *TargetResponderApplyConfiguration) WithState(value lifecyclev1alpha1.ResponderStateType) *TargetResponderApplyConfiguration {
	b.State = &value
	return b
}
