/*
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 (
	apisxv1alpha1 "sigs.k8s.io/gateway-api/apisx/v1alpha1"
	v1 "sigs.k8s.io/gateway-api/applyconfiguration/apis/v1"
)

// BackendTLSApplyConfiguration represents a declarative configuration of the BackendTLS type for use
// with apply.
//
// BackendTLS defines TLS configuration for connecting to a backend.
type BackendTLSApplyConfiguration struct {
	// Mode defines the TLS mode for the backend connection.
	Mode *apisxv1alpha1.BackendTLSMode `json:"mode,omitempty"`
	// ClientCertificateRef is a reference to a Secret containing the client
	// TLS certificate and private key for mutual TLS. This field is required
	// when mode is ClientAndServer and must be unset otherwise.
	ClientCertificateRef *v1.SecretObjectReferenceApplyConfiguration `json:"clientCertificateRef,omitempty"`
	// Validation contains TLS validation configuration for the backend connection.
	Validation *v1.BackendTLSPolicyValidationApplyConfiguration `json:"validation,omitempty"`
}

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

// WithMode sets the Mode 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 Mode field is set to the value of the last call.
func (b *BackendTLSApplyConfiguration) WithMode(value apisxv1alpha1.BackendTLSMode) *BackendTLSApplyConfiguration {
	b.Mode = &value
	return b
}

// WithClientCertificateRef sets the ClientCertificateRef 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 ClientCertificateRef field is set to the value of the last call.
func (b *BackendTLSApplyConfiguration) WithClientCertificateRef(value *v1.SecretObjectReferenceApplyConfiguration) *BackendTLSApplyConfiguration {
	b.ClientCertificateRef = value
	return b
}

// WithValidation sets the Validation 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 Validation field is set to the value of the last call.
func (b *BackendTLSApplyConfiguration) WithValidation(value *v1.BackendTLSPolicyValidationApplyConfiguration) *BackendTLSApplyConfiguration {
	b.Validation = value
	return b
}
