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

package v1

// NetworkSpecApplyConfiguration represents a declarative configuration of the NetworkSpec type for use
// with apply.
//
// NetworkSpec is the desired network configuration.
// As a general rule, this SHOULD NOT be read directly. Instead, you should
// consume the NetworkStatus, as it indicates the currently deployed configuration.
// Currently, most spec fields are immutable after installation. Please view the individual ones for further details on each.
type NetworkSpecApplyConfiguration struct {
	// IP address pool to use for pod IPs.
	// This field is immutable after installation.
	ClusterNetwork []ClusterNetworkEntryApplyConfiguration `json:"clusterNetwork,omitempty"`
	// IP address pool for services.
	// Currently, we only support a single entry here.
	// This field is immutable after installation.
	ServiceNetwork []string `json:"serviceNetwork,omitempty"`
	// networkType is the plugin that is to be deployed (e.g. OVNKubernetes).
	// This should match a value that the cluster-network-operator understands,
	// or else no networking will be installed.
	// Currently supported values are:
	// - OVNKubernetes
	// This field is immutable after installation.
	NetworkType *string `json:"networkType,omitempty"`
	// externalIP defines configuration for controllers that
	// affect Service.ExternalIP. If nil, then ExternalIP is
	// not allowed to be set.
	ExternalIP *ExternalIPConfigApplyConfiguration `json:"externalIP,omitempty"`
	// The port range allowed for Services of type NodePort.
	// If not specified, the default of 30000-32767 will be used.
	// Such Services without a NodePort specified will have one
	// automatically allocated from this range.
	// This parameter can be updated after the cluster is
	// installed.
	ServiceNodePortRange *string `json:"serviceNodePortRange,omitempty"`
	// networkDiagnostics defines network diagnostics configuration.
	//
	// Takes precedence over spec.disableNetworkDiagnostics in network.operator.openshift.io.
	// If networkDiagnostics is not specified or is empty,
	// and the spec.disableNetworkDiagnostics flag in network.operator.openshift.io is set to true,
	// the network diagnostics feature will be disabled.
	NetworkDiagnostics *NetworkDiagnosticsApplyConfiguration `json:"networkDiagnostics,omitempty"`
	// networkObservability is an optional field that configures network observability installation
	// during cluster deployment (day-0).
	// When omitted, unless this is a SNO cluster, network observability will be installed if not already present, after that, no action taken.
	NetworkObservability *NetworkObservabilitySpecApplyConfiguration `json:"networkObservability,omitempty"`
}

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

// WithClusterNetwork adds the given value to the ClusterNetwork 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 ClusterNetwork field.
func (b *NetworkSpecApplyConfiguration) WithClusterNetwork(values ...*ClusterNetworkEntryApplyConfiguration) *NetworkSpecApplyConfiguration {
	for i := range values {
		if values[i] == nil {
			panic("nil value passed to WithClusterNetwork")
		}
		b.ClusterNetwork = append(b.ClusterNetwork, *values[i])
	}
	return b
}

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

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

// WithExternalIP sets the ExternalIP 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 ExternalIP field is set to the value of the last call.
func (b *NetworkSpecApplyConfiguration) WithExternalIP(value *ExternalIPConfigApplyConfiguration) *NetworkSpecApplyConfiguration {
	b.ExternalIP = value
	return b
}

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

// WithNetworkDiagnostics sets the NetworkDiagnostics 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 NetworkDiagnostics field is set to the value of the last call.
func (b *NetworkSpecApplyConfiguration) WithNetworkDiagnostics(value *NetworkDiagnosticsApplyConfiguration) *NetworkSpecApplyConfiguration {
	b.NetworkDiagnostics = value
	return b
}

// WithNetworkObservability sets the NetworkObservability 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 NetworkObservability field is set to the value of the last call.
func (b *NetworkSpecApplyConfiguration) WithNetworkObservability(value *NetworkObservabilitySpecApplyConfiguration) *NetworkSpecApplyConfiguration {
	b.NetworkObservability = value
	return b
}
