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

package v1

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

// UpdateApplyConfiguration represents a declarative configuration of the Update type for use
// with apply.
//
// Update represents an administrator update request.
type UpdateApplyConfiguration struct {
	// architecture is an optional field that indicates the desired
	// value of the cluster architecture. In this context cluster
	// architecture means either a single architecture or a multi
	// architecture. architecture can only be set to Multi thereby
	// only allowing updates from single to multi architecture. If
	// architecture is set, image cannot be set and version must be
	// set.
	// Valid values are 'Multi' and empty.
	Architecture *configv1.ClusterVersionArchitecture `json:"architecture,omitempty"`
	// version is a semantic version identifying the update version.
	// version is required if architecture is specified.
	// If both version and image are set, the version extracted from the referenced image must match the specified version.
	Version *string `json:"version,omitempty"`
	// image is a container image location that contains the update.
	// image should be used when the desired version does not exist in availableUpdates or history.
	// When image is set, architecture cannot be specified.
	// If both version and image are set, the version extracted from the referenced image must match the specified version.
	Image *string `json:"image,omitempty"`
	// force allows an administrator to update to an image that has failed
	// verification or upgradeable checks that are designed to keep your
	// cluster safe. Only use this if:
	// * you are testing unsigned release images in short-lived test clusters or
	// * you are working around a known bug in the cluster-version
	// operator and you have verified the authenticity of the provided
	// image yourself.
	// The provided image will run with full administrative access
	// to the cluster. Do not use this flag with images that come from unknown
	// or potentially malicious sources.
	Force *bool `json:"force,omitempty"`
	// acceptRisks is an optional set of names of conditional update risks that are considered acceptable.
	// A conditional update is performed only if all of its risks are acceptable.
	// This list may contain entries that apply to current, previous or future updates.
	// The entries therefore may not map directly to a risk in .status.conditionalUpdateRisks.
	// acceptRisks must not contain more than 1000 entries.
	// Entries in this list must be unique.
	AcceptRisks []AcceptRiskApplyConfiguration `json:"acceptRisks,omitempty"`
	// mode determines how an update should be processed.
	// The only valid value is "Preflight".
	// When omitted, the cluster performs a normal update by applying the specified version or image to the cluster.
	// This is the standard update behavior.
	// When set to "Preflight", the cluster runs compatibility checks against the target release without
	// performing an actual update. Compatibility results, including any detected risks, are reported
	// in status.conditionalUpdates and status.conditionalUpdateRisks alongside risks from the update
	// recommendation service.
	// This allows administrators to assess update readiness and address issues before committing to the update.
	// Preflight mode is particularly useful for skip-level updates where upgrade compatibility needs to be
	// verified across multiple minor versions.
	// When mode is set to "Preflight", the same rules for version, image, and architecture apply as for normal updates.
	Mode *configv1.UpdateMode `json:"mode,omitempty"`
}

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

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

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

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

// WithForce sets the Force 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 Force field is set to the value of the last call.
func (b *UpdateApplyConfiguration) WithForce(value bool) *UpdateApplyConfiguration {
	b.Force = &value
	return b
}

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

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