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

// HTTPAuthConfigApplyConfiguration represents a declarative configuration of the HTTPAuthConfig type for use
// with apply.
//
// HTTPAuthConfig contains configuration for communication with HTTP-speaking
// backends.
type HTTPAuthConfigApplyConfiguration struct {
	// Path sets the prefix that paths from the client request will have added
	// when forwarded to the authorization server.
	//
	// When empty or unspecified, no prefix is added.
	//
	// Valid values are the same as the "value" regex for path values in the `match`
	// stanza, and the validation regex will screen out invalid paths in the same way.
	// Even with the validation, implementations MUST sanitize this input before using it
	// directly.
	Path *string `json:"path,omitempty"`
	// AllowedRequestHeaders specifies what additional headers from the client request
	// will be sent to the authorization server.
	//
	// The following headers must always be sent to the authorization server,
	// regardless of this setting:
	//
	// * `Host`
	// * `Method`
	// * `Path`
	// * `Content-Length`
	// * `Authorization`
	//
	// If this list is empty, then only those headers must be sent.
	//
	// Note that `Content-Length` has a special behavior, in that the length
	// sent must be correct for the actual request to the external authorization
	// server - that is, it must reflect the actual number of bytes sent in the
	// body of the request to the authorization server.
	//
	// So if the `forwardBody` stanza is unset, or `forwardBody.maxSize` is set
	// to `0`, then `Content-Length` must be `0`. If `forwardBody.maxSize` is set
	// to anything other than `0`, then the `Content-Length` of the authorization
	// request must be set to the actual number of bytes forwarded.
	AllowedRequestHeaders []string `json:"allowedHeaders,omitempty"`
	// AllowedResponseHeaders specifies what headers from the authorization response
	// will be copied into the request to the backend.
	//
	// If this list is empty, then all headers from the authorization server
	// except Authority or Host must be copied.
	AllowedResponseHeaders []string `json:"allowedResponseHeaders,omitempty"`
}

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

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

// WithAllowedRequestHeaders adds the given value to the AllowedRequestHeaders 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 AllowedRequestHeaders field.
func (b *HTTPAuthConfigApplyConfiguration) WithAllowedRequestHeaders(values ...string) *HTTPAuthConfigApplyConfiguration {
	for i := range values {
		b.AllowedRequestHeaders = append(b.AllowedRequestHeaders, values[i])
	}
	return b
}

// WithAllowedResponseHeaders adds the given value to the AllowedResponseHeaders 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 AllowedResponseHeaders field.
func (b *HTTPAuthConfigApplyConfiguration) WithAllowedResponseHeaders(values ...string) *HTTPAuthConfigApplyConfiguration {
	for i := range values {
		b.AllowedResponseHeaders = append(b.AllowedResponseHeaders, values[i])
	}
	return b
}
