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

// ForwardBodyConfigApplyConfiguration represents a declarative configuration of the ForwardBodyConfig type for use
// with apply.
//
// ForwardBody configures if requests to the authorization server should include
// the body of the client request; and if so, how big that body is allowed
// to be.
//
// If empty or unset, do not forward the body.
type ForwardBodyConfigApplyConfiguration struct {
	// MaxSize specifies how large in bytes the largest body that will be buffered
	// and sent to the authorization server. If the body size is larger than
	// `maxSize`, then the body sent to the authorization server must be
	// truncated to `maxSize` bytes.
	//
	// Experimental note: This behavior needs to be checked against
	// various dataplanes; it may need to be changed.
	// See https://github.com/kubernetes-sigs/gateway-api/pull/4001#discussion_r2291405746
	// for more.
	//
	// If 0, the body will not be sent to the authorization server.
	MaxSize *uint16 `json:"maxSize,omitempty"`
}

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

// WithMaxSize sets the MaxSize 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 MaxSize field is set to the value of the last call.
func (b *ForwardBodyConfigApplyConfiguration) WithMaxSize(value uint16) *ForwardBodyConfigApplyConfiguration {
	b.MaxSize = &value
	return b
}
