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

// RouteStatusApplyConfiguration represents a declarative configuration of the RouteStatus type for use
// with apply.
//
// RouteStatus defines the common attributes that all Routes MUST include within
// their status.
type RouteStatusApplyConfiguration struct {
	// Parents is a list of parent resources (usually Gateways) that are
	// associated with the route, and the status of the route with respect to
	// each parent. When this route attaches to a parent, the controller that
	// manages the parent must add an entry to this list when the controller
	// first sees the route and should update the entry as appropriate when the
	// route or gateway is modified.
	//
	// Note that parent references that cannot be resolved by an implementation
	// of this API will not be added to this list. Implementations of this API
	// can only populate Route status for the Gateways/parent resources they are
	// responsible for.
	//
	// A maximum of 32 Gateways will be represented in this list. An empty list
	// means the route has not been attached to any Gateway.
	//
	// <gateway:util:excludeFromCRD>
	// Notes for implementors:
	//
	// While parents is not a listType `map`, this is due to the fact that the
	// list key is not scalar, and Kubernetes is unable to represent this.
	//
	// Parent status MUST be considered to be namespaced by the combination of
	// the parentRef and controllerName fields, and implementations should keep
	// the following rules in mind when updating this status:
	//
	// * Implementations MUST update only entries that have a matching value of
	// `controllerName` for that implementation.
	// * Implementations MUST NOT update entries with non-matching `controllerName`
	// fields.
	// * Implementations MUST treat each `parentRef“ in the Route separately and
	// update its status based on the relationship with that parent.
	// * Implementations MUST perform a read-modify-write cycle on this field
	// before modifying it. That is, when modifying this field, implementations
	// must be confident they have fetched the most recent version of this field,
	// and ensure that changes they make are on that recent version.
	//
	// </gateway:util:excludeFromCRD>
	Parents []RouteParentStatusApplyConfiguration `json:"parents,omitempty"`
}

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

// WithParents adds the given value to the Parents 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 Parents field.
func (b *RouteStatusApplyConfiguration) WithParents(values ...*RouteParentStatusApplyConfiguration) *RouteStatusApplyConfiguration {
	for i := range values {
		if values[i] == nil {
			panic("nil value passed to WithParents")
		}
		b.Parents = append(b.Parents, *values[i])
	}
	return b
}
