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

package v1

import (
	buildv1 "github.com/openshift/api/build/v1"
	corev1 "k8s.io/api/core/v1"
)

// CommonSpecApplyConfiguration represents a declarative configuration of the CommonSpec type for use
// with apply.
//
// CommonSpec encapsulates all the inputs necessary to represent a build.
type CommonSpecApplyConfiguration struct {
	// serviceAccount is the name of the ServiceAccount to use to run the pod
	// created by this build.
	// The pod will be allowed to use secrets referenced by the ServiceAccount
	ServiceAccount *string `json:"serviceAccount,omitempty"`
	// source describes the SCM in use.
	Source *BuildSourceApplyConfiguration `json:"source,omitempty"`
	// revision is the information from the source for a specific repo snapshot.
	// This is optional.
	Revision *SourceRevisionApplyConfiguration `json:"revision,omitempty"`
	// strategy defines how to perform a build.
	Strategy *BuildStrategyApplyConfiguration `json:"strategy,omitempty"`
	// output describes the container image the Strategy should produce.
	Output *BuildOutputApplyConfiguration `json:"output,omitempty"`
	// resources computes resource requirements to execute the build.
	Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
	// postCommit is a build hook executed after the build output image is
	// committed, before it is pushed to a registry.
	PostCommit *BuildPostCommitSpecApplyConfiguration `json:"postCommit,omitempty"`
	// completionDeadlineSeconds is an optional duration in seconds, counted from
	// the time when a build pod gets scheduled in the system, that the build may
	// be active on a node before the system actively tries to terminate the
	// build; value must be positive integer
	CompletionDeadlineSeconds *int64 `json:"completionDeadlineSeconds,omitempty"`
	// nodeSelector is a selector which must be true for the build pod to fit on a node
	// If nil, it can be overridden by default build nodeselector values for the cluster.
	// If set to an empty map or a map with any values, default build nodeselector values
	// are ignored.
	NodeSelector *buildv1.OptionalNodeSelector `json:"nodeSelector,omitempty"`
	// mountTrustedCA bind mounts the cluster's trusted certificate authorities, as defined in
	// the cluster's proxy configuration, into the build. This lets processes within a build trust
	// components signed by custom PKI certificate authorities, such as private artifact
	// repositories and HTTPS proxies.
	//
	// When this field is set to true, the contents of `/etc/pki/ca-trust` within the build are
	// managed by the build container, and any changes to this directory or its subdirectories (for
	// example - within a Dockerfile `RUN` instruction) are not persisted in the build's output image.
	MountTrustedCA *bool `json:"mountTrustedCA,omitempty"`
}

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

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

// WithSource sets the Source 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 Source field is set to the value of the last call.
func (b *CommonSpecApplyConfiguration) WithSource(value *BuildSourceApplyConfiguration) *CommonSpecApplyConfiguration {
	b.Source = value
	return b
}

// WithRevision sets the Revision 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 Revision field is set to the value of the last call.
func (b *CommonSpecApplyConfiguration) WithRevision(value *SourceRevisionApplyConfiguration) *CommonSpecApplyConfiguration {
	b.Revision = value
	return b
}

// WithStrategy sets the Strategy 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 Strategy field is set to the value of the last call.
func (b *CommonSpecApplyConfiguration) WithStrategy(value *BuildStrategyApplyConfiguration) *CommonSpecApplyConfiguration {
	b.Strategy = value
	return b
}

// WithOutput sets the Output 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 Output field is set to the value of the last call.
func (b *CommonSpecApplyConfiguration) WithOutput(value *BuildOutputApplyConfiguration) *CommonSpecApplyConfiguration {
	b.Output = value
	return b
}

// WithResources sets the Resources 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 Resources field is set to the value of the last call.
func (b *CommonSpecApplyConfiguration) WithResources(value corev1.ResourceRequirements) *CommonSpecApplyConfiguration {
	b.Resources = &value
	return b
}

// WithPostCommit sets the PostCommit 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 PostCommit field is set to the value of the last call.
func (b *CommonSpecApplyConfiguration) WithPostCommit(value *BuildPostCommitSpecApplyConfiguration) *CommonSpecApplyConfiguration {
	b.PostCommit = value
	return b
}

// WithCompletionDeadlineSeconds sets the CompletionDeadlineSeconds 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 CompletionDeadlineSeconds field is set to the value of the last call.
func (b *CommonSpecApplyConfiguration) WithCompletionDeadlineSeconds(value int64) *CommonSpecApplyConfiguration {
	b.CompletionDeadlineSeconds = &value
	return b
}

// WithNodeSelector sets the NodeSelector 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 NodeSelector field is set to the value of the last call.
func (b *CommonSpecApplyConfiguration) WithNodeSelector(value buildv1.OptionalNodeSelector) *CommonSpecApplyConfiguration {
	b.NodeSelector = &value
	return b
}

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