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

package v1

import (
	configv1 "github.com/openshift/api/config/v1"
)

// APIServerSpecApplyConfiguration represents a declarative configuration of the APIServerSpec type for use
// with apply.
type APIServerSpecApplyConfiguration struct {
	// servingCert is the TLS cert info for serving secure traffic. If not specified, operator managed certificates
	// will be used for serving secure traffic.
	ServingCerts *APIServerServingCertsApplyConfiguration `json:"servingCerts,omitempty"`
	// clientCA references a ConfigMap containing a certificate bundle for the signers that will be recognized for
	// incoming client certificates in addition to the operator managed signers. If this is empty, then only operator managed signers are valid.
	// You usually only have to set this if you have your own PKI you wish to honor client certificates from.
	// The ConfigMap must exist in the openshift-config namespace and contain the following required fields:
	// - ConfigMap.Data["ca-bundle.crt"] - CA bundle.
	ClientCA *ConfigMapNameReferenceApplyConfiguration `json:"clientCA,omitempty"`
	// additionalCORSAllowedOrigins lists additional, user-defined regular expressions describing hosts for which the
	// API server allows access using the CORS headers. This may be needed to access the API and the integrated OAuth
	// server from JavaScript applications.
	// The values are regular expressions that correspond to the Golang regular expression language.
	AdditionalCORSAllowedOrigins []string `json:"additionalCORSAllowedOrigins,omitempty"`
	// encryption allows the configuration of encryption of resources at the datastore layer.
	Encryption *APIServerEncryptionApplyConfiguration `json:"encryption,omitempty"`
	// tlsSecurityProfile specifies settings for TLS connections for externally exposed servers.
	//
	// 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 the Intermediate profile.
	TLSSecurityProfile *TLSSecurityProfileApplyConfiguration `json:"tlsSecurityProfile,omitempty"`
	// tlsAdherence controls if components in the cluster adhere to the TLS security profile
	// configured on this APIServer resource.
	//
	// Valid values are "LegacyAdheringComponentsOnly" and "StrictAllComponents".
	//
	// When set to "LegacyAdheringComponentsOnly", components that already honor the
	// cluster-wide TLS profile continue to do so. Components that do not already honor
	// it continue to use their individual TLS configurations.
	//
	// When set to "StrictAllComponents", all components must honor the configured TLS
	// profile unless they have a component-specific TLS configuration that overrides
	// it. This mode is recommended for security-conscious deployments and is required
	// for certain compliance frameworks.
	//
	// Note: Some components such as Kubelet and IngressController have their own
	// dedicated TLS configuration mechanisms via KubeletConfig and IngressController
	// CRs respectively. When these component-specific TLS configurations are set,
	// they take precedence over the cluster-wide tlsSecurityProfile. When not set,
	// these components fall back to the cluster-wide default.
	//
	// Components that encounter an unknown value for tlsAdherence should treat it
	// as "StrictAllComponents" and log a warning to ensure forward compatibility
	// while defaulting to the more secure behavior.
	//
	// This field is optional.
	// When omitted, this means the user has no opinion and the platform is left
	// to choose reasonable defaults. These defaults are subject to change over time.
	// The current default is LegacyAdheringComponentsOnly.
	//
	// Once set, this field may be changed to a different value, but may not be removed.
	TLSAdherence *configv1.TLSAdherencePolicy `json:"tlsAdherence,omitempty"`
	// audit specifies the settings for audit configuration to be applied to all OpenShift-provided
	// API servers in the cluster.
	Audit *AuditApplyConfiguration `json:"audit,omitempty"`
}

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

// WithServingCerts sets the ServingCerts 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 ServingCerts field is set to the value of the last call.
func (b *APIServerSpecApplyConfiguration) WithServingCerts(value *APIServerServingCertsApplyConfiguration) *APIServerSpecApplyConfiguration {
	b.ServingCerts = value
	return b
}

// WithClientCA sets the ClientCA 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 ClientCA field is set to the value of the last call.
func (b *APIServerSpecApplyConfiguration) WithClientCA(value *ConfigMapNameReferenceApplyConfiguration) *APIServerSpecApplyConfiguration {
	b.ClientCA = value
	return b
}

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

// WithEncryption sets the Encryption 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 Encryption field is set to the value of the last call.
func (b *APIServerSpecApplyConfiguration) WithEncryption(value *APIServerEncryptionApplyConfiguration) *APIServerSpecApplyConfiguration {
	b.Encryption = value
	return b
}

// WithTLSSecurityProfile sets the TLSSecurityProfile 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 TLSSecurityProfile field is set to the value of the last call.
func (b *APIServerSpecApplyConfiguration) WithTLSSecurityProfile(value *TLSSecurityProfileApplyConfiguration) *APIServerSpecApplyConfiguration {
	b.TLSSecurityProfile = value
	return b
}

// WithTLSAdherence sets the TLSAdherence 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 TLSAdherence field is set to the value of the last call.
func (b *APIServerSpecApplyConfiguration) WithTLSAdherence(value configv1.TLSAdherencePolicy) *APIServerSpecApplyConfiguration {
	b.TLSAdherence = &value
	return b
}

// WithAudit sets the Audit 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 Audit field is set to the value of the last call.
func (b *APIServerSpecApplyConfiguration) WithAudit(value *AuditApplyConfiguration) *APIServerSpecApplyConfiguration {
	b.Audit = value
	return b
}
