/*
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 (
	v1 "k8s.io/client-go/applyconfigurations/meta/v1"
)

// EvictionStatusApplyConfiguration represents a declarative configuration of the EvictionStatus type for use
// with apply.
//
// EvictionStatus represents the last observed status of the eviction request.
type EvictionStatusApplyConfiguration struct {
	// conditions contain information about the eviction request.
	//
	// Eviction specific conditions are: TargetEvicted or Failed (managed by evictionrequest-controller).
	// - Failed means that the eviction request is no longer being processed
	// by any eviction responder. This can happen if the request is canceled or if no responder
	// managed to evict the target (e.g. terminate or delete a pod).
	// - TargetEvicted means that the target has been evicted (e.g. a pod has been terminated or deleted).
	//
	// The maximum length of the conditions list is 100.
	Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"`
	// observedGeneration is Eviction's .metadata.generation observed by the evictionrequest-controller.
	// The observed generation value cannot be negative and can only be incremented.
	// The minimum value is 1.
	// This field is managed by evictionrequest-controller.
	ObservedGeneration *int64 `json:"observedGeneration,omitempty"`
	// requesters allow you to identify the entities, that requested the eviction of the target.
	// If all the requesters withdraw their eviction intent, the eviction will be canceled.
	//
	// The maximum length of the requesters list is 100.
	// If this limit is exceeded, requesters with Withdrawn intent should be dropped first.
	Requesters []RequesterApplyConfiguration `json:"requesters,omitempty"`
	// targetResponders reference responders that should eventually respond to this eviction
	// to help with the graceful eviction of a target. These responders are selected sequentially,
	// according to their specified priority by setting the Active state to the TargetResponder
	// .state field. The maximum number of active responders allowed is 1.
	// Eventually each responder can end up in an Interrupted, Canceled or, Completed state.
	// Responders should observe these states in order to navigate their lifecycle.
	//
	// If the target is a pod, the field is populated from Pod's .spec.evictionResponders. Default
	// responders may be added to the list according to the target.
	//
	// Default responders:
	// - imperative-eviction.k8s.io/evictor responder with a priority of 100 is added to the list if the
	// target is a pod. It will call the imperative Eviction API (pods/<name>/eviction subresource).
	// This call may not succeed due to PodDisruptionBudgets, which may block the pod termination.
	// It will update the responder message and try again with a backoff.
	//
	// The maximum length of the responders list is 11.
	// The length and keys of the list cannot change once set.
	// This field is managed by evictionrequest-controller.
	TargetResponders []TargetResponderApplyConfiguration `json:"targetResponders,omitempty"`
	// responders represents the eviction process status of each declared responder.
	//
	// The responder list should be the same length and have the same .name fields as
	// .status.targetResponders. Only responders with .name that have Active state in
	// .targetResponders[].state should be updated and can be mutated. First initialization
	// of the list is allowed.
	//
	// Each ResponderStatus is initialized by evictionrequest-controller and then managed by
	// the designated responder.
	Responders []ResponderStatusApplyConfiguration `json:"responders,omitempty"`
}

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

// WithConditions adds the given value to the Conditions field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Conditions field.
func (b *EvictionStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *EvictionStatusApplyConfiguration {
	for i := range values {
		if values[i] == nil {
			panic("nil value passed to WithConditions")
		}
		b.Conditions = append(b.Conditions, *values[i])
	}
	return b
}

// WithObservedGeneration sets the ObservedGeneration 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 ObservedGeneration field is set to the value of the last call.
func (b *EvictionStatusApplyConfiguration) WithObservedGeneration(value int64) *EvictionStatusApplyConfiguration {
	b.ObservedGeneration = &value
	return b
}

// WithRequesters adds the given value to the Requesters field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Requesters field.
func (b *EvictionStatusApplyConfiguration) WithRequesters(values ...*RequesterApplyConfiguration) *EvictionStatusApplyConfiguration {
	for i := range values {
		if values[i] == nil {
			panic("nil value passed to WithRequesters")
		}
		b.Requesters = append(b.Requesters, *values[i])
	}
	return b
}

// WithTargetResponders adds the given value to the TargetResponders field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the TargetResponders field.
func (b *EvictionStatusApplyConfiguration) WithTargetResponders(values ...*TargetResponderApplyConfiguration) *EvictionStatusApplyConfiguration {
	for i := range values {
		if values[i] == nil {
			panic("nil value passed to WithTargetResponders")
		}
		b.TargetResponders = append(b.TargetResponders, *values[i])
	}
	return b
}

// WithResponders adds the given value to the Responders field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Responders field.
func (b *EvictionStatusApplyConfiguration) WithResponders(values ...*ResponderStatusApplyConfiguration) *EvictionStatusApplyConfiguration {
	for i := range values {
		if values[i] == nil {
			panic("nil value passed to WithResponders")
		}
		b.Responders = append(b.Responders, *values[i])
	}
	return b
}
