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

package v1

import (
	operatorv1 "github.com/openshift/api/operator/v1"
)

// ForwardPluginApplyConfiguration represents a declarative configuration of the ForwardPlugin type for use
// with apply.
//
// ForwardPlugin defines a schema for configuring the CoreDNS forward plugin.
type ForwardPluginApplyConfiguration struct {
	// upstreams is a list of resolvers to forward name queries for subdomains of Zones.
	// Each instance of CoreDNS performs health checking of Upstreams. When a healthy upstream
	// returns an error during the exchange, another resolver is tried from Upstreams. The
	// Upstreams are selected in the order specified in Policy. Each upstream is represented
	// by an IP address or IP:port if the upstream listens on a port other than 53.
	//
	// A maximum of 15 upstreams is allowed per ForwardPlugin.
	Upstreams []string `json:"upstreams,omitempty"`
	// policy is used to determine the order in which upstream servers are selected for querying.
	// Any one of the following values may be specified:
	//
	// * "Random" picks a random upstream server for each query.
	// * "RoundRobin" picks upstream servers in a round-robin order, moving to the next server for each new query.
	// * "Sequential" tries querying upstream servers in a sequential order until one responds, starting with the first server for each new query.
	//
	// The default value is "Random"
	Policy *operatorv1.ForwardingPolicy `json:"policy,omitempty"`
	// transportConfig is used to configure the transport type, server name, and optional custom CA or CA bundle to use
	// when forwarding DNS requests to an upstream resolver.
	//
	// The default value is "" (empty) which results in a standard cleartext connection being used when forwarding DNS
	// requests to an upstream resolver.
	TransportConfig *DNSTransportConfigApplyConfiguration `json:"transportConfig,omitempty"`
	// protocolStrategy specifies the protocol to use for upstream DNS
	// requests.
	// Valid values for protocolStrategy are "TCP" and omitted.
	// When omitted, this means no opinion and the platform is left to choose
	// a reasonable default, which is subject to change over time.
	// The current default is to use the protocol of the original client request.
	// "TCP" specifies that the platform should use TCP for all upstream DNS requests,
	// even if the client request uses UDP.
	// "TCP" is useful for UDP-specific issues such as those created by
	// non-compliant upstream resolvers, but may consume more bandwidth or
	// increase DNS response time. Note that protocolStrategy only affects
	// the protocol of DNS requests that CoreDNS makes to upstream resolvers.
	// It does not affect the protocol of DNS requests between clients and
	// CoreDNS.
	ProtocolStrategy *operatorv1.ProtocolStrategy `json:"protocolStrategy,omitempty"`
}

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

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

// WithPolicy sets the Policy 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 Policy field is set to the value of the last call.
func (b *ForwardPluginApplyConfiguration) WithPolicy(value operatorv1.ForwardingPolicy) *ForwardPluginApplyConfiguration {
	b.Policy = &value
	return b
}

// WithTransportConfig sets the TransportConfig 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 TransportConfig field is set to the value of the last call.
func (b *ForwardPluginApplyConfiguration) WithTransportConfig(value *DNSTransportConfigApplyConfiguration) *ForwardPluginApplyConfiguration {
	b.TransportConfig = value
	return b
}

// WithProtocolStrategy sets the ProtocolStrategy 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 ProtocolStrategy field is set to the value of the last call.
func (b *ForwardPluginApplyConfiguration) WithProtocolStrategy(value operatorv1.ProtocolStrategy) *ForwardPluginApplyConfiguration {
	b.ProtocolStrategy = &value
	return b
}
