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

package v1

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

// NodeDisruptionPolicySpecUnitApplyConfiguration represents a declarative configuration of the NodeDisruptionPolicySpecUnit type for use
// with apply.
//
// NodeDisruptionPolicySpecUnit is a systemd unit name and corresponding actions to take and is used in the NodeDisruptionPolicyConfig object
type NodeDisruptionPolicySpecUnitApplyConfiguration struct {
	// name represents the service name of a systemd service managed through a MachineConfig
	// Actions specified will be applied for changes to the named service.
	// Service names should be of the format ${NAME}${SERVICETYPE} and can up to 255 characters long.
	// ${NAME} must be atleast 1 character long and can only consist of alphabets, digits, ":", "-", "_", ".", and "\".
	// ${SERVICETYPE} must be one of ".service", ".socket", ".device", ".mount", ".automount", ".swap", ".target", ".path", ".timer", ".snapshot", ".slice" or ".scope".
	Name *operatorv1.NodeDisruptionPolicyServiceName `json:"name,omitempty"`
	// actions represents the series of commands to be executed on changes to the file at
	// the corresponding file path. Actions will be applied in the order that
	// they are set in this list. If there are other incoming changes to other MachineConfig
	// entries in the same update that require a reboot, the reboot will supercede these actions.
	// Valid actions are Reboot, Drain, Reload, DaemonReload and None.
	// The Reboot action and the None action cannot be used in conjunction with any of the other actions.
	// This list supports a maximum of 10 entries.
	Actions []NodeDisruptionPolicySpecActionApplyConfiguration `json:"actions,omitempty"`
}

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

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

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