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

package v1

import (
	configv1 "github.com/openshift/api/config/v1"
	metav1 "k8s.io/client-go/applyconfigurations/meta/v1"
)

// RequiredHSTSPolicyApplyConfiguration represents a declarative configuration of the RequiredHSTSPolicy type for use
// with apply.
type RequiredHSTSPolicyApplyConfiguration struct {
	// namespaceSelector specifies a label selector such that the policy applies only to those routes that
	// are in namespaces with labels that match the selector, and are in one of the DomainPatterns.
	// Defaults to the empty LabelSelector, which matches everything.
	NamespaceSelector *metav1.LabelSelectorApplyConfiguration `json:"namespaceSelector,omitempty"`
	// domainPatterns is a list of domains for which the desired HSTS annotations are required.
	// If domainPatterns is specified and a route is created with a spec.host matching one of the domains,
	// the route must specify the HSTS Policy components described in the matching RequiredHSTSPolicy.
	//
	// The use of wildcards is allowed like this: *.foo.com matches everything under foo.com.
	// foo.com only matches foo.com, so to cover foo.com and everything under it, you must specify *both*.
	DomainPatterns []string `json:"domainPatterns,omitempty"`
	// maxAge is the delta time range in seconds during which hosts are regarded as HSTS hosts.
	// If set to 0, it negates the effect, and hosts are removed as HSTS hosts.
	// If set to 0 and includeSubdomains is specified, all subdomains of the host are also removed as HSTS hosts.
	// maxAge is a time-to-live value, and if this policy is not refreshed on a client, the HSTS
	// policy will eventually expire on that client.
	MaxAge *MaxAgePolicyApplyConfiguration `json:"maxAge,omitempty"`
	// preloadPolicy directs the client to include hosts in its host preload list so that
	// it never needs to do an initial load to get the HSTS header (note that this is not defined
	// in RFC 6797 and is therefore client implementation-dependent).
	PreloadPolicy *configv1.PreloadPolicy `json:"preloadPolicy,omitempty"`
	// includeSubDomainsPolicy means the HSTS Policy should apply to any subdomains of the host's
	// domain name.  Thus, for the host bar.foo.com, if includeSubDomainsPolicy was set to RequireIncludeSubDomains:
	// - the host app.bar.foo.com would inherit the HSTS Policy of bar.foo.com
	// - the host bar.foo.com would inherit the HSTS Policy of bar.foo.com
	// - the host foo.com would NOT inherit the HSTS Policy of bar.foo.com
	// - the host def.foo.com would NOT inherit the HSTS Policy of bar.foo.com
	IncludeSubDomainsPolicy *configv1.IncludeSubDomainsPolicy `json:"includeSubDomainsPolicy,omitempty"`
}

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

// WithNamespaceSelector sets the NamespaceSelector 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 NamespaceSelector field is set to the value of the last call.
func (b *RequiredHSTSPolicyApplyConfiguration) WithNamespaceSelector(value *metav1.LabelSelectorApplyConfiguration) *RequiredHSTSPolicyApplyConfiguration {
	b.NamespaceSelector = value
	return b
}

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

// WithMaxAge sets the MaxAge 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 MaxAge field is set to the value of the last call.
func (b *RequiredHSTSPolicyApplyConfiguration) WithMaxAge(value *MaxAgePolicyApplyConfiguration) *RequiredHSTSPolicyApplyConfiguration {
	b.MaxAge = value
	return b
}

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

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