// Code generated by applyconfiguration-gen. DO NOT EDIT.

package v1

import (
	routev1 "github.com/openshift/api/route/v1"
)

// TLSConfigApplyConfiguration represents a declarative configuration of the TLSConfig type for use
// with apply.
//
// TLSConfig defines config used to secure a route and provide termination
type TLSConfigApplyConfiguration struct {
	// termination indicates the TLS termination type.
	//
	// * edge - TLS termination is done by the router and http is used to communicate with the backend (default)
	//
	// * passthrough - Traffic is sent straight to the destination without the router providing TLS termination
	//
	// * reencrypt - TLS termination is done by the router and https is used to communicate with the backend
	//
	// Note: passthrough termination is incompatible with httpHeader actions
	Termination *routev1.TLSTerminationType `json:"termination,omitempty"`
	// certificate provides certificate contents. This should be a single serving certificate, not a certificate
	// chain. Do not include a CA certificate.
	Certificate *string `json:"certificate,omitempty"`
	// key provides key file contents
	Key *string `json:"key,omitempty"`
	// caCertificate provides the cert authority certificate contents
	CACertificate *string `json:"caCertificate,omitempty"`
	// destinationCACertificate provides the contents of the ca certificate of the final destination.  When using reencrypt
	// termination this file should be provided in order to have routers use it for health checks on the secure connection.
	// If this field is not specified, the router may provide its own destination CA and perform hostname validation using
	// the short service name (service.namespace.svc), which allows infrastructure generated certificates to automatically
	// verify.
	DestinationCACertificate *string `json:"destinationCACertificate,omitempty"`
	// insecureEdgeTerminationPolicy indicates the desired behavior for insecure connections to a route. While
	// each router may make its own decisions on which ports to expose, this is normally port 80.
	//
	// If a route does not specify insecureEdgeTerminationPolicy, then the default behavior is "None".
	//
	// * Allow - traffic is sent to the server on the insecure port (edge/reencrypt terminations only).
	//
	// * None - no traffic is allowed on the insecure port (default).
	//
	// * Redirect - clients are redirected to the secure port.
	InsecureEdgeTerminationPolicy *routev1.InsecureEdgeTerminationPolicyType `json:"insecureEdgeTerminationPolicy,omitempty"`
	// externalCertificate provides certificate contents as a secret reference.
	// This should be a single serving certificate, not a certificate
	// chain. Do not include a CA certificate. The secret referenced should
	// be present in the same namespace as that of the Route.
	// Forbidden when `certificate` is set.
	// The router service account needs to be granted with read-only access to this secret,
	// please refer to openshift docs for additional details.
	ExternalCertificate *LocalObjectReferenceApplyConfiguration `json:"externalCertificate,omitempty"`
}

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

// WithTermination sets the Termination 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 Termination field is set to the value of the last call.
func (b *TLSConfigApplyConfiguration) WithTermination(value routev1.TLSTerminationType) *TLSConfigApplyConfiguration {
	b.Termination = &value
	return b
}

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

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

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

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

// WithInsecureEdgeTerminationPolicy sets the InsecureEdgeTerminationPolicy 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 InsecureEdgeTerminationPolicy field is set to the value of the last call.
func (b *TLSConfigApplyConfiguration) WithInsecureEdgeTerminationPolicy(value routev1.InsecureEdgeTerminationPolicyType) *TLSConfigApplyConfiguration {
	b.InsecureEdgeTerminationPolicy = &value
	return b
}

// WithExternalCertificate sets the ExternalCertificate 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 ExternalCertificate field is set to the value of the last call.
func (b *TLSConfigApplyConfiguration) WithExternalCertificate(value *LocalObjectReferenceApplyConfiguration) *TLSConfigApplyConfiguration {
	b.ExternalCertificate = value
	return b
}
